ref mnemonic
This commit is contained in:
parent
0433dc05cb
commit
e5860141a3
|
@ -108,7 +108,7 @@ Wallet.prototype.addCopayer = function(copayer) {
|
||||||
this._updatePublicKeyRing();
|
this._updatePublicKeyRing();
|
||||||
};
|
};
|
||||||
|
|
||||||
Wallet.prototype.addCopayerRequestKey = function(copayerId, requestPubKey, signature, restrictions) {
|
Wallet.prototype.addCopayerRequestKey = function(copayerId, requestPubKey, signature, restrictions, name) {
|
||||||
$.checkState(this.copayers.length == this.n);
|
$.checkState(this.copayers.length == this.n);
|
||||||
|
|
||||||
var c = this.getCopayer(copayerId);
|
var c = this.getCopayer(copayerId);
|
||||||
|
@ -118,7 +118,8 @@ Wallet.prototype.addCopayerRequestKey = function(copayerId, requestPubKey, signa
|
||||||
key: requestPubKey.toString(),
|
key: requestPubKey.toString(),
|
||||||
signature: signature,
|
signature: signature,
|
||||||
selfSigned: true,
|
selfSigned: true,
|
||||||
restrictions: restrictions,
|
restrictions: restrictions || {},
|
||||||
|
name: name || null,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -391,7 +391,7 @@ WalletService.prototype._addCopayerToWallet = function(wallet, opts, cb) {
|
||||||
|
|
||||||
WalletService.prototype._addKeyToCopayer = function(wallet, copayer, opts, cb) {
|
WalletService.prototype._addKeyToCopayer = function(wallet, copayer, opts, cb) {
|
||||||
var self = this;
|
var self = this;
|
||||||
wallet.addCopayerRequestKey(copayer.copayerId, opts.requestPubKey, opts.signature, opts.restrictions);
|
wallet.addCopayerRequestKey(copayer.copayerId, opts.requestPubKey, opts.signature, opts.restrictions, opts.name);
|
||||||
self.storage.storeWalletAndUpdateCopayersLookup(wallet, function(err) {
|
self.storage.storeWalletAndUpdateCopayersLookup(wallet, function(err) {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
|
|
||||||
|
@ -412,6 +412,7 @@ WalletService.prototype._addKeyToCopayer = function(wallet, copayer, opts, cb) {
|
||||||
* @param {string} opts.restrictions
|
* @param {string} opts.restrictions
|
||||||
* - cannotProposeTXs
|
* - cannotProposeTXs
|
||||||
* - cannotXXX TODO
|
* - cannotXXX TODO
|
||||||
|
* @param {string} opts.name (name for the new access)
|
||||||
*/
|
*/
|
||||||
WalletService.prototype.addAccess = function(opts, cb) {
|
WalletService.prototype.addAccess = function(opts, cb) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
@ -429,7 +430,8 @@ WalletService.prototype.addAccess = function(opts, cb) {
|
||||||
var xPubKey = _.find(wallet.copayers, {
|
var xPubKey = _.find(wallet.copayers, {
|
||||||
id: opts.copayerId
|
id: opts.copayerId
|
||||||
}).xPubKey;
|
}).xPubKey;
|
||||||
if (!WalletUtils.checkRequestPubKey(opts.requestPubKey, opts.signature, xPubKey)) {
|
|
||||||
|
if (!WalletUtils.verifyRequestPubKey(opts.requestPubKey, opts.signature, xPubKey)) {
|
||||||
return cb(Errors.NOT_AUTHORIZED);
|
return cb(Errors.NOT_AUTHORIZED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue