Commit Graph
141 Commits
Author SHA1 Message Date
raucao 9d861d41ac signer: let the user remember a decryption
CI / test (push) Successful in 1m21s
CI / test (pull_request) Successful in 1m20s
An approved chat client re-reads its whole message history on every launch, so
refusing to remember a "yes" produced a prompt per message. That is prompt
fatigue rather than a control: it trains the user to click through, and the
prompts it trains them through include the ones that matter.

"Always" now stores a `Permission::Method` for `nip04_decrypt` / `nip44_decrypt`
exactly as it already did for encryption — per application and per method, so a
NIP-44 grant never silently answers NIP-04. The dialog discloses the scope in an
above-the-fold banner (every peer, and older messages fetchable from any relay),
the Apps page lists the grant as a removable permission, every silent answer is
recorded in the activity log, and the auto-approval rate limit still bounds a
silent stream. The vault gate is unchanged: a granted decrypt on a locked vault
still raises the unlock prompt, and headless still denies while locked.

The grant is deliberately not peer-scoped: a NIP-17 gift wrap is signed by a
fresh ephemeral key per message, so a peer-scoped rule would match only the
inner seal and still prompt for every wrapper.

The disclosure banners are warning-tinted. libadwaita tints an `AdwBanner`
through its `--banner-color` variable, and its own `.warning` class changes
nothing on a banner (it only recolours the foreground, which the banner's inner
widget overrides) — so `style.css` maps the class to `--warning-bg-color` and
rounds the corners.
2026-12-01 12:14:32 +04:00
raucao 60d80a7591 ui: let Enter submit the field-based dialogs
CI / test (push) Successful in 1m18s
The AdwAlertDialog forms put their field in extra-child and relied on
set_default_response alone, but a GtkText/GtkEntry consumes Return unless
activates-default is set — so the default action was reachable only with the
pointer. Opt in on unlock, export, change passphrase and both rename dialogs,
and record the trap in AGENTS.md.
2026-12-01 11:12:38 +04:00
raucao b2519f6214 ui: credit the project's dependencies in About
CI / test (push) Successful in 47s
A "Built with" section beside "Made by": the Nostr Dev Kit (formerly
rust-nostr), GTK, libadwaita, Rust and tokio, each a link row the same way
the author credit is. The README already thanks the Nostr Dev Kit in its
Acknowledgements section; this is the same credit where users look for it.
2026-11-30 23:04:15 +04:00
raucao f3043065f7 Add acknowledgements to README
CI / test (push) Successful in 48s
2026-11-30 22:46:36 +04:00
raucao a2f52baca8 Post-release: point the AUR recipe at 0.9.1
CI / test (push) Successful in 53s
2026-11-30 20:03:24 +04:00
raucao b57e3b0fc8 Release 0.9.1
CI / test (push) Successful in 48s
v0.9.1
2026-11-30 19:59:04 +04:00
raucao 59392e5add build: disable makepkg's C-flag LTO in all PKGBUILDs
CI / test (push) Successful in 48s
makepkg's default `lto` option appends `-flto=auto` to CFLAGS, CXXFLAGS and
LDFLAGS. ring and secp256k1-sys compile their C through the `cc` crate, which
honours CFLAGS, so their objects became GCC slim-LTO bytecode. rustc's final
link never passes `-flto`, so GCC's LTO plugin did not run and lld reported
every C symbol as undefined:

  undefined symbol: rustsecp256k1_v0_10_0_ec_seckey_verify
  undefined symbol: ring_core_0_17_14__LIMB_is_zero
  ...

The AUR build failed while a plain cargo/meson build on the same machine (the
dev deploy, CI) linked fine, because only makepkg rewrites CFLAGS.

Set `options=('!lto')` in the stable, -git and working-tree PKGBUILDs. That
only turns off makepkg's C-flag-level LTO; Rust's own `lto = true` from
Cargo.toml is unaffected. Note the comment in AGENTS.md.
2026-11-30 19:21:47 +04:00
raucao d0fdc5bde0 Post-release: point the AUR recipe at 0.9.0
CI / test (push) Successful in 48s
2026-11-30 18:02:02 +04:00
raucao 11838c37df Release 0.9.0
CI / test (push) Successful in 50s
v0.9.0
2026-11-30 17:46:37 +04:00
raucao c4f0ef8c1a ui: refresh the About dialog's links and license
CI / test (push) Successful in 48s
Link the trademark policy from the license text, on the word "trademarks",
and make the trademark sentence its own paragraph. Point "Report an issue"
and a new "Source Code (on Nostr)" row at the ngit repository, and add an
"Email" row. Drop the separate Trademark Policy and Nostr rows: the policy
is now inline, and the author credit already links the Nostr profile.
2026-11-30 17:22:23 +04:00
raucao 30053efac7 release: prepare the 0.9.0 first release
Update the README for a pre-1.0 (0.x) first release: the current version is
0.9.0, the sub-1.0 number means the interface is not yet stable, and the
completed internal security review is noted as a self-review rather than an
independent audit. Replace the "1.0 beta" wording in Installation.

Write the 0.9.0 release notes under [Unreleased] (release.sh prepare renames
the heading and stamps the date) and drop the never-released 0.1.0 snapshot
section. Refresh the illustrative version in the release docs and tooling.
2026-11-30 16:34:44 +04:00
raucao 224e36d295 Merge pull request 'Set the vault passphrase before the first key (first-run onboarding)' (#9) from feature/onboarding into main
CI / test (push) Successful in 47s
Reviewed-on: #9
2026-11-30 12:19:36 +00:00
raucao 94e716446f ui: tidy the import dialog and the first-run vault step
CI / test (push) Successful in 50s
CI / test (pull_request) Successful in 48s
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.
2026-11-30 16:14:19 +04:00
raucao 787931898c store: name the wrong passphrase, not the raw crypto error
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.
2026-11-30 16:14:14 +04:00
raucao 969154d790 keys: set the vault passphrase before the first key
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.
2026-11-30 15:28:33 +04:00
raucao cd666e6fb2 Merge pull request 'Pre-1.0 security review: remediate all findings' (#8) from chore/security_review into main
CI / test (push) Successful in 1m40s
Reviewed-on: #8
2026-11-30 08:21:34 +00:00
raucao 55e1155e8e ci: document the runner setup (I3)
CI / test (push) Successful in 1m43s
CI / test (pull_request) Successful in 49s
The cache only works when the job container shares the host network (a
bridge job cannot reach the runner's cache server through a host
firewall); record that, force_pull and node_download so the runner can be
rebuilt without rediscovering them.
2026-11-30 11:34:19 +04:00
raucao 1ee4930f2b ci: run the job on a custom Arch image (I3)
CI / test (push) Successful in 3m40s
CI / test (pull_request) Successful in 49s
The ubuntu-latest runner image ships GTK 4.22, which cannot satisfy the
crate's v4_24/v1_10 features (they want GTK >= 4.23 / libadwaita >= 1.10,
newer than the latest stable GNOME release), so the first CI run failed
compiling gdk4-sys. The GNOME OS SDK is no better.

Build a regent-ci image (build-aux/ci/) from Arch with the GTK/libadwaita
headers, a rustup-pinned toolchain and the static cargo-deny binary baked
in, register a repo-level runner with the matching label, and drop the
apt/rustup/install-action steps.

Bump url to 2.5.9 (RUSTSEC-2026-0592), which the cargo-deny step would
otherwise fail on.
2026-11-30 11:18:36 +04:00
raucao b42f9b925a chore: fix the clippy gate, guard the vault version, add CI (I3)
CI / test (pull_request) Failing after 2m31s
CI / test (push) Failing after 2m41s
2026-11-30 10:31:00 +04:00
raucao 4076f6707b approval: disclose NIP-04 requests with a legacy banner (I2) 2026-11-30 10:31:00 +04:00
raucao 5e071a8d9e main: read the pairing URI from stdin with --pair - (I1) 2026-11-30 10:31:00 +04:00
raucao b5a88b6c4c icons: bound inline data URLs before decoding (L7) 2026-11-30 10:31:00 +04:00
raucao fc4eab35c9 store: create private (0700) directories (L6) 2026-11-30 10:31:00 +04:00
raucao f4487f4425 headless: refuse shared passphrase files; wipe secret buffers (L5) 2026-11-30 10:31:00 +04:00
raucao e67963d86b signer: serialize the pairing dialog through the approval queue (L4) 2026-11-30 10:31:00 +04:00
raucao 6e1f35ef62 store: pin the unlocked-vault gate for change/export (L3) 2026-11-30 10:31:00 +04:00
raucao 9c886b7493 ui: confirm export passwords, mask imports, expire copied secrets (L2) 2026-11-30 10:31:00 +04:00
raucao 910554c8d6 signer: rotate the pairing secret on every new pairing (L1) 2026-11-30 10:31:00 +04:00
raucao b4fe138641 store: serialize vault mutations and write unique temp files (M9) 2026-11-30 10:31:00 +04:00
raucao 0f983ff558 signer: drop strangers silently and dispatch with bounded concurrency (M8) 2026-11-30 10:31:00 +04:00
raucao 75f4998ced sanitize: strip control and bidi characters from client text (M7) 2026-11-30 10:31:00 +04:00
raucao 5d750fb0d3 policy: share the auto-approval limit with the running signer (M6) 2026-11-30 10:31:00 +04:00
raucao 5a9fc6ee18 state: lock the vault on suspend and count sleep in the auto-lock (M5) 2026-11-30 10:31:00 +04:00
raucao 35c52c12cf signer: validate client relays and scope responses to the arrival relay (M3) 2026-11-30 10:31:00 +04:00
raucao dd089e1855 app: take an unconditional single-instance lock (M4)
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.
2026-11-30 10:31:00 +04:00
raucao 8df0357d13 icons: harden the HTTPS fetch against SSRF (M2)
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.
2026-11-30 10:31:00 +04:00
raucao c435fccd8f signer: store a permission only once the request is answered (M1)
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.
2026-11-30 10:31:00 +04:00
raucao 890f934e4a icons: gate image dimensions before decoding (H3)
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.
2026-11-30 10:31:00 +04:00
raucao 55f069e978 approval: disclose what sign_event/encrypt cannot show in full (H2)
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.
2026-11-30 10:31:00 +04:00
raucao a5a1788319 signer: drop replayed and stale NIP-46 requests (H1)
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.
2026-11-30 10:31:00 +04:00
raucao 12b78c848c Merge pull request 'Add the release tooling (Gitea + AUR + Nostr)' (#7) from dev/releases into main
Reviewed-on: #7
2026-11-29 20:35:06 +00:00
raucao 3cb7cb617f Release signing: GPG for the tag and tarball, SSH for the commit
Corrects the signing scheme. The release itself — the annotated tag and a
detached signature over the tarball — is GPG-signed; the release commit is
SSH-signed. Because the GPG key lives on a laptop and the build runs on the
build host, the single script becomes three stages split across two machines:

  prepare <ver>  build host: bump, build, meson dist, SSH-signed commit
  sign    <ver>  laptop:     GPG-sign the tarball and the tag
  publish <ver>  laptop:     Gitea release, AUR, Nostr

The GPG key never touches the build host, and only dist/ travels: the laptop
pulls it over SSH. The two signing formats are set per git command
(-c gpg.format=ssh|openpgp), so neither depends on a machine's global config.

- release.sh: prepare/sign/publish subcommands; SSH commit, GPG tag + detached
  tarball signature; REGENT_SSH_SIGNING_KEY / REGENT_GPG_KEY; a release.env
  handoff that pins the tagged commit; optional dist/ pull.
- AUR regent: the .asc in source and validpgpkeys pinned to _fingerprint.
- .ngit/release.yaml: the .asc and an exported public key, replacing the SSH
  .sig and allowed_signers.
- README, doc/dev/releasing.md, AGENTS.md updated for the split.
2026-11-30 00:28:52 +04:00
raucao ba3d07d7d7 Move the release docs into doc/dev/releasing.md
The release process is a maintainer's job, not part of local development, so it
gets its own document. development.md now just points at it (and the README's
documentation list gains an entry).
2026-11-30 00:08:54 +04:00
raucao 07a7976711 Add the release tooling (Gitea + AUR + Nostr)
build-aux/release.sh cuts a release from main: it bumps the version in
meson.build/Cargo.toml/Cargo.lock, generates the AppStream release entry from
CHANGELOG.md, builds and signs the distribution tarball, tags it, and publishes
to Gitea (gt release create), the AUR, and Nostr (ngit release publish). Every
outward-facing step is skippable (--no-push/--no-release/--no-aur/--no-nostr),
so a build can be prepared and reviewed before it goes anywhere.

Signing is SSH-only (git's gpg.format=ssh): an annotated tag plus an
ssh-keygen -Y sign detached signature over the tarball. That lets the key stay
on a laptop — run the script under ssh -A and the forwarded agent signs, so the
key material never lands on the build host.

Also:
- CHANGELOG.md: the single source of release notes (Keep a Changelog).
- build-aux/gen-metainfo-releases.py: generates the metainfo <releases> block
  from it, translating the version dialect (1.0.0-beta.1 -> 1.0.0~beta.1, with
  type=development) and exposing --notes for the release notes text.
- build-aux/aur/{regent,regent-git}: the AUR recipes (release tarball and VCS).
- build-aux/regent-dev: the working-tree package, renamed from regent-git to
  make room for the AUR regent-git; deploy-dev.sh --pkg builds this one.
- .ngit/release.yaml: the NIP-82 release manifest (Blossom mirror at
  blossom.kosmos.org), replacing the hand-rolled NIP-94/30063/32267 plan.
- Docs: README (install + verify), doc/dev/development.md (Releasing),
  AGENTS.md (Releases).

This adds tooling only: it cuts no tag and publishes nothing.
2026-11-29 23:57:07 +04:00
raucao 0d9aaad3da Note the canonical Gitea repo and its Nostr mirror
The repo is announced on Nostr now (NIP-34, through `ngit`), so the notes say
which side is which: `origin` is Gitea and every branch tracks it, Gitea is
advertised in the announcement as both the homepage and a clone URL, and pushing
a branch to Nostr is the separate `git push nostr` that also copies the git data
to the GRASP hosts. Also records the two repo relays (repo events go nowhere
else), and the `ngit init` trap that renames the Gitea remote to `gitea-kosmos`
and points `origin` at Nostr. The header no longer calls the repo private — it
isn't.
2026-11-29 23:32:37 +04:00
raucao 1b981212fb Merge pull request 'Add a trademark policy for the name and logo' (#6) from chore/license into main
Reviewed-on: #6
2026-11-29 19:21:42 +00:00
raucao 3b12bc6a9c Add a trademark policy for the name and logo
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.
2026-11-29 23:18:45 +04:00
raucao 03656db08c Re-fetch a profile on demand, and let an equal kind-0 fill in new fields
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.
2026-11-29 23:05:58 +04:00
raucao 681e112803 Merge pull request 'Rewrite the README and split out the docs' (#5) from doc/readme into main
Reviewed-on: #5
2026-11-29 18:59:18 +00:00
raucao e9f587c43a Require REGENT_BUILD_HOST instead of defaulting to a specific machine
The wrapper fell back to one hard-coded build host when the variable was
unset, so it silently only worked on that one machine. It now exits with a
clear message pointing at the variable, and the dev doc marks it required
(REGENT_REPO_PATH keeps its `~/src/regent` default).
2026-11-29 22:55:26 +04:00