Commit Graph
11 Commits
Author SHA1 Message Date
raucao ca7ba5d8d7 Show identity keys in one style, and verify NIP-05 before showing it
Every key in the app is now the same kind of thing: `plain::key` /
`.key-value` renders it in the monospace font at the size the label already
has, as a fixed `head…tail` cut, so a column of them lines up. Deliberately
not libadwaita's `.monospace`, which also switches to the code size and, on an
`AdwActionRow`, takes the field name with it. The identities list shows the
name over the key alone (it used to be "Profile · npub" on one line, where a
long profile name ate the key's tail), and the switcher keeps its own shorter
npub cut and renders it at `.caption`: a key is never body-sized there, and the
row's bold *name* stays the loudest thing in it.

The switcher's second line prefers a NIP-05 address — but only one the domain
has confirmed for exactly this key, because a kind-0's `nip05` is
self-declared and that line is where an identity is identified.
`store::nip05` parses the address strictly (it becomes an HTTPS request, so a
sloppy parse would be an SSRF), asks
`https://<domain>/.well-known/nostr.json?name=<local>` through the icons'
hardened fetch — now split into `fetch_https(url, Content)`, the app's single
HTTP path — and shows the address only while `nip05_ok == nip05`. A
re-declared or forged address is unverified again immediately, a slow answer
for a changed one is dropped, and a failed check costs a day.

Names are no longer invented: no "Identity 3" and no "Imported 1". The create
dialog starts empty, import carries a Name field that is prefilled from a
cached profile as soon as the pasted string decodes to a key, and an empty
field stores no label at all. A discovered profile name trumps the label for
display (`identity_label`), which is what happens for a key imported before
its profile was known — the label itself is never overwritten.
2026-11-29 16:33:53 +04:00
raucao fca9851d8f Go back to the alert-style add/import dialogs, in a taller window
The plain `AdwDialog`s with the accept button in the header bar are not
wanted; restore the `AdwAlertDialog` versions of "Create an identity key" and
"Import an identity key".

The clipping they were meant to fix was the window height, not the dialog
style: the identities window is a fixed size and GTK never resizes a mapped
window, so its default has to fit the first-run empty state and the dialogs.
Keep the taller window (420x560); the width goes back to the original 420.

Reverts most of the previous commit.
2026-11-28 15:18:58 +04:00
raucao ab09201a2e Fit the identities window and its add/import dialogs
The identities window is a fixed size and GTK never resizes a mapped window,
so its default has to fit the first-run empty state. At 420x480 it did not:
the `AdwStatusPage` overflowed (its buttons were cut off), and so did the
"Create an identity key" / "Import an identity key" dialogs, which are
presented as overlays inside the same window.

- Size the window 480x560. 480 wide also drops the empty state's description
  from four lines to three.
- Rebuild create/import as plain `AdwDialog`s in the "Connect an app" shape: a
  header bar with Cancel and the accept button over a scrolling body. An
  `AdwAlertDialog`'s message area only *propagates* its natural height
  (`adw-alert-dialog.c`), so a form taller than the window grows past it and is
  clipped instead of scrolling. The new dialog's body scrolls and its buttons
  stay pinned.
- Keep the dialog open when creating/importing fails, so a passphrase mismatch
  can be corrected (the old alert closed before reporting the error).

Rename/export/remove stay `AdwAlertDialog`s: they are single-field or one-line
and fit.
2026-11-28 15:01:12 +04:00
raucao 2299966237 Give the identities window a sensible fixed height
640 was taller than the list ever needs, leaving a lot of dead space, and the
size is fixed besides — GTK never resizes a mapped window, so the window takes
whatever it had when it was first shown. 480 fits the empty state and a handful
of keys better; the page's own scroller handles a longer list.
2026-11-26 18:06:29 +04:00
raucao e2785afa37 Widen the approval dialog and narrow the rest
The approval dialog set AdwDialog:content-width, which an AdwAlertDialog
ignores — it uses internal breakpoints, and a breakpoint-using AdwDialog has
no minimum size, so the dialog rendered 300px wide however large the request.
Pin it with a width-request instead (plain::alert_width), which the dialog
honours exactly.

With that working, drop the shared dialog width from 560 to 480 and shrink
the main window to 560x740 so both dialogs sit comfortably inside it.
2026-11-26 12:12:32 +04:00
raucao 13a7f74c48 Widen the main window and put the switcher, lock and menu in place 2026-11-24 20:58:38 +04:00
raucao fa744e23f6 Add M10: identities in their own window, Preferences, first-run mode 2026-11-24 16:30:12 +04:00
raucao 3c196afa0c Remove the signer page's state banner 2026-11-24 15:44: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