Add ANDROID_SECURITY_PLAN.md to project
This commit is contained in:
+5
-3
@@ -14,6 +14,7 @@ function registerPgpIpcHandlers({
|
||||
BrowserWindow,
|
||||
dialog,
|
||||
fs,
|
||||
getOpenPGP,
|
||||
openpgp,
|
||||
pgpKeys,
|
||||
pgpCache,
|
||||
@@ -27,7 +28,7 @@ function registerPgpIpcHandlers({
|
||||
readAccount,
|
||||
imapClient,
|
||||
folderPath,
|
||||
simpleParser,
|
||||
getMailparser,
|
||||
extractMailContent
|
||||
}) {
|
||||
async function fetchMessageSource(account, folder, uid) {
|
||||
@@ -108,6 +109,7 @@ function registerPgpIpcHandlers({
|
||||
const account = await readAccount();
|
||||
if (!account) throw new Error('Add a mail account before opening messages.');
|
||||
const source = await fetchMessageSource(account, String(input?.folder || 'Inbox'), Number(input?.uid));
|
||||
const { simpleParser } = await getMailparser();
|
||||
const outer = await simpleParser(source);
|
||||
try {
|
||||
const result = await pgpMail.decrypt(outer, { passphrase: typeof input?.passphrase === 'string' && input.passphrase ? input.passphrase : null });
|
||||
@@ -143,7 +145,7 @@ function registerPgpIpcHandlers({
|
||||
if ((await fs.stat(result.filePaths[0])).size > 200000) throw new Error('That key file is too large.');
|
||||
armoredKey = await fs.readFile(result.filePaths[0], 'utf8');
|
||||
}
|
||||
const key = await openpgp.readKey({ armoredKey }).catch(() => {
|
||||
const key = await (getOpenPGP ? (await getOpenPGP()).readKey({ armoredKey }) : openpgp.readKey({ armoredKey })).catch(() => {
|
||||
throw new Error('That is not a valid OpenPGP public key.');
|
||||
});
|
||||
const fingerprint = key.getFingerprint().toUpperCase();
|
||||
@@ -277,7 +279,7 @@ function registerPgpIpcHandlers({
|
||||
if (!entry) throw new Error('That key was not found.');
|
||||
if (!entry.email) throw new Error('This key has no email address to publish.');
|
||||
const armoredKey = await pgpKeys.exportPublic(fingerprint);
|
||||
const publicKey = await openpgp.readKey({ armoredKey });
|
||||
const publicKey = await (getOpenPGP ? (await getOpenPGP()).readKey({ armoredKey }) : openpgp.readKey({ armoredKey }));
|
||||
const emails = [...new Set(publicKey.getUserIDs()
|
||||
.map(userId => (/<([^>]+)>/.exec(userId)?.[1] || (userId.includes('@') ? userId : '')).trim().toLowerCase())
|
||||
.filter(Boolean))];
|
||||
|
||||
Reference in New Issue
Block a user