#89 added import keys to OpenPGP

This commit is contained in:
the-djmaze 2022-01-28 17:56:44 +01:00
parent fe078174ab
commit 9f125c18c3
3 changed files with 21 additions and 12 deletions

View file

@ -223,6 +223,20 @@ export const PgpUserStore = new class {
return !!(window.openpgp || window.mailvelope || Settings.capa(Capa.GnuPG));
}
openpgpImportKey(armoredKey) {
openpgp && openpgp.readKey({armoredKey:armoredKey}).then(key => {
if (!key.err) {
if (key.isPrivate()) {
this.openpgpPrivateKeys.push(new OpenPgpKeyModel(armoredKey, key));
storeOpenPgpKeys(this.openpgpPrivateKeys, privateKeysItem);
} else {
this.openpgpPublicKeys.push(new OpenPgpKeyModel(armoredKey, key));
storeOpenPgpKeys(PgpUserStore.openpgpPublicKeys, publicKeysItem);
}
}
});
}
gnupgImportKey(key, callback) {
if (Settings.capa(Capa.GnuPG)) {
Remote.request('GnupgImportKey',