|
|
@ -84,9 +84,9 @@ WalletUtils.fromSecret = function(secret) { |
|
|
|
WalletUtils.encryptMessage = function(message, privKey) { |
|
|
|
var hash = sjcl.hash.sha256.hash(privKey); |
|
|
|
var key = sjcl.codec.utf8String.toBits(hash); |
|
|
|
key = sjcl.bitArray.clamp(key, 256); |
|
|
|
key = sjcl.bitArray.clamp(key, 128); |
|
|
|
return sjcl.encrypt(key, message, { |
|
|
|
ks: 256, |
|
|
|
ks: 128, |
|
|
|
iter: 1 |
|
|
|
}); |
|
|
|
}; |
|
|
@ -94,7 +94,7 @@ WalletUtils.encryptMessage = function(message, privKey) { |
|
|
|
WalletUtils.decryptMessage = function(cyphertextJson, privKey) { |
|
|
|
var hash = sjcl.hash.sha256.hash(privKey); |
|
|
|
var key = sjcl.codec.utf8String.toBits(hash); |
|
|
|
key = sjcl.bitArray.clamp(key, 256); |
|
|
|
key = sjcl.bitArray.clamp(key, 128); |
|
|
|
return sjcl.decrypt(key, cyphertextJson); |
|
|
|
}; |
|
|
|
|
|
|
|