Fixing encrypted

This commit is contained in:
Esteban Ordano 2014-10-28 12:01:09 -03:00
commit 126a57d5ab
5 changed files with 7 additions and 13 deletions

View file

@ -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]);
};

View file

@ -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({