Skip to content

feat(pgp): add Autocrypt and automatic key discovery - #602

Open
hanthor wants to merge 4 commits into
hyprlab:mainfrom
tuna-os:feat/pgp-autocrypt
Open

hanthor wants to merge 4 commits into
hyprlab:mainfrom
tuna-os:feat/pgp-autocrypt

Conversation

@hanthor

@hanthor hanthor commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Builds on #595.

  • Autocrypt Level 1. Two per-account switches, both off by default: send your key (Autocrypt: header with a minimised key) and encrypt by default (prefer-encrypt=mutual). Incoming headers are read when an account has it on, with addr= checked against From, and kept in a new pgp_peers table. Keys go into Hylki's own GnuPG home (discovered-keys), never the user's keyring; the reader's one-click Autocrypt import now goes there too. The full recommendation algorithm (disable, discourage, available, encrypt), and Autocrypt-Gossip inside encrypted mail to several recipients.
  • Automatic key discovery. WKD over HTTPS in Rust (advanced, then direct only when the advanced host is unreachable), key must carry the looked-up address; keys.openpgp.org only when enabled. The composer looks recipients up 600 ms after they settle, caching misses for a day.
  • Per-recipient indicator. A lock badge on each recipient pill (keyring, Autocrypt/WKD, gossip or stale, none), with tooltips and accessible descriptions. Encrypt turns on by itself when every recipient and the account prefer it.
  • docs/OPENPGP_BACKEND.md compares GnuPG, Sequoia and RNP for RFC 9580, recommending Sequoia for the discovered-keys keyring first.

Tests: header parse/emit, the recommendation table, peer-state updates, gossip filtering, WKD URLs and fallback with a fake network, and real-gpg tests that found keys stay out of the user's keyring and forged headers are refused. Not tested live: WKD against real servers.

Bcc recipients go to gpg as hidden recipients, so To and Cc cannot see whose keys were Bcc'd. A good signature from a key without the From address shows amber, not green. Encrypting to a key the keyring does not vouch for asks first in the composer, and each address is encrypted to the checked key by fingerprint, preferring a vouched one.
An account can now send its key in an Autocrypt header and keep the keys others send, gossip included, in a keyring of Hylki's own rather than the user's GnuPG keyring. Recipients are looked up by WKD while a message is addressed, each pill shows where its key comes from, and Encrypt turns on when everyone prefers it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant