Fixed keyring local storage

This commit is contained in:
Marco Munizaga 2014-01-31 02:26:57 -05:00
parent 3b1955627b
commit 875ccf5196
2 changed files with 11 additions and 2 deletions

View File

@ -42,7 +42,7 @@ LocalStore.prototype.load = function () {
if (armoredKeys !== null && armoredKeys.length !== 0) {
var key;
for (var i = 0; i < armoredKeys.length; i++) {
key = openpgp.key.readArmored(armoredKeys[i]);
key = openpgp.key.readArmored(armoredKeys[i]).keys[0];
keys.push(key);
}
}

View File

@ -77,6 +77,15 @@ describe("Keyring", function() {
expect(keys).to.exist.and.have.length(1);
done();
});
it('store keys in localstorage', function(done){
keyring.store();
done();
});
it('after loading from localstorage: getKeysForKeyId() - valid id', function(done) {
var keyring = new openpgp.Keyring(),
keys = keyring.getKeysForKeyId(keyId.toLowerCase());
expect(keys).to.exist.and.have.length(1);
done();
});
});