decryption: GopenPGPInterface tries to identify decryption key from message metadata

So the system can have multiple private keys, and the caller doesn't
need to specify a specific one regardless.

Ideally: If there are several matches we could also take into account
which keys have already been unlocked (or passthrases saved in
keychain). Right now it only grabs the first match.
This commit is contained in:
Lysann Tranvouez 2026-03-10 22:16:42 +01:00
parent f1cb5d27be
commit 8d4f3af475
6 changed files with 76 additions and 15 deletions

View file

@ -44,7 +44,7 @@ class MockPGPInterface: PGPInterface {
// MARK: - PGPInterface
func decrypt(encryptedData: Data, keyID: String?, passPhraseForKey: @escaping (String) -> String) throws -> Data? {
func decrypt(encryptedData: Data, keyIDHint keyID: String?, passPhraseForKey: @escaping (String) -> String) throws -> Data? {
decryptCalls.append(DecryptCall(encryptedData: encryptedData, keyID: keyID, passPhraseForKey: passPhraseForKey))
if let selectedKey = selectedKeyForPassphrase {
resolvedPassphrases.append(passPhraseForKey(selectedKey))