Improve Android OpenPGP, drafts and release builds
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -537,8 +537,15 @@ export function createAndroidPgp({ EpMail, getAccount, confirm = globalThis.conf
|
||||
await persist(data);
|
||||
return { key: publicInfo(entry), revocationCertificate: generated.revocationCertificate };
|
||||
},
|
||||
async importKey({ armoredKey, passphrase, accountId = null }) {
|
||||
if (!armoredKey) armoredKey = prompt('Paste an ASCII-armored OpenPGP private key (up to 200 KB):') || '';
|
||||
async importKey({ armoredKey, passphrase, accountId = null, source = 'paste' }) {
|
||||
if (!armoredKey && source === 'file') {
|
||||
const selected = await EpMail.pickPgpPrivateKey();
|
||||
if (selected.canceled) return { canceled: true };
|
||||
armoredKey = selected.armoredKey;
|
||||
if (typeof armoredKey !== 'string' || !armoredKey.trim()) throw new Error('That key file is empty.');
|
||||
} else if (!armoredKey) {
|
||||
armoredKey = prompt('Paste an ASCII-armored OpenPGP private key (up to 200 KB):') || '';
|
||||
}
|
||||
const armored = String(armoredKey).trim();
|
||||
if (!armored || armored.length > MAX_KEY_LENGTH) throw new Error('That key file is empty or too large.');
|
||||
if (typeof passphrase !== 'string' || passphrase.length < 8) throw new Error('Use a passphrase of at least 8 characters.');
|
||||
|
||||
Reference in New Issue
Block a user