diff --git a/js/plugins/EncryptedInsightStorage.js b/js/plugins/EncryptedInsightStorage.js index 706d699de..ff994be5c 100644 --- a/js/plugins/EncryptedInsightStorage.js +++ b/js/plugins/EncryptedInsightStorage.js @@ -9,11 +9,6 @@ function EncryptedInsightStorage(config) { } inherits(EncryptedInsightStorage, InsightStorage); - -EncryptedInsightStorage.prototype._brokenDecryptUndef = function(body) { - cryptoUtil.decrypt('undefined' + SEPARATOR + 'undefined', body); -}; - EncryptedInsightStorage.prototype._brokenDecrypt = function(body) { var key = cryptoUtil.kdf(this.password + this.email, 'mjuBtGybi/4=', 100); log.debug('Trying legacy decrypt') @@ -35,10 +30,6 @@ EncryptedInsightStorage.prototype.getItem = function(name, callback) { decryptedJson = self._brokenDecrypt(body); } - if (!decryptedJson) { - decryptedJson = self._brokenDecryptUndef(body); - } - if (!decryptedJson) { log.debug('Could not decrypt value.'); return callback('PNOTFOUND'); diff --git a/js/plugins/EncryptedLocalStorage.js b/js/plugins/EncryptedLocalStorage.js index d75e9d5e7..2287957c5 100644 --- a/js/plugins/EncryptedLocalStorage.js +++ b/js/plugins/EncryptedLocalStorage.js @@ -19,17 +19,30 @@ EncryptedLocalStorage.prototype._brokenDecrypt = function(body) { }; + +EncryptedLocalStorage.prototype._brokenDecryptUndef = function(body) { + var badkey = undefined + SEPARATOR + undefined; +console.log('[EncryptedLocalStorage.js.25:badkey:]',badkey); //TODO + return cryptoUtil.decrypt(badkey, body); +}; + + + + EncryptedLocalStorage.prototype.getItem = function(name, callback) { var self = this; LocalStorage.prototype.getItem.apply(this, [name, function(err, body) { var decryptedJson = cryptoUtil.decrypt(self.email + SEPARATOR + self.password, body); - if (!decryptedJson) { log.debug('Could not decrypt value using current decryption schema'); decryptedJson = self._brokenDecrypt(body); } + if (!decryptedJson) { + decryptedJson = self._brokenDecryptUndef(body); + } + if (!decryptedJson) { log.debug('Could not decrypt value.'); return callback('PNOTFOUND');