Add ANDROID_SECURITY_PLAN.md to project
This commit is contained in:
+3
-1
@@ -5,7 +5,7 @@ function registerDavIpcHandlers({
|
||||
davPublicConfig,
|
||||
openDavClient,
|
||||
activeDavConfig,
|
||||
ICAL,
|
||||
getICAL,
|
||||
makeCalendarData,
|
||||
makeVcard,
|
||||
randomUUID,
|
||||
@@ -88,6 +88,7 @@ function registerDavIpcHandlers({
|
||||
if (!config) throw new Error(`Connect a ${type === 'caldav' ? 'CalDAV' : 'CardDAV'} server first.`);
|
||||
const client = await openDavClient(config, type);
|
||||
if (type === 'caldav') {
|
||||
const { default: ICAL } = await getICAL();
|
||||
const calendars = await client.fetchCalendars();
|
||||
const result = [];
|
||||
for (const calendar of calendars) {
|
||||
@@ -116,6 +117,7 @@ function registerDavIpcHandlers({
|
||||
}
|
||||
return { items: result, account: davPublicConfig(config) };
|
||||
}
|
||||
const { default: ICAL } = await getICAL();
|
||||
const books = await client.fetchAddressBooks();
|
||||
const result = [];
|
||||
for (const book of books) {
|
||||
|
||||
@@ -35,7 +35,7 @@ function registerMailIpcHandlers(dependencies) {
|
||||
mailOutbox,
|
||||
pgpMail,
|
||||
PgpError,
|
||||
simpleParser,
|
||||
getMailparser,
|
||||
folderPath,
|
||||
sendMailNow,
|
||||
pgpFailure
|
||||
@@ -270,6 +270,7 @@ registerIpcHandler('mail:update-message', async (_event, input) => {
|
||||
|
||||
// Encrypted messages keep their attachments inside the encrypted payload.
|
||||
async function parseForAttachments(source) {
|
||||
const { simpleParser } = await getMailparser();
|
||||
const parsed = await simpleParser(source);
|
||||
const kind = pgpMail.detect(parsed);
|
||||
if (kind !== 'encrypted-mime' && kind !== 'encrypted-inline') return parsed;
|
||||
|
||||
+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