mv Passphrase logic to Storage
This commit is contained in:
parent
70d306242e
commit
74129a6923
4 changed files with 20 additions and 8 deletions
|
|
@ -9,7 +9,7 @@ describe('Storage model', function() {
|
|||
var s;
|
||||
beforeEach(function(done) {
|
||||
s = new Storage(requireMock('FakeLocalStorage').storageParams);
|
||||
s.setPassphrase('mysupercoolpassword');
|
||||
s.setPassword('mysupercoolpassword');
|
||||
s.clearAll(done);
|
||||
});
|
||||
|
||||
|
|
@ -415,13 +415,13 @@ describe('Storage model', function() {
|
|||
|
||||
describe('#decrypt', function() {
|
||||
it('should not be able to decrypt with wrong password', function() {
|
||||
s.setPassphrase('xxx');
|
||||
s.setPassword('xxx');
|
||||
var wo = s.decrypt(encryptedLegacy1);
|
||||
should.not.exist(wo);
|
||||
});
|
||||
|
||||
it('should be able to decrypt an old backup', function() {
|
||||
s.setPassphrase(legacyPassword1);
|
||||
s._setPassphrase(legacyPassword1);
|
||||
var wo = s.decrypt(encryptedLegacy1);
|
||||
should.exist(wo);
|
||||
wo.opts.id.should.equal('48ba2f1ffdfe9708');
|
||||
|
|
|
|||
|
|
@ -32,4 +32,5 @@ module.exports.storageParams = {
|
|||
password: '123',
|
||||
db: new FakeLocalStorage(),
|
||||
sessionStorage: new FakeLocalStorage(),
|
||||
iterations: 1,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue