fix walletlock tests
This commit is contained in:
parent
8bc1eb15e4
commit
1ab7a4f8e8
7 changed files with 122 additions and 176 deletions
|
|
@ -118,6 +118,10 @@ Storage.prototype.getSessionId = function(cb) {
|
|||
});
|
||||
};
|
||||
|
||||
Storage.prototype.setSessionId = function(sessionId, cb) {
|
||||
this.sessionStorage.setItem('sessionId', sessionId, cb);
|
||||
};
|
||||
|
||||
Storage.prototype._key = function(walletId, k) {
|
||||
return walletId + '::' + k;
|
||||
};
|
||||
|
|
@ -285,7 +289,10 @@ Storage.prototype.setFromObj = function(walletId, obj, cb) {
|
|||
for (var k in obj) {
|
||||
self.set(walletId, k, obj[k], function() {
|
||||
if (++i == l) {
|
||||
self.setName(walletId, obj.opts.name, cb);
|
||||
if (obj.opts.name)
|
||||
self.setName(walletId, obj.opts.name, cb);
|
||||
else
|
||||
return cb();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,11 +54,13 @@ WalletLock.prototype._isLockedByOther = function(cb) {
|
|||
WalletLock.prototype._setLock = function(cb) {
|
||||
preconditions.checkArgument(cb);
|
||||
preconditions.checkState(this.sessionId);
|
||||
var self = this;
|
||||
|
||||
this.storage.setGlobal(this.key, {
|
||||
sessionId: this.sessionId,
|
||||
expireTs: Date.now() + this.timeoutMin * 60 * 1000,
|
||||
}, function() {
|
||||
|
||||
cb(null);
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,27 +1,33 @@
|
|||
//localstorage Mock
|
||||
ls = {};
|
||||
function LocalStorage(opts) {
|
||||
}
|
||||
|
||||
FakeLocalStorage = {};
|
||||
FakeLocalStorage.length = 0;
|
||||
FakeLocalStorage.removeItem = function(key,cb) {
|
||||
delete ls[key];
|
||||
function FakeLocalStorage() {
|
||||
this.ls = {};
|
||||
};
|
||||
FakeLocalStorage.prototype.removeItem = function(key, cb) {
|
||||
delete this.ls[key];
|
||||
cb();
|
||||
};
|
||||
|
||||
FakeLocalStorage.getItem = function(k,cb) {
|
||||
return cb(ls[k]);
|
||||
FakeLocalStorage.prototype.getItem = function(k, cb) {
|
||||
return cb(this.ls[k]);
|
||||
};
|
||||
|
||||
|
||||
FakeLocalStorage.allKeys = function(cb) {
|
||||
return cb(Object.keys(ls));
|
||||
FakeLocalStorage.prototype.allKeys = function(cb) {
|
||||
return cb(Object.keys(this.ls));
|
||||
};
|
||||
|
||||
FakeLocalStorage.setItem = function(k, v,cb) {
|
||||
ls[k] = v;
|
||||
FakeLocalStorage.prototype.setItem = function(k, v, cb) {
|
||||
this.ls[k] = v;
|
||||
return cb();
|
||||
};
|
||||
FakeLocalStorage.prototype.clear = function() {
|
||||
this.ls = {};
|
||||
}
|
||||
|
||||
module.exports = FakeLocalStorage;
|
||||
|
||||
module.exports.storageParams = {
|
||||
storage: new FakeLocalStorage(),
|
||||
sessionStorage: new FakeLocalStorage(),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -33,10 +33,7 @@ var walletConfig = {
|
|||
spendUnconfirmed: true,
|
||||
reconnectDelay: 100,
|
||||
networkName: 'testnet',
|
||||
storage: {
|
||||
storage: localMock,
|
||||
sessionStorage: sessionMock,
|
||||
}
|
||||
storage: require('./mocks/FakeLocalStorage').storageParams,
|
||||
};
|
||||
|
||||
var getNewEpk = function() {
|
||||
|
|
@ -48,6 +45,7 @@ var getNewEpk = function() {
|
|||
};
|
||||
|
||||
describe('PayPro (in Wallet) model', function() {
|
||||
|
||||
if (!is_browser) {
|
||||
var createW = function(N, conf) {
|
||||
var c = JSON.parse(JSON.stringify(conf || walletConfig));
|
||||
|
|
@ -71,6 +69,7 @@ describe('PayPro (in Wallet) model', function() {
|
|||
});
|
||||
|
||||
var storage = new Storage(walletConfig.storage);
|
||||
storage.setPassphrase('xxx');
|
||||
var network = new Network(walletConfig.network);
|
||||
var blockchain = new Blockchain(walletConfig.blockchain);
|
||||
c.storage = storage;
|
||||
|
|
|
|||
|
|
@ -7,99 +7,84 @@ var Storage = copay.Storage;
|
|||
|
||||
var fakeWallet = 'fake-wallet-id';
|
||||
var timeStamp = Date.now();
|
||||
var localMock = require('./mocks/FakeLocalStorage');
|
||||
var sessionMock = require('./mocks/FakeLocalStorage');
|
||||
|
||||
|
||||
describe('Storage model', function() {
|
||||
var s = new Storage({
|
||||
storage: localMock,
|
||||
sessionStorage: sessionMock,
|
||||
});
|
||||
s.setPassphrase('mysupercoolpassword');
|
||||
|
||||
it('should create an instance', function() {
|
||||
var s2 = new Storage({
|
||||
storage: localMock,
|
||||
sessionStorage: sessionMock,
|
||||
var s;
|
||||
beforeEach(function() {
|
||||
s = new Storage(require('./mocks/FakeLocalStorage').storageParams);
|
||||
s.setPassphrase('mysupercoolpassword');
|
||||
s.storage.clear();
|
||||
s.sessionStorage.clear();
|
||||
});
|
||||
should.exist(s2);
|
||||
});
|
||||
it('should fail when encrypting without a password', function() {
|
||||
var s2 = new Storage({
|
||||
storage: localMock,
|
||||
sessionStorage: sessionMock,
|
||||
|
||||
|
||||
it('should create an instance', function() {
|
||||
var s2 = new Storage(require('./mocks/FakeLocalStorage').storageParams);
|
||||
should.exist(s2);
|
||||
});
|
||||
(function() {
|
||||
s2.set(fakeWallet, timeStamp, 1, function() {});
|
||||
}).should.throw('NOPASSPHRASE');
|
||||
});
|
||||
it('should be able to encrypt and decrypt', function(done) {
|
||||
s._write(fakeWallet + timeStamp, 'value', function() {
|
||||
s._read(fakeWallet + timeStamp, function(v) {
|
||||
v.should.equal('value');
|
||||
localMock.removeItem(fakeWallet + timeStamp, done);
|
||||
});
|
||||
it('should fail when encrypting without a password', function() {
|
||||
var s2 = new Storage(require('./mocks/FakeLocalStorage').storageParams);
|
||||
(function() {
|
||||
s2.set(fakeWallet, timeStamp, 1, function() {});
|
||||
}).should.throw('NOPASSPHRASE');
|
||||
});
|
||||
});
|
||||
it('should be able to set a value', function(done) {
|
||||
s.set(fakeWallet, timeStamp, 1, function() {
|
||||
localMock.removeItem(fakeWallet + '::' + timeStamp, done);
|
||||
});
|
||||
});
|
||||
var getSetData = [
|
||||
1, 1000, -15, -1000,
|
||||
0.1, -0.5, -0.5e-10, Math.PI,
|
||||
'hi', 'auydoaiusyodaisudyoa', '0b5b8556a0c2ce828c9ccfa58b3dd0a1ae879b9b',
|
||||
'1CjPR7Z5ZSyWk6WtXvSFgkptmpoi4UM9BC', 'OP_DUP OP_HASH160 80ad90d4035', [1, 2, 3, 4, 5, 6], {
|
||||
x: 1,
|
||||
y: 2
|
||||
}, {
|
||||
x: 'hi',
|
||||
y: null
|
||||
}, {
|
||||
a: {},
|
||||
b: [],
|
||||
c: [1, 2, 'hi']
|
||||
},
|
||||
null
|
||||
];
|
||||
getSetData.forEach(function(obj) {
|
||||
it('should be able to set a value and get it for ' + JSON.stringify(obj), function(done) {
|
||||
s.set(fakeWallet, timeStamp, obj, function() {
|
||||
s.get(fakeWallet, timeStamp, function(obj2) {
|
||||
JSON.stringify(obj2).should.equal(JSON.stringify(obj));
|
||||
localMock.removeItem(fakeWallet + '::' + timeStamp, done);
|
||||
it('should be able to encrypt and decrypt', function(done) {
|
||||
s._write(fakeWallet + timeStamp, 'value', function() {
|
||||
s._read(fakeWallet + timeStamp, function(v) {
|
||||
v.should.equal('value');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
it('should be able to set a value', function(done) {
|
||||
s.set(fakeWallet, timeStamp, 1, function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
var getSetData = [
|
||||
1, 1000, -15, -1000,
|
||||
0.1, -0.5, -0.5e-10, Math.PI,
|
||||
'hi', 'auydoaiusyodaisudyoa', '0b5b8556a0c2ce828c9ccfa58b3dd0a1ae879b9b',
|
||||
'1CjPR7Z5ZSyWk6WtXvSFgkptmpoi4UM9BC', 'OP_DUP OP_HASH160 80ad90d4035', [1, 2, 3, 4, 5, 6], {
|
||||
x: 1,
|
||||
y: 2
|
||||
}, {
|
||||
x: 'hi',
|
||||
y: null
|
||||
}, {
|
||||
a: {},
|
||||
b: [],
|
||||
c: [1, 2, 'hi']
|
||||
},
|
||||
null
|
||||
];
|
||||
getSetData.forEach(function(obj) {
|
||||
it('should be able to set a value and get it for ' + JSON.stringify(obj), function(done) {
|
||||
s.set(fakeWallet, timeStamp, obj, function() {
|
||||
s.get(fakeWallet, timeStamp, function(obj2) {
|
||||
JSON.stringify(obj2).should.equal(JSON.stringify(obj));
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('#export', function() {
|
||||
it('should export the encrypted wallet', function(done) {
|
||||
var storage = new Storage({
|
||||
storage: localMock,
|
||||
sessionStorage: sessionMock,
|
||||
password: 'password',
|
||||
});
|
||||
storage.set(fakeWallet, timeStamp, 'testval', function() {
|
||||
s.set(fakeWallet, timeStamp, 'testval', function() {
|
||||
var obj = {
|
||||
test: 'testval'
|
||||
};
|
||||
var encrypted = storage.export(obj);
|
||||
var encrypted = s.export(obj);
|
||||
encrypted.length.should.be.greaterThan(10);
|
||||
localMock.removeItem(fakeWallet + '::' + timeStamp, done);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('#remove', function() {
|
||||
it('should remove an item', function(done) {
|
||||
var s = new Storage({
|
||||
storage: localMock,
|
||||
sessionStorage: sessionMock,
|
||||
password: 'password'
|
||||
});
|
||||
s.set('1', "hola", 'juan', function() {
|
||||
s.get('1', 'hola', function(v) {
|
||||
v.should.equal('juan');
|
||||
|
|
@ -117,11 +102,6 @@ describe('Storage model', function() {
|
|||
|
||||
describe('#getWalletIds', function() {
|
||||
it('should get wallet ids', function(done) {
|
||||
var s = new Storage({
|
||||
storage: localMock,
|
||||
sessionStorage: sessionMock,
|
||||
password: 'password'
|
||||
});
|
||||
s.set('1', "hola", 'juan', function() {
|
||||
s.set('2', "hola", 'juan', function() {
|
||||
s.getWalletIds(function(v) {
|
||||
|
|
@ -135,11 +115,6 @@ describe('Storage model', function() {
|
|||
|
||||
describe('#getName #setName', function() {
|
||||
it('should get/set names', function(done) {
|
||||
var s = new Storage({
|
||||
storage: localMock,
|
||||
sessionStorage: sessionMock,
|
||||
password: 'password'
|
||||
});
|
||||
s.setName(1, 'hola', function() {
|
||||
s.getName(1, function(v) {
|
||||
v.should.equal('hola');
|
||||
|
|
@ -151,11 +126,6 @@ describe('Storage model', function() {
|
|||
|
||||
describe('#getLastOpened #setLastOpened', function() {
|
||||
it('should get/set last opened', function() {
|
||||
var s = new Storage({
|
||||
storage: localMock,
|
||||
sessionStorage: sessionMock,
|
||||
password: 'password'
|
||||
});
|
||||
s.setLastOpened('hey', function() {
|
||||
s.getLastOpened(function(v) {
|
||||
v.should.equal('hey');
|
||||
|
|
@ -167,11 +137,6 @@ describe('Storage model', function() {
|
|||
if (is_browser) {
|
||||
describe('#getSessionId', function() {
|
||||
it('should get SessionId', function(done) {
|
||||
var s = new Storage({
|
||||
storage: localMock,
|
||||
sessionStorage: sessionMock,
|
||||
password: 'password'
|
||||
});
|
||||
s.getSessionId(function(sid) {
|
||||
should.exist(sid);
|
||||
s.getSessionId(function(sid2) {
|
||||
|
|
@ -185,11 +150,6 @@ describe('Storage model', function() {
|
|||
|
||||
describe('#getWallets', function() {
|
||||
it('should retreive wallets from storage', function(done) {
|
||||
var s = new Storage({
|
||||
storage: localMock,
|
||||
sessionStorage: sessionMock,
|
||||
password: 'password'
|
||||
});
|
||||
s.set('1', "hola", 'juan', function() {
|
||||
s.set('2', "hola", 'juan', function() {
|
||||
s.setName(1, 'hola', function() {
|
||||
|
|
@ -208,14 +168,8 @@ describe('Storage model', function() {
|
|||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('#deleteWallet', function() {
|
||||
}); describe('#deleteWallet', function() {
|
||||
it('should fail to delete a unexisting wallet', function(done) {
|
||||
var s = new Storage({
|
||||
storage: localMock,
|
||||
sessionStorage: sessionMock,
|
||||
password: 'password'
|
||||
});
|
||||
s.set('1', "hola", 'juan', function() {
|
||||
s.set('2', "hola", 'juan', function() {
|
||||
s.deleteWallet('3', function(err) {
|
||||
|
|
@ -227,11 +181,6 @@ describe('Storage model', function() {
|
|||
});
|
||||
|
||||
it('should delete a wallet', function(done) {
|
||||
var s = new Storage({
|
||||
storage: localMock,
|
||||
sessionStorage: sessionMock,
|
||||
password: 'password'
|
||||
});
|
||||
s.set('1', "hola", 'juan', function() {
|
||||
s.set('2', "hola", 'juan', function() {
|
||||
s.deleteWallet('1', function(err) {
|
||||
|
|
@ -252,11 +201,6 @@ describe('Storage model', function() {
|
|||
|
||||
describe('#setFromObj', function() {
|
||||
it('set localstorage from an object', function(done) {
|
||||
var s = new Storage({
|
||||
storage: localMock,
|
||||
sessionStorage: sessionMock,
|
||||
password: 'password'
|
||||
});
|
||||
s.setFromObj('id1', {
|
||||
'key': 'val',
|
||||
'opts': {
|
||||
|
|
@ -274,12 +218,6 @@ describe('Storage model', function() {
|
|||
|
||||
describe('#globals', function() {
|
||||
it('should set, get and remove keys', function(done) {
|
||||
var s = new Storage({
|
||||
storage: localMock,
|
||||
sessionStorage: sessionMock,
|
||||
password: 'password'
|
||||
});
|
||||
|
||||
s.setGlobal('a', {
|
||||
b: 1
|
||||
}, function() {
|
||||
|
|
@ -302,11 +240,6 @@ describe('Storage model', function() {
|
|||
|
||||
describe('session storage', function() {
|
||||
it('should get a session ID', function(done) {
|
||||
var s = new Storage({
|
||||
storage: localMock,
|
||||
sessionStorage: sessionMock,
|
||||
password: 'password'
|
||||
});
|
||||
s.getSessionId(function(s) {
|
||||
should.exist(s);
|
||||
s.length.should.equal(16);
|
||||
|
|
@ -317,12 +250,14 @@ describe('Storage model', function() {
|
|||
});
|
||||
|
||||
describe('#import', function() {
|
||||
it('should not be able to decrypt with wrong password', function() {
|
||||
s.setPassphrase('xxx');
|
||||
var wo = s.import(encryptedLegacy1);
|
||||
should.not.exist(wo);
|
||||
});
|
||||
|
||||
it('should be able to decrypt an old backup', function() {
|
||||
var s = new Storage({
|
||||
storage: localMock,
|
||||
sessionStorage: sessionMock,
|
||||
password: legacyPassword1 ,
|
||||
});
|
||||
s.setPassphrase(legacyPassword1);
|
||||
var wo = s.import(encryptedLegacy1);
|
||||
should.exist(wo);
|
||||
wo.opts.id.should.equal('48ba2f1ffdfe9708');
|
||||
|
|
@ -353,5 +288,3 @@ describe('Storage model', function() {
|
|||
|
||||
var legacyPassword1 = '1DUpLRbuVpgLkcEY8gY8iod/SmA7+OheGZJ9PtvmTlvNE0FkEWpCKW9STdzXYJqbn0wiAapE4ojHNYj2hjYYAQ==';
|
||||
var encryptedLegacy1 = 'U2FsdGVkX19yGM1uBAIzQa8Po/dvUicmxt1YyRk/S97PcZ6I6rHMp9dMagIrehg4Qd6JHn/ustmFHS7vmBYj0EBpf6rdXiQezaWnVAJS9/xYjAO36EFUbl+NmUanuwujAxgYdSP/sNssRLeInvExmZYW993EEclxkwL6YUyX66kKsxGQo2oWng0NreBJNhFmrbOEWeFje2PiWP57oUjKsurFzwpluAAarUTYSLud+nXeabC7opzOP5yqniWBMJz0Ou8gpNCWCMhG/P9F9ccVPY7juyd0Hf41FVse8nd2++axKB57+paozLdO+HRfV6zkMqC3h8gWY7LkS75j3bvqcTw9LhXmzE0Sz21n9yDnRpA4chiAvtwQvvBGgj1pFMKhNQU6Obac9ZwKYzUTgdDn3Uzg1UlDzgyOh9S89rbRTV84WB+hXwhuVluWzbNNYV3vXe5PFrocVktIrtS3xQh+k/7my4A6/gRRrzNYpKrUASJqDS/9u9WBkG35xD63J/qXjtG2M0YPwbI57BK1IK4K510b8V72lz5U2XQrIC4ldBwni1rpSavwCJV9xF6hUdOmNV8fZsVHP0NeN1PYlLkSb2QgfuoWnkcsJerwuFR7GZC/i6efrswtpO0wMEQr/J0CLbeXlHAru6xxjCBhWoJvZpMGw72zgnDLoyMNsEVglNhx/VlV9ZMYkkdaEYAxPOEIyZdQ5MS+2jEAlXf818n/xzJSVrniCn9be8EPePvkw35pivprvy09vbW4cKsWBKvgIyoT6A3OhUOCCS8E9cg0WAjjav2EymrbKmGWRHaiD+EoJqaDg6s20zhHn1YEa/YwvGGSB5+Hg8baLHD8ZASvxz4cFFAAVZrBUedRFgHzqwaMUlFXLgueivWUj7RXlIw6GuNhLoo1QkhZMacf23hrFxxQYvGBRw1hekBuDmcsGWljA28udBxBd5f9i+3gErttMLJ6IPaud590uvrxRIclu0Sz9R2EQX64YJxqDtLpMY0PjddSMu8vaDRpK9/ZSrnz/xrXsyabaafz4rE/ItFXjwFUFkvtmuauHTz6nmuKjVfxvNLNAiKb/gI7vQyUhnTbKIApe7XyJsjedNDtZqsPoJRIzdDmrZYxGStbAZ7HThqFJlSJ9NPNhH+E2jm3TwL5mwt0fFZ5h+p497lHMtIcKffESo7KNa2juSVNMDREk0NcyxGXGiVB2FWl4sLdvyhcsVq0I7tmW6OGZKRf8W49GCJXq6Ie69DJ9LB1DO67NV1jsYbsLx9uhE2yEmpWZ3jkoCV/Eas4grxt0CGN6EavzQ==';
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ describe('Wallet model', function() {
|
|||
});
|
||||
|
||||
var storage = new Storage(walletConfig.storage);
|
||||
storage.setPassphrase('xxx');
|
||||
var network = new Network(walletConfig.network);
|
||||
var blockchain = new Blockchain(walletConfig.blockchain);
|
||||
c.storage = storage;
|
||||
|
|
@ -347,8 +348,10 @@ describe('Wallet model', function() {
|
|||
// non stored options
|
||||
o.opts.reconnectDelay = 100;
|
||||
|
||||
var s = new Storage(walletConfig.storage);
|
||||
s.setPassphrase('xxx');
|
||||
var w2 = Wallet.fromObj(o,
|
||||
new Storage(walletConfig.storage),
|
||||
s,
|
||||
new Network(walletConfig.network),
|
||||
new Blockchain(walletConfig.blockchain));
|
||||
should.exist(w2);
|
||||
|
|
|
|||
|
|
@ -11,21 +11,19 @@ if (is_browser) {
|
|||
}
|
||||
var copayConfig = require('../config');
|
||||
var WalletLock = copay.WalletLock;
|
||||
|
||||
var PrivateKey = copay.PrivateKey;
|
||||
var localMock = require('./mocks/FakeLocalStorage');
|
||||
var sessionMock = require('./mocks/FakeLocalStorage');
|
||||
var Storage = copay.Storage;
|
||||
|
||||
|
||||
|
||||
var storage;
|
||||
describe('WalletLock model', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
storage = new Storage({
|
||||
storage: localMock,
|
||||
sessionStorage: sessionMock,
|
||||
});
|
||||
storage = new Storage(require('./mocks/FakeLocalStorage').storageParams);
|
||||
storage.setPassphrase('mysupercoolpassword');
|
||||
storage.storage.clear();
|
||||
storage.sessionStorage.clear();
|
||||
});
|
||||
|
||||
it('should fail with missing args', function() {
|
||||
|
|
@ -80,36 +78,34 @@ describe('WalletLock model', function() {
|
|||
});
|
||||
|
||||
it('should FAIL if locked by someone else', function(done) {
|
||||
storage.sessionId = 'session1';
|
||||
var w = new WalletLock(storage, 'walletId');
|
||||
w.keepAlive(function() {
|
||||
storage.sessionId = 'session2';
|
||||
var w2 = new WalletLock(storage, 'walletId');
|
||||
w2.keepAlive(function(locked) {
|
||||
w2.sessionId.should.equal('session2');
|
||||
should.exist(locked);
|
||||
locked.message.should.contain('LOCKED');
|
||||
done();
|
||||
storage.setSessionId('session2', function() {
|
||||
var w2 = new WalletLock(storage, 'walletId');
|
||||
w2.keepAlive(function(locked) {
|
||||
should.exist(locked);
|
||||
locked.message.should.contain('LOCKED');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
|
||||
it('should FAIL if locked by someone else but expired', function(done) {
|
||||
storage.sessionId = 'session1';
|
||||
var w = new WalletLock(storage, 'walletId');
|
||||
w.keepAlive(function() {
|
||||
storage.sessionId = 'session2';
|
||||
var json = JSON.parse(storage.storage['lock::walletId']);
|
||||
json.expireTs -= 3600 * 1000;
|
||||
storage.storage['lock::walletId'] = JSON.stringify(json);
|
||||
var w2 = new WalletLock(storage, 'walletId');
|
||||
w2.keepAlive(function(locked) {
|
||||
w2.sessionId.should.equal('session2');
|
||||
should.not.exist(locked);
|
||||
done();
|
||||
storage.setSessionId('session2', function() {
|
||||
|
||||
var json = JSON.parse(storage.storage.ls['lock::walletId']);
|
||||
json.expireTs -= 3600 * 1000;
|
||||
storage.storage.ls['lock::walletId'] = JSON.stringify(json);
|
||||
var w2 = new WalletLock(storage, 'walletId');
|
||||
w2.keepAlive(function(locked) {
|
||||
w2.sessionId.should.equal('session2');
|
||||
should.not.exist(locked);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue