Add ANDROID_SECURITY_PLAN.md to project

This commit is contained in:
2026-11-03 07:16:33 +02:00
parent 640fca8a70
commit af224beda4
13 changed files with 631 additions and 26 deletions
+5 -3
View File
@@ -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))];