From 126a57d5ab8d862f81f2db85d2c944fb278beb81 Mon Sep 17 00:00:00 2001 From: Esteban Ordano Date: Tue, 28 Oct 2014 12:01:09 -0300 Subject: [PATCH] Fixing encrypted --- js/controllers/import.js | 2 +- js/plugins/EncryptedInsightStorage.js | 6 +++--- js/plugins/InsightStorage.js | 4 ++-- js/services/backupService.js | 3 +-- js/services/cryptoUtils.js | 5 ----- 5 files changed, 7 insertions(+), 13 deletions(-) delete mode 100644 js/services/cryptoUtils.js diff --git a/js/controllers/import.js b/js/controllers/import.js index ee4606672..89a71eb57 100644 --- a/js/controllers/import.js +++ b/js/controllers/import.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('ImportController', - function($scope, $rootScope, $location, controllerUtils, notification, isMobile, Compatibility, cryptoUtils) { + function($scope, $rootScope, $location, controllerUtils, notification, isMobile, Compatibility) { $rootScope.title = 'Import a backup'; $scope.importStatus = 'Importing wallet - Reading backup...'; diff --git a/js/plugins/EncryptedInsightStorage.js b/js/plugins/EncryptedInsightStorage.js index c84e03733..d0f381fa0 100644 --- a/js/plugins/EncryptedInsightStorage.js +++ b/js/plugins/EncryptedInsightStorage.js @@ -8,7 +8,7 @@ function EncryptedInsightStorage(config) { inherits(EncryptedInsightStorage, InsightStorage); EncryptedInsightStorage.prototype.getItem = function(name, callback) { - var key = cryptoUtil.kdf(this.password + this.email); + var key = cryptoUtil.kdfbinary(this.password + this.email); InsightStorage.prototype.getItem.apply(this, [name, function(err, body) { var decryptedJson = cryptoUtil.decrypt(key, body); @@ -21,13 +21,13 @@ EncryptedInsightStorage.prototype.getItem = function(name, callback) { }; EncryptedInsightStorage.prototype.setItem = function(name, value, callback) { - var key = cryptoUtil.kdf(this.password + this.email); + var key = cryptoUtil.kdfbinary(this.password + this.email); var record = cryptoUtil.encrypt(key, value); InsightStorage.prototype.setItem.apply(this, [name, record, callback]); }; EncryptedInsightStorage.prototype.removeItem = function(name, callback) { - var key = cryptoUtil.kdf(this.password + this.email); + var key = cryptoUtil.kdfbinary(this.password + this.email); InsightStorage.prototype.removeItem.apply(this, [name, callback]); }; diff --git a/js/plugins/InsightStorage.js b/js/plugins/InsightStorage.js index a4d13152a..ec47a9c5f 100644 --- a/js/plugins/InsightStorage.js +++ b/js/plugins/InsightStorage.js @@ -17,7 +17,7 @@ InsightStorage.prototype.setCredentials = function(email, password, opts) { }; InsightStorage.prototype.getItem = function(name, callback) { - var key = cryptoUtil.kdf(this.password, this.email); + var key = cryptoUtil.kdf(this.password + this.email); var secret = cryptoUtil.kdf(key, this.password); var encodedEmail = encodeURIComponent(this.email); var retrieveUrl = this.storeUrl + '/retrieve/' + encodedEmail; @@ -35,7 +35,7 @@ InsightStorage.prototype.getItem = function(name, callback) { }; InsightStorage.prototype.setItem = function(name, value, callback) { - var key = cryptoUtil.kdf(this.password, this.email); + var key = cryptoUtil.kdf(this.password + this.email); var secret = cryptoUtil.kdf(key, this.password); var registerUrl = this.storeUrl + '/register'; this.request.post({ diff --git a/js/services/backupService.js b/js/services/backupService.js index 1880e87f2..d903a0bf9 100644 --- a/js/services/backupService.js +++ b/js/services/backupService.js @@ -1,9 +1,8 @@ 'use strict'; -var BackupService = function($rootScope, notification, cryptoUtils) { +var BackupService = function($rootScope, notification) { this.$rootScope = $rootScope; this.notifications = notification; - this.cryptoUtils = cryptoUtils; }; BackupService.prototype.getCopayer = function(wallet) { diff --git a/js/services/cryptoUtils.js b/js/services/cryptoUtils.js deleted file mode 100644 index fe243d2fa..000000000 --- a/js/services/cryptoUtils.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -angular.module('copayApp.services').factory('cryptoUtils', function() { - return require('../util/crypto'); -});