mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-06 16:07:03 +03:00
#89 added import keys to OpenPGP
This commit is contained in:
parent
fe078174ab
commit
9f125c18c3
3 changed files with 21 additions and 12 deletions
|
|
@ -223,6 +223,20 @@ export const PgpUserStore = new class {
|
||||||
return !!(window.openpgp || window.mailvelope || Settings.capa(Capa.GnuPG));
|
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) {
|
gnupgImportKey(key, callback) {
|
||||||
if (Settings.capa(Capa.GnuPG)) {
|
if (Settings.capa(Capa.GnuPG)) {
|
||||||
Remote.request('GnupgImportKey',
|
Remote.request('GnupgImportKey',
|
||||||
|
|
|
||||||
|
|
@ -16,4 +16,8 @@
|
||||||
.delete-key:not(:hover) {
|
.delete-key:not(:hover) {
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
iframe {
|
||||||
|
max-width: 991px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ export class OpenPgpImportPopupView extends AbstractViewPopup {
|
||||||
this.keyErrorMessage('');
|
this.keyErrorMessage('');
|
||||||
|
|
||||||
if (!keyTrimmed) {
|
if (!keyTrimmed) {
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let match = null,
|
let match = null,
|
||||||
|
|
@ -54,15 +54,7 @@ export class OpenPgpImportPopupView extends AbstractViewPopup {
|
||||||
if (this.saveGnuPG()) {
|
if (this.saveGnuPG()) {
|
||||||
PgpUserStore.gnupgImportKey(this.key());
|
PgpUserStore.gnupgImportKey(this.key());
|
||||||
}
|
}
|
||||||
/*
|
PgpUserStore.openpgpImportKey(this.key());
|
||||||
if (this.canOpenPGP && this.saveOpenPGP()) {
|
|
||||||
if ('PRIVATE' === match[1]) {
|
|
||||||
err = PgpUserStore.openpgpKeyring.privateKeys.importKey(match[0]);
|
|
||||||
} else if ('PUBLIC' === match[1]) {
|
|
||||||
err = PgpUserStore.openpgpKeyring.publicKeys.importKey(match[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (err) {
|
if (err) {
|
||||||
this.keyError(true);
|
this.keyError(true);
|
||||||
this.keyErrorMessage(err && err[0] ? '' + err[0] : '');
|
this.keyErrorMessage(err && err[0] ? '' + err[0] : '');
|
||||||
|
|
@ -78,11 +70,10 @@ export class OpenPgpImportPopupView extends AbstractViewPopup {
|
||||||
} while (!done);
|
} while (!done);
|
||||||
|
|
||||||
if (this.keyError()) {
|
if (this.keyError()) {
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.cancelCommand();
|
this.cancelCommand();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue