猿问

导出 BIP32 公钥(Base64 格式)

我正在使用这个BIP32 实现来派生密钥。如何导出 Base64 格式的派生公钥?


var node = bip32js.bip32.fromBase58('<some private key>');

var child = node.derivePath('m/0/0');

var publicKey = child.publicKey(); // This gets the public key for the child

console.log(btoa(publicKey)) // This gives an error since the returned public key is not a string


哈士奇WWW
浏览 165回答 1
1回答

喵喵时光机

publicKey是一个缓冲区。publicKey.toString('hex') 会将其转换为十六进制字符串。类似地,对于 Base64,可以使用“base64”。
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答