fixed delete wallet

This commit is contained in:
Ivan Socolsky 2014-10-27 10:49:25 -03:00
commit 0656c8d7e0
3 changed files with 25 additions and 12 deletions

View file

@ -9,13 +9,15 @@ inherits(EncryptedInsightStorage, InsightStorage);
EncryptedInsightStorage.prototype.getItem = function(name, callback) {
var key = cryptoUtil.kdf(this.password, this.email);
InsightStorage.prototype.getItem.apply(this, [name, function(err, body) {
var decryptedJson = cryptoUtil.decrypt(key, body);
if (!decryptedJson) {
return callback('Internal Error');
InsightStorage.prototype.getItem.apply(this, [name,
function(err, body) {
var decryptedJson = cryptoUtil.decrypt(key, body);
if (!decryptedJson) {
return callback('Internal Error');
}
return callback(null, decryptedJson);
}
return callback(null, decryptedJson);
}]);
]);
};
EncryptedInsightStorage.prototype.setItem = function(name, value, callback) {
@ -24,4 +26,9 @@ EncryptedInsightStorage.prototype.setItem = function(name, value, callback) {
InsightStorage.prototype.setItem.apply(this, [name, record, callback]);
};
EncryptedInsightStorage.prototype.removeItem = function(name, callback) {
var key = cryptoUtil.kdf(this.password, this.email);
InsightStorage.prototype.removeItem.apply(this, [name, callback]);
};
module.exports = EncryptedInsightStorage;