Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const getBtcPayClient = function(podcast) {
const serverInfo = podcast.btcPayServer;
const keyPair = btcpay.crypto.load_keypair(
// eslint-disable-next-line new-cap
new Buffer.from(serverInfo.privateKey, 'hex'));
return new btcpay.BTCPayClient(
serverInfo.serverUrl,
keyPair,
{merchant: serverInfo.merchantCode});
}
;
module.exports.pairClient = function(btcpayUrl, pairCode, callback) {
const privKey = btcpay.crypto.generate_keypair().getPrivate().toString();
// eslint-disable-next-line new-cap
const keyPair = btcpay.crypto.load_keypair(new Buffer.from(privKey, 'hex'));
new btcpay.BTCPayClient(btcpayUrl,
keyPair)
.pair_client(pairCode)
.then(function(res) {
callback(null, res.merchant, privKey);
})
.catch(function(err) {
callback(err);
});
};