diff options
author | Kevin Serrano <kevgagser@gmail.com> | 2016-10-24 07:21:11 +0800 |
---|---|---|
committer | Kevin Serrano <kevgagser@gmail.com> | 2016-10-24 07:21:11 +0800 |
commit | 16e2f029d8b76e6f1e951d35307d955c2346cd8d (patch) | |
tree | 645d3b227f6323e0339f68eb1d36529a6efc4761 /app/scripts/lib/encryptor.js | |
parent | b99b5484fec53629a25e9a3e2b4d43f1b1bc7e34 (diff) | |
parent | 152419a79bd26d9b6f5af43c2066eb1e6f619716 (diff) | |
download | tangerine-wallet-browser-16e2f029d8b76e6f1e951d35307d955c2346cd8d.tar tangerine-wallet-browser-16e2f029d8b76e6f1e951d35307d955c2346cd8d.tar.gz tangerine-wallet-browser-16e2f029d8b76e6f1e951d35307d955c2346cd8d.tar.bz2 tangerine-wallet-browser-16e2f029d8b76e6f1e951d35307d955c2346cd8d.tar.lz tangerine-wallet-browser-16e2f029d8b76e6f1e951d35307d955c2346cd8d.tar.xz tangerine-wallet-browser-16e2f029d8b76e6f1e951d35307d955c2346cd8d.tar.zst tangerine-wallet-browser-16e2f029d8b76e6f1e951d35307d955c2346cd8d.zip |
Merge branch 'i328-MultiVault' of github.com:MetaMask/metamask-plugin into i328-MultiVault
Diffstat (limited to 'app/scripts/lib/encryptor.js')
-rw-r--r-- | app/scripts/lib/encryptor.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/scripts/lib/encryptor.js b/app/scripts/lib/encryptor.js index 3d069ab33..832e6d528 100644 --- a/app/scripts/lib/encryptor.js +++ b/app/scripts/lib/encryptor.js @@ -22,6 +22,8 @@ module.exports = { // Buffer <-> base64 string methods encodeBufferToBase64, decodeBase64ToBuffer, + + generateSalt, } // Takes a Pojo, returns encrypted text. @@ -135,3 +137,10 @@ function decodeBase64ToBuffer (base64) { })) return buf } + +function generateSalt (byteCount = 32) { + var view = new Uint8Array(byteCount) + global.crypto.getRandomValues(view) + var b64encoded = btoa(String.fromCharCode.apply(null, view)) + return b64encoded +} |