This repository has been archived by the owner on Apr 3, 2019. It is now read-only.
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.
Open
Description
The derived() function sometimes returns 31 byte keys. In the derive()
function here:
https://github.com/bitpay/bitcore-lib/blob/master/lib/hdprivatekey.js#L194
there is clearly the intention of having the Buffer padded to 32 bytes. But when testing the resulting private key is not padded. To replicate:
var Mnemonic = require('bitcore-mnemonic')
var seed = "erupt consider beyond twist bike enroll you salute weasel emerge divert hundred";
var hdprivkey = (new Mnemonic(seed)).toHDPrivateKey().derive("m/44'/60'/0'/0")
console.log(hdprivkey.privateKey.toBuffer().length) // prints 31
Related: Consensys/eth-lightwallet#60