If you attempt to store an empty keylist then delete the storage key

This commit is contained in:
Matthew Shaylor
2015-08-11 21:59:45 +01:00
committed by evilaliv3
parent 068d38d832
commit 37ce176d42
2 changed files with 22 additions and 3 deletions

View File

@@ -97,8 +97,12 @@ LocalStore.prototype.storePrivate = function (keys) {
function storeKeys(storage, itemname, keys) {
var armoredKeys = [];
for (var i = 0; i < keys.length; i++) {
armoredKeys.push(keys[i].armor());
if (keys.length) {
for (var i = 0; i < keys.length; i++) {
armoredKeys.push(keys[i].armor());
}
storage.setItem(itemname, JSON.stringify(armoredKeys));
} else {
storage.removeItem(itemname);
}
storage.setItem(itemname, JSON.stringify(armoredKeys));
}