Android security implementation Phase 3.1

This commit is contained in:
2026-11-03 18:05:14 +02:00
parent d165fdc4b4
commit e3b3a9bb52
14 changed files with 224 additions and 48 deletions
+9 -6
View File
@@ -168,23 +168,26 @@ pgpMailUi.wrapShowCompose(baseShowCompose => function (reply, forward = false) {
// Called by the send handler. Returns null (plain mail), false (cancelled) or send options.
async function prepareSend(to, cc) {
if (!pgpApi()) return null;
if (!pgpApi()) return null;
const plaintextFallback = () => pgpApi().platform === 'android'
? { encrypt: false, sign: false, plaintextFallback: true }
: null;
let encrypt = Boolean(selectPgpMailUi('#pgp-encrypt')?.checked);
const sign = Boolean(selectPgpMailUi('#pgp-sign')?.checked);
if (!encrypt && !sign && selectPgpMailUi('#pgp-encrypt')?.dataset.touched === '1') return null;
const status = await pgpApi().checkSend({ to, cc, sign });
// The default-on update is debounced, so a quick send could skip encryption even though keys exist.
if (!encrypt && !status.missing.length && status.recipients.length && selectPgpMailUi('#pgp-encrypt')?.dataset.touched !== '1') {
if (confirm('Public keys are available for all recipients.\n\nSend this message WITHOUT encryption?')) {
if (!sign) return null;
if (confirm('Public keys are available for all recipients.\n\nSend this message WITHOUT encryption?')) {
if (!sign) return plaintextFallback();
} else return false;
}
if (!encrypt && !sign) return null;
if (encrypt && status.missing.length) {
const sendPlain = confirm(`No public key for ${status.missing.join(', ')}.\n\nThe message cannot be encrypted for everyone. Send it WITHOUT encryption?`);
if (!sendPlain) return false;
encrypt = false;
if (!sign) return null;
if (!sendPlain) return false;
encrypt = false;
if (!sign) return plaintextFallback();
}
let passphrase = null;
if (sign) {