Reveal the `ncryptsec` password only when the pasted string is one — it is
dead weight for an `nsec`/hex import — place it directly under the key
field, and let the dialog track its content so the revealed row is not
clipped. The submit branch now trims too, so the field and the branch
agree on what counts as an `ncryptsec`.
Also stop stretching the first-run "Set a passphrase" button to the full
width of the status page.
An import of an `ncryptsec` with the wrong password surfaced the NIP-49
crypto failure verbatim — an opaque `aead::Error`. Translate it to
"Wrong ncryptsec password." by matching on the error kind, so an
unsupported or tampered `log_n` is not mislabelled as a wrong password.
Shorten the vault-passphrase error to "Wrong vault passphrase." as well:
the old sentence was too long for the dialog's toast.
The passphrase used to be set as a side effect of adding the first
identity key, in the same dialog. Split it into a first-run "Set up your
vault" step, so the first key afterwards only *checks* the passphrase,
and make the three forms HIG action dialogs that stay open on error.
A passphrase with no keys is now representable: keys.json gains an
optional NIP-49 `verifier` (a fixed 32-byte constant, so it round-trips
through EncryptedSecretKey). has_vault() accepts it, set_passphrase
writes it (only while keyless — that is also the "forgot it" reset, which
loses nothing), unlock and verify_passphrase check it, and add_user_key
clears it once a key is stored, so a keyed vault is byte-for-byte the old
shape. change_passphrase re-encrypts it too. A malformed verifier is
dropped on load rather than quarantining the file. The version stays 1:
serde ignores the unknown field, so an older Regent reads a
verifier-only vault as empty and its next add drops the verifier —
accepted, no keys were lost.
Setup/Create/Import are now plain AdwDialog action dialogs: the action
starts insensitive and is re-evaluated on every keystroke, which also
marks the offending row with libadwaita's `.error` class, so a too-short
or mismatched passphrase can never be submitted (no error dialog at all).
Only an unknowable error — a wrong vault passphrase — is shown, as a
toast inside the dialog, which stays open and keeps the input. Return
submits, the first field takes initial focus, and closing wipes the
fields (L5). An AdwAlertDialog cannot do this: it always closes when a
response is activated.
The Identities window is 460 wide so its dialogs present as centered
floating cards instead of sheets docked to the bottom edge (libadwaita
switches below 450px), and the dialog footer is equal-width buttons like
an alert dialog's response area.
Both the GUI (in startup) and headless take an unconditional flock on regent.lock (0600); a refused instance short-circuits activate/open so it cannot pair.
The single HTTPS fetch now sets no_proxy, rejects URL userinfo on every hop, and allow-lists IPv6 to 2000::/3 minus the special ranges; IPv4 rejects all of 0.0.0.0/8.
gate() no longer writes apps.json; authorize_inner re-checks the app's identity (and its stored permission) after the last await and only then stores 'always', so a revoke or rebind during a prompt denies.
decode() reads the container header and refuses anything over 1024x1024 before gdk::Texture::from_bytes allocates it; preview_icon no longer caches a pre-consent texture.
The dialog now shows the client-requested created_at and warns (adw::Banner) when content, tags, tag values or an encrypt message exceed what it can show, and offers the full encrypt message. incoming() rejects a malformed kind/content/tags instead of coercing them.
kind:24133 is ephemeral, so every relay delivery of a captured request reached the responder again. A ReplayGuard in the responder loop now drops an event whose created_at is outside a 120 s window (or predates this run) and any event id already seen.
The code stays Unlicense (public domain); this is additive. A copyright
license grants no rights to a name or logo — the Unlicense is silent on
trademarks, so those were never given away, and a name is not copyrightable
at all. The one gap was the artwork: the icon SVGs sat inside a public-domain
repo with no notice of their own, so anyone could read the dedication as
covering them.
TRADEMARK.md (based on the Model Trademark Guidelines) claims the word
"Regent", the app and symbolic icons and the application id; it permits
nominative use and unmodified redistribution, and requires a fork to pick its
own name and icon. No registration is claimed — "™", not "®". The icons stay
under the Unlicense; the policy only governs using them as a mark.
README, the About dialog and the AGENTS.md hard rule now state the split.
An identity with a valid NIP-05 address never showed it, however often the
profile was re-fetched. `put_metadata` only stored a *strictly* newer kind-0, so
`nip05` — a field added to `Profile` after the cached entries were written — was
refused along with the very event that carries it. The same comparison meant
`fetched_at` never advanced for an unchanged profile, so `needs_refresh` stayed
true and every start re-fetched it again.
The writer now answers two questions separately. Do we *have* this version? A
newer or equal `created_at` says yes: the clock moves and the answer counts.
Whose *content* does the entry hold? A newer version replaces it; an equal one is
the same version re-fetched, which is what backfills a field added later. Two
versions in the same second are settled by the lower event id — NIP-01's rule for
replaceable events — in the merge map and in the cache (`kind0_id`), so a relay
serving only one of them cannot make what we hold flip; an entry written before
that id was kept adopts the next equal-`created_at` answer. An older version is
still refused, which is the point of the watermark. `put_relay_list` stays strict
deliberately: its attempt clock moves on every call, so nothing can be stranded
there — and if a kind-10002-derived field is ever added, it has to become `>=` at
the same time.
The NIP-05 parser takes the email-ish local part now (`. _ % + -`, any case), as
clients in the wild use; it only reaches a percent-encoded query parameter. The
domain half stays strict, because that is what becomes the outbound request.
On top of that, the identities list can re-fetch one profile on demand: "Re-fetch
profile" (`AppState::refetch_profile`) loosens the 7-day discovery TTL, the 1-day
directory-fallback backoff and the 1-day NIP-05 backoff for that key, and a
per-key claim (`profile_fetch_in_flight`, claimed by automatic refreshes too, held
with a self-healing bound and released by comparing the stamp this call wrote)
keeps repeated clicks from opening parallel rounds. It cannot make anything worse:
the cached name, picture, relay list and watermarks are untouched, a profile is
stored only when it is newer than `kind0_at`, and an address can only be
*un*-verified by a definitive non-match.
The fetch reports what it found — `FetchOutcome::{Updated,UpToDate,NotFound}`,
decided by comparing what the app shows before and after — and the menu answers
with it ("Profile updated" / "Profile is up to date" / "No profile found"),
dismissing the "checking" toast rather than outranking it: libadwaita shows one
toast at a time, and a high-priority one only pushes the previous toast back into
the queue, where it would return stale.
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.
An identity showed initials and often no name, while a client application's
icon was fetched, cached and rendered. Two reasons: profiles were fetched only
from Regent's configured relays — a members-only NIP-46 relay with no profiles
— and `Filter::limit(0)` caps the *stored* events a relay answers with to zero,
so that fetch received nothing at all even where profiles existed.
Discovery now goes through a measured directory set (directory.yabu.me,
purplepag.es, profiles.nostr1.com; `PROFILE_RELAYS`, overridable with
`REGENT_PROFILE_RELAYS`, else `REGENT_RELAYS` so an overridden run stays
offline). One REQ per author per relay: purplepag.es silently under-returns a
multi-author filter (8 of 20 keys batched, 15 of 20 per author), and its union
with the others is the same 15/20, so more relays buy availability, not
coverage. Three EOSE-capped waves on one ephemeral client — the identity's
kind-10002 and profile from the directory, then kind-0 from its own
write/unmarked relays, then the directory again if those served nothing — feed
one newest-wins map per kind. A relay is connected only when a wave will use it,
so a warm outbox opens no socket to the directory at all.
`profiles.json` keeps the outbox and its clocks: `write_relays` with the
kind-10002's `created_at` as a watermark, a 7-day TTL on discovery *attempts*
(so an identity that publishes no 10002 is re-discovered weekly, not on every
start), and a 1-day backoff on the directory fallback (a missing profile never
advances `fetched_at`, so `needs_refresh` stays true). A far-future `created_at`
is refused, so a relay cannot pin a watermark out of reach.
The picture is cached and rendered like a client icon: same hardened
`IconStore`, same 0600 files, decoded on the main loop. Identity avatars are
*not* behind `load-app-icons` — that switch is about a not-yet-trusted client's
URL — so the icon gc's live set grows to clients plus vault identities,
`forget_textures` clears the one-shot hydration claims it used to leave behind,
and removing a key forgets its avatar immediately. The switcher, the identities
list, the Connect dialog and the approval dialog's "Signing as" field draw it;
the Apps page's row stays text-only (that avatar was dropped deliberately in
d4bb9d5).
The gossip path in nostr-sdk was considered and rejected: its store is
in-process, it builds one filter per relay with the whole author set, and it
needs the same directory set anyway. Gitea issue #1.
list_for now orders an identity's apps by approved_at descending, so the
Apps page shows the app just paired at the top instead of wherever it
landed in apps.json. Whole-second timestamps tie, so the stable sort is
reversed to keep the later pairing first among equals; entries written
before approved_at existed carry 0 and sink to the bottom.
apps.json still stores insertion order — this is a view rule, and every
consumer of list_for (the Apps page, Forget all, the Connect dialog's
count, the identities window's revocation list) wants the same order.
The per-app detail row in the Apps page no longer carries an identity avatar.
The approval dialog and the Connect dialog keep theirs; the expanded details
row is back to plain text.
A client that sends no metadata — the bunker direction often sends none —
leaves only an npub, and there was no way to name it.
Add `App.label`, the user's own name, kept separate from the client's `name`:
`approve` rebuilds the entry on every pairing, so a label stored in `name`
would be lost the next time a metadata-less client reconnects. `display_name()`
prefers the label, and `AppRegistry::client()` returns it, so the approval
dialog and the activity log show what the user calls the app; a declared name
that differs stays visible as a "Declared name" row.
The "wants to connect" dialog asks for a name, right under "Application", when
the client declared none. The answer to a prompt becomes
`Answer { decision, name }` so the name reaches the responder's `approve`
(headless `--pair` passes none). `approve` preserves an existing label when the
dialog collected none.
The Apps page gets a per-app `view-more` menu — Rename… and Revoke — replacing
the visible Revoke suffix, and a rename dialog.
The approval dialog showed a client avatar on the "Application" field but no
identity avatar on "Signing as", and the Connect dialog's and the Apps page's
"Signing as" rows had none either.
Add `plain::avatar`/`plain::set_avatar` — initials of the name, or libadwaita's
glyph when there is none, with a cached image when there is one — and use it for
the client fields and the identity fields alike, so the identity's
avatar/placeholder is drawn exactly like a client application's. The Connect
dialog keeps its avatar widget and repoints it on refresh, since the row is
built once.
Identities have no cached image yet (fetching kind-0 pictures is a later
change), so they show initials for now; the texture lookup is already in place.
GNOME Shell's focus-stealing prevention shows a "<app> is ready" notification
instead of raising an already-mapped window that has no valid activation token;
only a window mapped for the first time is focused in the default `smart`
mode. That is why it only happened after adding the first identity: on first
run the identities window *is* the app and is already mapped, and once a key is
added the next "Manage identities" re-presents it.
Make the identities window transient for the main window while that is
visible, so it is focused together with its parent. With no visible main window
(first run, last key removed) it stays a standalone window, as before.
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.
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.
With both builds installed, both desktop files claimed
`x-scheme-handler/nostrconnect`, and the nightly deploy left the default
unset — so which app opened a link was decided by GIO's handler order, and
the nightly (whose vault has its own, often empty, identity) could end up
receiving links it could not pair.
The nightly desktop file no longer declares the scheme: system
integrations belong to the installed release. The nightly still accepts a
`nostrconnect://` argument (`HANDLES_OPEN`) and pairs through "Connect an
app…", it is just never the default handler.
GIO keeps honouring a `mimeapps.list` default even after the desktop file
stops claiming the scheme (verified), so `regent-deploy` also hands a stale
nightly association back by dropping the entry, leaving the stable build as
the only remaining handler.
Fix the second half too: a link-opened pairing presents no "Connect an app"
dialog, so `ConnectDialog::report_error` was parenting its alert to that
never-presented dialog (`self.window()` is `None`), and any failure — a bad
URI, or a build with no identity key — was silent. It now falls back to
`Windows::visible_parent()`, like every other pointer route.
A `-Dprofile=development` build is a separate application identity: the app
id carries a `.Devel` suffix, and the desktop file, AppStream id, icon,
GSettings schema id/path, GResource bundle name, D-Bus name and data
directories all follow, with a `regent-devel` binary so it installs beside
the stable one instead of replacing it. The Rust side switches `APP_ID` on
a cargo `devel` feature (a feature, not an env var, so the shared cargo
target dir cannot return a binary built for the other profile); the
metadata files become `.in` templates configured from `app_id`.
The nightly uses the banded nightly app icon and libadwaita's striped
`devel` header bar. The dev deploy selects it with
`REGENT_PROFILE=development`; the release `--pkg` build stays stable, and a
nightly install leaves the `nostrconnect://` scheme handler to the stable
build.
Two Meson details this depends on: the GResource prefix is fixed by
`resources.gresource.xml` (not the resource id) and is shared by both
profiles, and `gnome.compile_schemas()` scans the source directory, so the
generated schema is compiled by a `glib-compile-schemas` target instead.
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.
Connecting noStrudel by pasting Regent's bunker:// code showed "(unnamed)" and
no icon. noStrudel (through applesauce-signers) only sends client metadata in
the client-initiated direction: fromBunkerURI is called without metadata, so its
connect request is [remote, secret, perms] and there is no metadata for Regent to
read. That direction cannot be fixed here, but it should not render as broken.
- The approval dialog and the Apps row fall back to the shortened npub and build
the AdwAvatar with show_initials(false) instead of feeding the
"(unnamed)"/"Unnamed application" placeholder into the initials, which showed
as "(" / "U".
- parse_client_uri and client_info treat empty name/url/image (and perms) as
absent. Clients that always emit name=&url=&image=&perms= used to store
url: Some(""), which rendered an empty byline instead of the npub fallback.
- The approval dialog now fetches the client's declared icon before approval,
but only when load-app-icons is on. AppState::preview_icon is memory-only: no
disk cache is written for an unapproved app, so a denial leaves nothing behind.
This turns M11's blanket no-fetch-before-consent rule into a user setting.
Adds tests for empty query and connect metadata values.
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.
A proper AdwAboutDialog, reached from "About Regent" in the primary menu:
the app name and icon, the version, the author, a short description, the
Unlicense and a "Report an Issue" link, plus Source Code and a Nostr
(njump) link on the details page.
The author's credit row links to the same njump profile, and is titled
"Made by" rather than libadwaita's hardcoded "Code by" for the developers
list. The primary menu gains a divider before its configuration group.
The About dialog holds no state, so unlike Preferences and "Connect an
app" it is built per activation rather than kept around. The acceptance
test now drives app.about twice.
Register the scheme (x-scheme-handler/nostrconnect) in the desktop file, with
`Exec=regent %u`, so a clicked link is offered to Regent; `regent-deploy` sets
it as the default with `xdg-mime`, asking first if another app already handles
it.
The GUI claims G_APPLICATION_HANDLES_OPEN and pairs straight from a link's URI
over the main window, reusing the "Connect an app" flow (begin_pairing now takes
the widget to parent the approval dialog to). One trap: `run_with_args` passes
the slice as argv verbatim, so a lone URI became argv[0] — the program name —
and GApplication saw no file; it now prepends "regent".
The acceptance test checks that GIO resolves the scheme to Regent. The click
itself is desktop behaviour and is left to a real session.
Copying the public key from a row's menu left the popover open and gave no sign
that anything happened. A plain GtkPopover full of buttons does not close when
one is clicked — only menu items do — so close it after any action, and confirm
the copy with an AdwToast "Copied to clipboard" (libadwaita's own wording for a
copy).
The Connect dialog's connection-string copy button gets the same toast. Each
view gains an AdwToastOverlay to raise it, wrapped around its content.
The window offered a "Use for new pairings" menu item, a "Selected" badge and a
group description about new pairings. Choosing the current identity is the
header switcher's job, not this window's, and the selection machinery took
space and attention in a dialog that is only about managing keys now.
Remove the menu item, the badge and the description; drop the now-unused
`current` argument and `current_identity()` lookup; and stop listening for
registry changes, since that listener only existed to refresh the badge.
The approval dialog's "Signing as" field showed the key's name over its npub.
The npub is long and rarely read, so it now rides along as the name's tooltip;
the identities window still offers "Copy public key".
The values were rendered with selectable labels, and a selectable GtkLabel
selects its whole text the moment it takes focus — and a dialog focuses its
first focusable widget on open. So the first value (the identity name) opened
with a selection highlight behind it, drawn grey because focus had already
moved on to a response button. Make plain::label non-selectable: the values are
for reading. Measured under Broadway, the first selectable label reported
selection=(True,0,5); a non-selectable one reports none.
plain::label is used only by the approval dialog and the content preview, so
nothing else changes. The AGENTS.md convention note is updated with it.
Each field row was an independent box whose title label only set a minimum
width (width_chars 12), so a key longer than twelve characters — "Lightning
address", a long JSON key — gave that row a wider title column and pushed its
value to the right. Measured under Broadway, values sat at x=120 except the
long-key row at x=136.
Render the structured views as a two-column GtkGrid instead: titles in column
0, values in column 1, so column 0 is sized to the widest title and every value
starts at the same x. Applied to the inline content card, the preview's
formatted page, nested objects/arrays, and the Tags card. The title stays
capped at 20 characters so a long key wraps rather than squeezing the value,
and plain::field_title is now shared with the standalone field rows.
The kind was collapsed under Details, but it is part of what is being signed,
so it now sits with the payload — right after Application, before the content
and tags. Details keeps the client key and declared URL.
kind::name covered only nine kinds, so a relay list (10002) read as "event".
Fill it out with the well-known kinds (the NIP-51 lists, NIP-17/59 messaging,
NIP-28 channels, zaps, labels, calendar, community, …), keeping the names short
and lowercase. Unknown kinds still read "event".
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.