Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('record with key from from go', (done) => {
const pubKey = crypto.unmarshalPublicKey(fixture.publicKey)
pubKey.hash((err, hash) => {
expect(err).to.not.exist
const k = `/pk/${mh.toB58String(hash)}`
validator.validators.pk.func(k, pubKey.bytes, done)
})
})
})
exports.from = (_publicKey, _privateKey, callback) => {
console.log('creating keys from', _publicKey.length, _privateKey && _privateKey.length)
const publicKey = crypto.unmarshalPublicKey(_publicKey)
if (!_privateKey) {
return callback(null, {
'public': publicKey
})
}
crypto.unmarshalPrivateKey(_privateKey, (err, privateKey) => {
if (err) { return callback(err) }
callback(null, {
'public': publicKey,
'private': privateKey
})
})
}