|
|
@ -61,7 +61,8 @@ WalletUtils.getProposalHash = function(toAddress, amount, message) { |
|
|
|
}; |
|
|
|
|
|
|
|
WalletUtils.xPubToCopayerId = function(xpub) { |
|
|
|
return (new Bitcore.HDPublicKey(xpub)).derive(HDPath.IdBranch).publicKey.toString(); |
|
|
|
//return (new Bitcore.HDPublicKey(xpub)).derive(HDPath.IdBranch).publicKey.toString();
|
|
|
|
return crypto.Hash.sha256(new Buffer(xpub)).toString('hex'); |
|
|
|
}; |
|
|
|
|
|
|
|
WalletUtils.toSecret = function(walletId, walletPrivKey, network) { |
|
|
@ -85,7 +86,6 @@ WalletUtils.fromSecret = function(secret) { |
|
|
|
|
|
|
|
WalletUtils.encryptMessage = function(message, encryptingKey) { |
|
|
|
var key = sjcl.codec.base64.toBits(encryptingKey); |
|
|
|
//key = sjcl.bitArray.clamp(key, 128);
|
|
|
|
return sjcl.encrypt(key, message, { |
|
|
|
ks: 128, |
|
|
|
iter: 1 |
|
|
@ -94,7 +94,6 @@ WalletUtils.encryptMessage = function(message, encryptingKey) { |
|
|
|
|
|
|
|
WalletUtils.decryptMessage = function(cyphertextJson, encryptingKey) { |
|
|
|
var key = sjcl.codec.base64.toBits(encryptingKey); |
|
|
|
//key = sjcl.bitArray.clamp(key, 128);
|
|
|
|
return sjcl.decrypt(key, cyphertextJson); |
|
|
|
}; |
|
|
|
|
|
|
|