diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-10-22 03:11:54 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-10-22 03:11:54 +0800 |
commit | 44aa1be2778a1647c9a607fd02c61bf93704d92d (patch) | |
tree | a99d27dbcac5209950ffde79c53519fde2eaa621 /app/scripts/lib | |
parent | c3e1c5c57f2062155626647e239c2a760f3e4b8a (diff) | |
download | tangerine-wallet-browser-44aa1be2778a1647c9a607fd02c61bf93704d92d.tar tangerine-wallet-browser-44aa1be2778a1647c9a607fd02c61bf93704d92d.tar.gz tangerine-wallet-browser-44aa1be2778a1647c9a607fd02c61bf93704d92d.tar.bz2 tangerine-wallet-browser-44aa1be2778a1647c9a607fd02c61bf93704d92d.tar.lz tangerine-wallet-browser-44aa1be2778a1647c9a607fd02c61bf93704d92d.tar.xz tangerine-wallet-browser-44aa1be2778a1647c9a607fd02c61bf93704d92d.tar.zst tangerine-wallet-browser-44aa1be2778a1647c9a607fd02c61bf93704d92d.zip |
Create basic keyring-controller unit test file
Diffstat (limited to 'app/scripts/lib')
-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 +} |