PublicKeyRing handles one index for each cosigner
This commit is contained in:
parent
b02cb17989
commit
04b6aa4003
7 changed files with 140 additions and 90 deletions
|
|
@ -16,6 +16,7 @@ function PrivateKey(opts) {
|
|||
var init = opts.extendedPrivateKeyString || this.network.name;
|
||||
this.bip = opts.HK || new HK(init);
|
||||
this.privateKeyCache = opts.privateKeyCache || {};
|
||||
this.publicHex = this.deriveBIP45Branch().eckey.public.toString('hex');
|
||||
};
|
||||
|
||||
PrivateKey.prototype.getId = function() {
|
||||
|
|
@ -101,21 +102,21 @@ PrivateKey.prototype.getForPath = function(path) {
|
|||
return wk;
|
||||
};
|
||||
|
||||
PrivateKey.prototype.get = function(index, isChange) {
|
||||
var path = Structure.FullBranch(index, isChange);
|
||||
PrivateKey.prototype.get = function(index, isChange, cosigner) {
|
||||
var path = Structure.FullBranch(index, isChange, cosigner);
|
||||
return this.getForPath(path);
|
||||
};
|
||||
|
||||
PrivateKey.prototype.getAll = function(receiveIndex, changeIndex) {
|
||||
PrivateKey.prototype.getAll = function(receiveIndex, changeIndex, cosigner) {
|
||||
if (typeof receiveIndex === 'undefined' || typeof changeIndex === 'undefined')
|
||||
throw new Error('Invalid parameters');
|
||||
|
||||
var ret = [];
|
||||
for (var i = 0; i < receiveIndex; i++) {
|
||||
ret.push(this.get(i, false));
|
||||
ret.push(this.get(i, false, cosigner));
|
||||
}
|
||||
for (var i = 0; i < changeIndex; i++) {
|
||||
ret.push(this.get(i, true));
|
||||
ret.push(this.get(i, true, cosigner));
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue