aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/encryptor.js
diff options
context:
space:
mode:
authorKevin Serrano <kevgagser@gmail.com>2016-11-12 02:26:12 +0800
committerKevin Serrano <kevgagser@gmail.com>2016-11-12 02:26:12 +0800
commit23263bec7d5100accd61f7648fd9355fc95e2bb7 (patch)
tree3c24f23655b5e1aad7102b603412d6fae70d5e43 /app/scripts/lib/encryptor.js
parentc664b8f11e32eaa7f8f1b46d4be938f2ebb74d35 (diff)
downloadtangerine-wallet-browser-23263bec7d5100accd61f7648fd9355fc95e2bb7.tar.gz
tangerine-wallet-browser-23263bec7d5100accd61f7648fd9355fc95e2bb7.tar.zst
tangerine-wallet-browser-23263bec7d5100accd61f7648fd9355fc95e2bb7.zip
Linting to the max.
Diffstat (limited to 'app/scripts/lib/encryptor.js')
-rw-r--r--app/scripts/lib/encryptor.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/app/scripts/lib/encryptor.js b/app/scripts/lib/encryptor.js
index fe83b86dd..acfb418a1 100644
--- a/app/scripts/lib/encryptor.js
+++ b/app/scripts/lib/encryptor.js
@@ -42,7 +42,7 @@ function encryptWithKey (key, dataObj) {
return global.crypto.subtle.encrypt({
name: 'AES-GCM',
iv: vector,
- }, key, dataBuffer).then(function(buf){
+ }, key, dataBuffer).then(function (buf) {
var buffer = new Uint8Array(buf)
var vectorStr = encodeBufferToBase64(vector)
var vaultStr = encodeBufferToBase64(buffer)
@@ -63,13 +63,13 @@ function decryptWithKey (key, text) {
const encryptedData = decodeBase64ToBuffer(parts[0])
const vector = decodeBase64ToBuffer(parts[1])
return crypto.subtle.decrypt({name: 'AES-GCM', iv: vector}, key, encryptedData)
- .then(function(result){
+ .then(function (result) {
const decryptedData = new Uint8Array(result)
const decryptedStr = convertArrayBufferViewtoString(decryptedData)
const decryptedObj = JSON.parse(decryptedStr)
return decryptedObj
})
- .catch(function(reason) {
+ .catch(function (reason) {
throw new Error('Incorrect password')
})
}
@@ -95,7 +95,7 @@ function convertArrayBufferViewtoString (buffer) {
function keyFromPassword (password) {
var passBuffer = convertStringToArrayBufferView(password)
return global.crypto.subtle.digest('SHA-256', passBuffer)
- .then(function (passHash){
+ .then(function (passHash) {
return global.crypto.subtle.importKey('raw', passHash, {name: 'AES-GCM'}, false, ['encrypt', 'decrypt'])
})
}
@@ -135,7 +135,7 @@ function encodeBufferToBase64 (buf) {
function decodeBase64ToBuffer (base64) {
var buf = new Uint8Array(atob(base64).split('')
- .map(function(c) {
+ .map(function (c) {
return c.charCodeAt(0)
}))
return buf