|
|
@ -22,7 +22,6 @@ function HDKey(versions) { |
|
|
|
this.depth = 0 |
|
|
|
this.index = 0 |
|
|
|
this._privateKey = null |
|
|
|
this._privateKeyInteger = BigInteger.ZERO |
|
|
|
this._publicKey = null |
|
|
|
this.chainCode = null |
|
|
|
this._fingerprint = 0 |
|
|
@ -40,8 +39,7 @@ Object.defineProperty(HDKey.prototype, 'privateKey', { |
|
|
|
set: function(value) { |
|
|
|
assert.equal(value.length, 32, 'Private key must be 32 bytes.') |
|
|
|
this._privateKey = value |
|
|
|
this._privateKeyInteger = BigInteger.fromBuffer(this._privateKey) |
|
|
|
this._publicPoint = curve.G.multiply(this._privateKeyInteger) |
|
|
|
this._publicPoint = curve.G.multiply(BigInteger.fromBuffer(this._privateKey)) |
|
|
|
this._publicKey = this._publicPoint.getEncoded(true) //force compressed point
|
|
|
|
this._identifier = hash160(this.publicKey) |
|
|
|
this._fingerprint = this._identifier.slice(0, 4).readUInt32BE(0) |
|
|
@ -59,7 +57,6 @@ Object.defineProperty(HDKey.prototype, 'publicKey', { |
|
|
|
this._identifier = hash160(this.publicKey) |
|
|
|
this._fingerprint = this._identifier.slice(0, 4).readUInt32BE(0) |
|
|
|
this._privateKey = null |
|
|
|
this._privateKeyInteger = null |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|