Android security implementation Phase 3.1
This commit is contained in:
@@ -31,7 +31,13 @@ if (Capacitor.isNativePlatform() && Capacitor.getPlatform() === 'android') {
|
||||
saveAttachment: details => EpMail.saveAttachment(details),
|
||||
openExternal: url => EpMail.openExternal({ url }),
|
||||
send: async message => {
|
||||
if (!message?.pgp || (!message.pgp.encrypt && !message.pgp.sign)) return EpMail.send(message);
|
||||
if (!message?.pgp || (!message.pgp.encrypt && !message.pgp.sign)) {
|
||||
if (message?.pgp?.plaintextFallback) {
|
||||
const { pgp: _options, ...plainMessage } = message;
|
||||
return EpMail.send({ ...plainMessage, pgpRequested: true });
|
||||
}
|
||||
return EpMail.send(message);
|
||||
}
|
||||
try {
|
||||
const { rawBase64, to, from } = await daybreakMail.pgp.buildOutgoing(message);
|
||||
const { pgp: _options, text: _text, attachments: _attachments, ...headers } = message;
|
||||
|
||||
@@ -182,11 +182,11 @@ export function createAndroidPgp({ EpMail, getAccount }) {
|
||||
if (Number.isFinite(savedMinutes) && savedMinutes >= 0 && savedMinutes <= 1440) cacheMinutes = Math.round(savedMinutes);
|
||||
return value;
|
||||
}).catch(error => { storePromise = null; throw error; });
|
||||
return storePromise;
|
||||
return storePromise.then(value => JSON.parse(JSON.stringify(value)));
|
||||
}
|
||||
async function persist(value) {
|
||||
await EpMail.pgpSaveStore({ store: value });
|
||||
storePromise = value;
|
||||
storePromise = Promise.resolve(JSON.parse(JSON.stringify(value)));
|
||||
}
|
||||
function cache(fingerprint, passphrase) {
|
||||
if (!cacheMinutes) { passphrases.delete(fingerprint); return; }
|
||||
|
||||
Reference in New Issue
Block a user