How to get BTCPAY_KEY to pair BTCPay NodeJS client?
savshit opened this issue · 3 comments
Hello,
I have execute below command to generate private key :
node -p "require('btcpay').crypto.generate_keypair()"
output :
KeyPair {
ec: EC {
curve: ShortCurve {
type: 'short',
p: [BN],
red: [Red],
zero: [BN],
one: [BN],
two: [BN],
n: [BN],
g: [Point],
_wnafT1: [Array],
_wnafT2: [Array],
_wnafT3: [Array],
_wnafT4: [Array],
_bitLength: 256,
_maxwellTrick: true,
redN: [BN],
a: [BN],
b: [BN],
tinv: [BN],
zeroA: true,
threeA: false,
endo: [Object],
_endoWnafT1: [Array],
_endoWnafT2: [Array]
},
n: BN { negative: 0, words: [Array], length: 10, red: null },
nh: BN { negative: 0, words: [Array], length: 10, red: null },
g: Point {
curve: [ShortCurve],
type: 'affine',
precomputed: [Object],
x: [BN],
y: [BN],
inf: false
},
hash: [Function: SHA256] {
blockSize: 512,
outSize: 256,
hmacStrength: 192,
padLength: 64
}
},
priv: BN {
negative: 0,
words: [
60122369, 6539265,
32022909, 18000869,
54800933, 37009431,
11861628, 15322106,
12775509, 2015340,
0
],
length: 10,
red: null
},
pub: null
}
then i move further to pair client to server:
# Replace the BTCPAY_XXX envirnoment variables with your values and run:
$ [space] BTCPAY_URL=https://mydomain.com/ BTCPAY_KEY=... BTCPAY_PAIRCODE=... node -e "const btcpay=require('btcpay'); new btcpay.BTCPayClient(process.env.BTCPAY_URL, btcpay.crypto.load_keypair(Buffer.from(process.env.BTCPAY_KEY, 'hex'))).pair_client(process.env.BTCPAY_PAIRCODE).then(console.log).catch(console.error)"
# (prepend the line with a space to prevent BTCPAY_KEY from being saved to your bash history)
>>> { merchant: 'XXXXXX' }
Here i have set BTCPAY_URL = https://testnet.demo.btcpayserver.org/
BTCPAY_KEY = not found, where to get it?
BTCPAY_PAIRCODE= 'fLkLhsX'
Where I get BTCPAY_KEY and use it in the above code?
can anyone guide me on how to pair the client to the server with the BTCPAY server node library?
generate private key : node -p "require('btcpay').crypto.generate_keypair().getPrivate('hex')"
generate public key : node -p "require('btcpay').crypto.generate_keypair().getPublic(true|false, 'hex')"
use the above command to generate private and public key and use it to pair client to server.
@savshit this create two different keypair.