diff --git a/js/models/storage/Encrypted.js b/js/models/storage/Encrypted.js index d28b1bcd0..35b6bcb4a 100644 --- a/js/models/storage/Encrypted.js +++ b/js/models/storage/Encrypted.js @@ -4,18 +4,20 @@ var imports = require('soop').imports(); //var buffertools = imports.buffertools || require('buffertools'); var parent = imports.parent || require('./Plain'); +var id = 0; function Storage() { + this.__uniqueid = ++id; } Storage.parent = parent; -var passphrase = null; +var pps = {}; Storage.prototype._getPassphrase = function() { - return passphrase; + return pps[this.__uniqueid]; } Storage.prototype._setPassphrase = function(password) { - passphrase = password; + pps[this.__uniqueid] = password; } Storage.prototype._encrypt = function(data) { diff --git a/test/test.storage-encrypted.js b/test/test.storage-encrypted.js index 39cb86261..c751d6cac 100644 --- a/test/test.storage-encrypted.js +++ b/test/test.storage-encrypted.js @@ -16,7 +16,7 @@ if (typeof process === 'undefined' || !process.version) { var s = new Encrypted(); should.exist(s); }); - it.skip('should fail when encrypting without a password', function() { + it('should fail when encrypting without a password', function() { var s = new Encrypted(); (function(){s.set(wid, 'x', 1);}).should.throw(); });