mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-03 14:37:02 +03:00
Automaticaly add PGP key from Autocrypt #89
This commit is contained in:
parent
e28085fbba
commit
17cb093b32
3 changed files with 55 additions and 22 deletions
|
|
@ -9,6 +9,8 @@ import { SettingsCapa, SettingsGet } from 'Common/Globals';
|
|||
import { GnuPGUserStore } from 'Stores/User/GnuPG';
|
||||
import { OpenPGPUserStore } from 'Stores/User/OpenPGP';
|
||||
|
||||
import Remote from 'Remote/User/Fetch';
|
||||
|
||||
// https://mailvelope.github.io/mailvelope/Keyring.html
|
||||
let mailvelopeKeyring = null;
|
||||
|
||||
|
|
@ -75,6 +77,22 @@ export const
|
|||
return 0 === text.trim().indexOf(BEGIN_PGP_MESSAGE);
|
||||
}
|
||||
|
||||
importKey(key, gnuPG, backup) {
|
||||
if (gnuPG || backup) {
|
||||
Remote.request('PgpImportKey',
|
||||
(iError, oData) => {
|
||||
if (gnuPG && oData?.Result/* && (oData.Result.imported || oData.Result.secretimported)*/) {
|
||||
GnuPGUserStore.loadKeyrings();
|
||||
}
|
||||
iError && alert(oData.ErrorMessage);
|
||||
}, {
|
||||
key, gnuPG, backup
|
||||
}
|
||||
);
|
||||
}
|
||||
OpenPGPUserStore.isSupported() && OpenPGPUserStore.importKey(key);
|
||||
}
|
||||
|
||||
async mailvelopeHasPublicKeyForEmails(recipients) {
|
||||
const
|
||||
mailvelope = mailvelopeKeyring && await mailvelopeKeyring.validKeyForAddress(recipients)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue