Update hdkey to 0.8.0

This commit is contained in:
Alex Beregszaszi 2018-02-07 08:50:49 +00:00
parent 52f0ca9eeb
commit 47a0001149
3 changed files with 4 additions and 5 deletions

View File

@ -22,9 +22,8 @@ EthereumHDKey.fromExtendedKey = function (base58key) {
}
EthereumHDKey.prototype.privateExtendedKey = function () {
// FIXME: change this according to the outcome of https://github.com/cryptocoinjs/hdkey/issues/7
if (!this._hdkey._privateKey) {
throw new Error('Private key is not available')
if (!this._hdkey.privateExtendedKey) {
throw new Error('This is a public key only wallet')
}
return this._hdkey.privateExtendedKey
}

View File

@ -29,7 +29,7 @@
"aes-js": "^3.1.0",
"bs58check": "^2.1.1",
"ethereumjs-util": "^5.1.4",
"hdkey": "^0.7.0",
"hdkey": "^0.8.0",
"safe-buffer": "^5.1.1",
"scrypt.js": "^0.2.0",
"utf8": "^3.0.0",

View File

@ -32,7 +32,7 @@ describe('.fromExtendedKey()', function () {
assert.equal(hdnode.publicExtendedKey(), 'xpub661MyMwAqRbcGout4B6s29b6gGQsowyoiF6UgXBEr7eFCWYfXuZDvRxP9zEh1Kwq3TLqDQMbkbaRpSnoC28oWvjLeshoQz1StZ9YHM1EpcJ')
assert.throws(function () {
hdnode.privateExtendedKey()
}, /^Error: Private key is not available$/)
}, /^Error: This is a public key only wallet$/)
})
it('should work with private', function () {
var hdnode = HDKey.fromExtendedKey('xprv9s21ZrQH143K4KqQx9Zrf1eN8EaPQVFxM2Ast8mdHn7GKiDWzNEyNdduJhWXToy8MpkGcKjxeFWd8oBSvsz4PCYamxR7TX49pSpp3bmHVAY')