|
|
@ -365,6 +365,15 @@ HDPrivateKey.fromSeed = function(hexa, network) { |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HDPrivateKey.prototype._calcHDPublicKey = function() { |
|
|
|
if (!this._hdPublicKey) { |
|
|
|
var HDPublicKey = require('./hdpublickey'); |
|
|
|
this._hdPublicKey = new HDPublicKey(this); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
/** |
|
|
|
* Receives a object with buffers in all the properties and populates the |
|
|
|
* internal structure |
|
|
@ -423,14 +432,24 @@ HDPrivateKey.prototype._buildFromBuffers = function(arg) { |
|
|
|
fingerPrint: fingerPrint |
|
|
|
}); |
|
|
|
|
|
|
|
var HDPublicKey = require('./hdpublickey'); |
|
|
|
var hdPublicKey = new HDPublicKey(this); |
|
|
|
this._hdPublicKey = null; |
|
|
|
|
|
|
|
JSUtil.defineImmutable(this, { |
|
|
|
hdPublicKey: hdPublicKey, |
|
|
|
xpubkey: hdPublicKey.xpubkey |
|
|
|
Object.defineProperty(this, 'hdPublicKey', { |
|
|
|
configurable: false, |
|
|
|
enumerable: true, |
|
|
|
get: function() { |
|
|
|
this._calcHDPublicKey(); |
|
|
|
return this._hdPublicKey; |
|
|
|
} |
|
|
|
}); |
|
|
|
Object.defineProperty(this, 'xpubkey', { |
|
|
|
configurable: false, |
|
|
|
enumerable: true, |
|
|
|
get: function() { |
|
|
|
this._calcHDPublicKey(); |
|
|
|
return this._hdPublicKey.xpubkey; |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
return this; |
|
|
|
}; |
|
|
|
|
|
|
|