Commit Graph
9 Commits
Author SHA1 Message Date
raucao c71f110f6f Run in the background, with a status icon and autostart
Closing the main window now asks whether to keep Regent running in the
background or to quit, and remembers the choice (reversible in
Preferences). A backgrounded Regent still answers requests: the approval
drain presents the hidden window for a prompt and hides it again once the
whole request is answered, so the application that asked regains focus.
The two-window invariant becomes "the main window is presentable exactly
when the responder can serve prompts". With no key, or a stopped signer,
closing still quits.

A StatusNotifierItem (ksni) adds Show/Hide Regent, Preferences and Quit;
it is menu-only on activate, because GNOME's AppIndicator extension waits
out the double-click interval whenever an Activate method exists. A new
"Background" preference group carries the close action, the icon toggle
and start-at-login, which registers with org.freedesktop.portal.Background
(so GNOME lists the app under Background Apps) and starts it with
--background.

Also: dialogs parent to the visible window rather than the primary one, a
signer start-failure dialog is suppressed while the window is hidden, and
the Requests group moves to the bottom of Preferences.
2026-11-28 12:42:18 +04:00
raucao 468d918bd3 Show app icons from NIP-46 metadata
Applications declare a name, URL and image in their pairing metadata; Regent
already stored the image but never rendered it. It now fetches, caches and
shows it as a 32px avatar on the Apps page and beside "Application" in the
approval dialog, with a "Load app icons" preference to turn fetching off.

The URL is attacker-controlled, so the new src/store/icons.rs is mostly a
security boundary: https only (plus inline data: URLs that never leave the
process), every resolved address must be public (loopback, private, link-local,
CGNAT, reserved, multicast and IPv6 ULA/mapped-v4 are refused, fail-closed on a
mixed answer), the validated addresses are pinned with a client per fetch
(resolve_to_addrs is baked in at build time, so a shared client could not carry
the pin), redirects are re-validated and re-pinned hop by hop, the body is
capped at 1 MiB, and only PNG/JPEG/GIF/WebP pass — by magic bytes, so an SVG is
rejected before it can reach the decoder. A `.url` sidecar records the URL last
attempted, so a failed icon is never retried on every change ping; the cache
lives in the XDG cache dir, keyed by the client key and mode 0600.

No fetch happens before consent: the approval dialog shows initials for a first
pairing and the cached icon only for an app the user already approved. The name
stays the identifier; the icon is decoration, never the sole identifier.

Adds reqwest (rustls-tls, no default features), base64, and tokio's net feature.
2026-11-26 22:39:13 +04:00
raucao cd03e239ef Keep raw field order and show tags as a group
Two review fixes for the content view:

- Fields now follow the order the client sent them, not alphabetical order.
  serde_json's default map is a BTreeMap, so map.iter() — which both the inline
  rows and the preview's formatted page use — walked the keys sorted. Enabling
  preserve_order makes it an IndexMap, so a kind-0 profile keeps "about" after
  the name keys, exactly as in the raw JSON. It is a global flag; the crate's
  other serde_json uses are order-insensitive (typed structs for apps.json and
  keys.json; tests compare parsed values) and the full suite still passes.

- Tags get a group of their own instead of one flattened, truncated summary
  string. Request::Sign carries them structurally as Vec<TagView> (bounded),
  and the dialog renders a "Tags" card: a count and, when the list is longer
  than the inline cap, a "View all tags" button opening the full list in a
  dialog like the content preview. Each tag is one row, its name beside its
  full value(s), WordChar-wrapped rather than cut off.
2026-11-26 15:48:11 +04:00
raucao 623ef35bac Add M8: a NIP-49 key vault with a global passphrase 2026-11-23 23:43:14 +04:00
raucao f9e31cdcb0 Add M6: headless mode and CLI pairing 2026-11-13 23:37:18 +04:00
raucao d3536d0c4a Ask the user before letting an application pair
Adds the approval bridge (responder asks over a channel, the dialog answers on
the main loop, a timeout or a missing UI denies), the registry of approved
applications stored in apps.json, and the pairing dialog showing the client's
self-declared metadata as the untrusted hint it is.

A client that has not been approved now gets no answer to anything except
connect. Requests from approved clients are still answered without asking; the
banner says so until M4.

Covered by two tests against nak: approval lets it pair and sign, denial stops
it pairing.
2026-11-13 15:58:16 +04:00
raucao 2bbb6c4259 Add the NIP-46 responder and a signer page
The responder subscribes to kind:24133 events p-tagged to the device key,
decrypts (NIP-44, falling back to NIP-04), parses the request envelope by hand,
and answers NIP-44 encrypted, signed with the device key while events are signed
with the identity key.

The window is now a view switcher with a keys page and a signer page showing the
bunker:// connection string and its QR code. Every request is still answered
without asking; the UI banner says so until M4.

Adds build-aux/acceptance.sh, which covers the keyring round-trip, a nak
loopback against the responder, and the app starting the signer end to end.
2026-11-13 15:10:37 +04:00
raucao f8249c89a1 Add key storage and a keys page
KeyStore keeps one Secret Service item per key: the identity key (the nsec,
used only for signing) and a generated device key used for NIP-46 transport,
so the transport key can be rotated without touching the identity.

Includes NIP-49 export/import, zeroizing of in-memory copies, the tokio/main-loop
bridge that the relay work will reuse, and an ignored test that round-trips
everything against a real Secret Service.
2026-11-13 14:47:59 +04:00
raucao c864abc5cd Add application skeleton
Window, GSettings-backed config, Blueprint UI in a GResource, and the
packaging metadata (desktop entry, AppStream metainfo, schema, icons).

Built with gtk4-rs and libadwaita against the host toolchain; Meson drives
cargo and installs the GResource under $datadir/org.kosmos.raucao.Regent.
2026-11-13 14:22:57 +04:00