mirror of
https://github.com/embarklabs/ethereumjs-wallet.git
synced 2025-01-13 12:14:58 +00:00
Update hdkey to 0.8.0
This commit is contained in:
parent
52f0ca9eeb
commit
47a0001149
5
hdkey.js
5
hdkey.js
@ -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
|
||||
}
|
||||
|
@ -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",
|
||||
|
@ -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')
|
||||
|
Loading…
x
Reference in New Issue
Block a user