mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-10-24 22:25:09 +03:00
window.localStorage to localStorage
This commit is contained in:
parent
020927cc56
commit
3da27c3bc8
1 changed files with 3 additions and 4 deletions
|
|
@ -58,10 +58,9 @@ const
|
||||||
*/
|
*/
|
||||||
publicKeysItem = 'openpgp-public-keys',
|
publicKeysItem = 'openpgp-public-keys',
|
||||||
privateKeysItem = 'openpgp-private-keys',
|
privateKeysItem = 'openpgp-private-keys',
|
||||||
storage = window.localStorage,
|
|
||||||
loadOpenPgpKeys = async itemname => {
|
loadOpenPgpKeys = async itemname => {
|
||||||
let keys = [], key,
|
let keys = [], key,
|
||||||
armoredKeys = JSON.parse(storage.getItem(itemname)),
|
armoredKeys = JSON.parse(localStorage.getItem(itemname)),
|
||||||
i = arrayLength(armoredKeys);
|
i = arrayLength(armoredKeys);
|
||||||
while (i--) try {
|
while (i--) try {
|
||||||
key = await openpgp.readKey({armoredKey:armoredKeys[i]});
|
key = await openpgp.readKey({armoredKey:armoredKeys[i]});
|
||||||
|
|
@ -74,9 +73,9 @@ const
|
||||||
storeOpenPgpKeys = (keys, section) => {
|
storeOpenPgpKeys = (keys, section) => {
|
||||||
let armoredKeys = keys.map(item => item.armor);
|
let armoredKeys = keys.map(item => item.armor);
|
||||||
if (armoredKeys.length) {
|
if (armoredKeys.length) {
|
||||||
storage.setItem(section, JSON.stringify(armoredKeys));
|
localStorage.setItem(section, JSON.stringify(armoredKeys));
|
||||||
} else {
|
} else {
|
||||||
storage.removeItem(section);
|
localStorage.removeItem(section);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue