Improve Android OpenPGP, drafts and release builds

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-11-17 22:11:05 +02:00
co-authored by Copilot
parent d0e2ce26bc
commit 96c7b6966b
28 changed files with 747 additions and 187 deletions
+7 -5
View File
@@ -32,7 +32,7 @@ function openEncryptionKeys() {
<label class="compose-line"><span>HTTPS base URL</span><input id="pgp-server-url" type="url" placeholder="https://keys.example.org"></label>
<label class="compose-line"><span>Protocol</span><select id="pgp-server-protocol"><option value="hkp">HKP</option><option value="vks">VKS</option></select></label>
<div class="pgp-actions"><button class="discard" id="pgp-add-server">Add custom server…</button></div>`;
root.innerHTML = `<div class="modal-overlay"><div class="compose-modal attachments-modal"><div class="modal-head"><span>Encryption keys</span><button class="modal-close" aria-label="Close">×</button></div><div class="compose-fields">
root.innerHTML = `<div class="modal-overlay"><div class="compose-modal attachments-modal pgp-keys-modal"><div class="modal-head"><span>Encryption keys</span><button class="modal-close" aria-label="Close">×</button></div><div class="compose-fields">
<p class="account-note">${androidPgp ? 'EXPERIMENTAL ANDROID TESTING — not independently security reviewed. Private keys remain passphrase-protected inside the encrypted Android vault. Optional biometric unlock stores the passphrase in a Keystore key requiring user authentication. Back up your private key and revocation certificate: without them, encrypted mail cannot be recovered.' : 'OpenPGP keys are protected by a passphrase and stored encrypted by your operating system. Back up your private key and revocation certificate: without them, encrypted mail cannot be recovered.'} Contact keys below are used to encrypt mail to your correspondents and to check signatures.</p>
<div id="pgp-key-list" class="attachment-list">Loading keys…</div>
<h3 class="pgp-heading">Change a key passphrase</h3>
@@ -52,7 +52,7 @@ function openEncryptionKeys() {
<label class="compose-line"><span>Name</span><input id="pgp-name" maxlength="100" value="${escapePgpKeyUi(account.displayName || '')}"></label>
<label class="compose-line"><span>Email</span><input id="pgp-email" type="email" value="${escapePgpKeyUi(account.email || '')}"></label>
<label class="compose-line"><span>Passphrase</span><input id="pgp-passphrase" type="password" autocomplete="new-password" placeholder="At least 8 characters"></label>
<div class="pgp-actions"><button class="send-button" id="pgp-generate">Create key</button><button class="discard" id="pgp-import">Import private key…</button></div>
<div class="pgp-actions"><button class="send-button" id="pgp-generate">Create key</button><button class="discard" id="pgp-import">${androidPgp ? 'Import private key from file…' : 'Import private key…'}</button>${androidPgp ? '<button class="discard" id="pgp-import-paste">Paste private key…</button>' : ''}</div>
<p class="account-note" id="pgp-status" role="status"></p>
</div></div></div>`;
const close = () => { root.innerHTML = ''; };
@@ -229,15 +229,17 @@ function openEncryptionKeys() {
} catch (error) { status(error.message || 'Could not create the key.'); }
button.disabled = false;
};
selectPgpKeyUi('#pgp-import').onclick = async () => {
const importPrivateKey = async source => {
const passphrase = needPassphrase();
if (!passphrase) return;
try {
const result = await window.daybreakMail.pgp.importKey({ passphrase, accountId: account.id || null });
const result = await window.daybreakMail.pgp.importKey({ passphrase, accountId: account.id || null, ...(androidPgp ? { source } : {}) });
status(result.canceled ? '' : result.keyChangedFrom?.length ? 'Key imported. You already have a different key for this address; compare fingerprints before trusting either key.' : 'Key imported.');
await render();
if (!result.canceled) await render();
} catch (error) { status(error.message || 'Could not import the key.'); }
};
selectPgpKeyUi('#pgp-import').onclick = () => importPrivateKey(androidPgp ? 'file' : undefined);
if (androidPgp) selectPgpKeyUi('#pgp-import-paste').onclick = () => importPrivateKey('paste');
async function renderContacts() {
const list = selectPgpKeyUi('#pgp-contact-list');
let contacts = [];