Merge pull request #46 from matiaspando/feature/removeCryptoAES

fixes notification for invalid credentials
This commit is contained in:
Matias Alejo Garcia 2014-10-28 18:23:17 -03:00
commit eaf14ddb49
6 changed files with 24 additions and 18 deletions

View file

@ -16,7 +16,7 @@ EncryptedInsightStorage.prototype.getItem = function(name, callback) {
}
var decryptedJson = cryptoUtil.decrypt(key, body);
if (!decryptedJson) {
return callback('Internal Error');
return callback('PNOTFOUND');
}
return callback(null, decryptedJson);
}

View file

@ -9,13 +9,15 @@ inherits(EncryptedLocalStorage, LocalStorage);
EncryptedLocalStorage.prototype.getItem = function(name, callback) {
var key = cryptoUtil.kdf(this.password + this.email);
LocalStorage.prototype.getItem.apply(this, [name, function(err, body) {
var decryptedJson = cryptoUtil.decrypt(key, body);
if (!decryptedJson) {
return callback('Internal Error');
LocalStorage.prototype.getItem.apply(this, [name,
function(err, body) {
var decryptedJson = cryptoUtil.decrypt(key, body);
if (!decryptedJson) {
return callback('PNOTFOUND');
}
return callback(null, decryptedJson);
}
return callback(null, decryptedJson);
}]);
]);
};
EncryptedLocalStorage.prototype.setItem = function(name, value, callback) {