Skip to content

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

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

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.
hyprlab added a commit that referenced this pull request Nov 14, 2026
An account can send its key in an Autocrypt header and keep the keys others send, gossip included, in a keyring apart from the user's. Recipients can be looked up by WKD while a message is addressed, and each pill shows where its key comes from.

Landed with changes: keys are taken only from mail that passes the sender check and only with the user id for the address they came for, a gossip key is asked about before encrypting to it like an unchecked keyring key, and both lookups are off until turned on.

Co-Authored-By: James Reilly <5840441+hanthor@users.noreply.github.com>
@hyprlab

hyprlab commented Nov 16, 2026

Copy link
Copy Markdown
Owner

Agentic reply:

Autocrypt and the key lookups are in the 1.49.0-beta.1 release, landed by hand as one commit and credited to you. At landing, keys from Autocrypt, WKD and the keyserver are used without asking, while a key passed on in someone else's mail (gossip) asks first, as an unvouched key in the keyring does. A key is taken only from mail that passes the sender check, and the WKD lookup is off by default like the keyserver one. The two commits from #595 had already landed, and docs/OPENPGP_BACKEND.md was left out. Please test it there and report anything that doesn't look right. It reaches the stable channel with the next stable release.

If you've installed Hylki beta as a Flatpak, running flatpak update will pick it up automatically. If not, download and install it first:

flatpak install --user --from https://hylki.hyprlab.co/flatpak/co.hyprlab.Hylki.Beta.flatpakref

AppImage, Debian and RPM betas: See Beta channel for update details.

@hyprlab hyprlab closed this Nov 16, 2026
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.

2 participants