Browse Source

test: include derivation test when private key has leading zeros

master
Braydon Fuller 8 years ago
parent
commit
5b788e9508
  1. 10
      test/hdkey.test.js

10
test/hdkey.test.js

@ -140,6 +140,16 @@ describe('hdkey', function () {
})
})
describe('> when private key has leading zeros', function () {
it('will include leading zeros when hashing to derive child', function () {
var key = 'xprv9s21ZrQH143K3ckY9DgU79uMTJkQRLdbCCVDh81SnxTgPzLLGax6uHeBULTtaEtcAvKjXfT7ZWtHzKjTpujMkUd9dDb8msDeAfnJxrgAYhr'
var hdkey = HDKey.fromExtendedKey(key)
assert.equal(hdkey.privateKey.toString('hex'), '00000055378cf5fafb56c711c674143f9b0ee82ab0ba2924f19b64f5ae7cdbfd')
var derived = hdkey.derive("m/44'/0'/0'/0/0'")
assert.equal(derived.privateKey.toString('hex'), '3348069561d2a0fb925e74bf198762acc47dce7db27372257d2d959a9e6f8aeb')
})
})
describe('> when private key is null', function () {
it('privateExtendedKey should return null and not throw', function () {
var seed = '000102030405060708090a0b0c0d0e0f'

Loading…
Cancel
Save