|
|
@ -113,7 +113,7 @@ API.prototype._tryToCompleteFromServer = function(data, cb) { |
|
|
|
|
|
|
|
API.prototype._tryToComplete = function(opts, data, cb) { |
|
|
|
if (opts.pkr) { |
|
|
|
var pkr = _decryptMessage(opts.pkr, data.sharedEncryptingKey); |
|
|
|
var pkr = _decryptMessage(opts.pkr,WalletUtils.privateKeyToAESKey(data.roPrivKey)); |
|
|
|
|
|
|
|
if (!pkr) |
|
|
|
return cb('Could not complete wallet'); |
|
|
@ -219,7 +219,7 @@ API.prototype._initData = function(network, walletPrivKey, m, n) { |
|
|
|
var xPubKey = (new Bitcore.HDPublicKey(xPrivKey)).toString(); |
|
|
|
var roPrivKey = xPrivKey.derive('m/1/0').privateKey; |
|
|
|
var rwPrivKey = xPrivKey.derive('m/1/1').privateKey; |
|
|
|
var sharedEncryptingKey = Bitcore.crypto.Hash.sha256(walletPrivKey.toBuffer()).slice(0, 16).toString('base64'); |
|
|
|
var sharedEncryptingKey = WalletUtils.privateKeyToAESKey(walletPrivKey); |
|
|
|
var copayerId = WalletUtils.xPubToCopayerId(xPubKey); |
|
|
|
|
|
|
|
var data = { |
|
|
@ -650,9 +650,8 @@ API.prototype.getEncryptedPublicKeyRing = function(cb) { |
|
|
|
|
|
|
|
this._loadAndCheck({}, function(err, data) { |
|
|
|
if (err) return cb(err); |
|
|
|
|
|
|
|
var pkr = JSON.stringify(data.publicKeyRing); |
|
|
|
return cb(null, _encryptMessage(pkr, data.sharedEncryptingKey)); |
|
|
|
return cb(null, _encryptMessage(pkr, WalletUtils.privateKeyToAESKey(data.roPrivKey))); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|