Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function sign(tx, secret) {
const key = Keypair.fromSecret(secret);
tx.account = key.publicKey();
tx.signature = key.sign(getUnsignedHash(tx));
}
const {Keypair} = require('stellar-base'),
config = require('../models/config')
const signingKeypair = Keypair.fromSecret(config.signatureSecret)
function processSigningData(dataToSign) {
if (!dataToSign) throw new TypeError('Invalid data')
if (typeof dataToSign === 'object') dataToSign = JSON.stringify(dataToSign)
if (typeof dataToSign !== 'string') throw new TypeError('Invalid data. Expected string or plain object.')
return dataToSign
}
module.exports = {
/**
* Get signing public key.
* @returns {string}
*/
getPublicKey: function () {
return signingKeypair.publicKey()
},