Rewrite the README and split out the docs #5

Merged
raucao merged 3 commits from doc/readme into main 2026-11-29 18:59:19 +00:00
4 changed files with 247 additions and 128 deletions

No files matched your search

+38 -126
View File
@@ -1,9 +1,21 @@
# Regent
<br>
A Nostr remote signer for GNOME. Applications ask Regent to sign events or to
encrypt/decrypt messages over [NIP-46](https://github.com/nostr-protocol/nips/blob/master/46.md);
the private key stays on your machine, and every request is shown to you before
it is answered.
<div align="center">
<img src="data/icons/hicolor/scalable/apps/org.kosmos.raucao.Regent.svg" width="128" height="128" alt="Regent app icon">
<h1>Regent</h1>
</div>
<br>
Regent is a [Nostr][1] remote signer ([NIP-46][2]) for GNOME and other Linux
desktops. Applications ask Regent to sign events or to encrypt and decrypt
messages, while your private key stays on your machine — and nothing is signed,
encrypted or decrypted without your approval, except what you've chosen to allow
automatically.
Regent can hold several keys at once and use them in parallel. Each application
you pair is bound to the identity it was approved under, so different apps can
sign as different keys at the same time.
## Status
@@ -11,134 +23,34 @@ Early development, but usable: NIP-46 pairing and approvals, per-app permissions
the activity log, multiple identities, and a NIP-49 encrypted key vault with a
passphrase (unlock once, then auto-lock). Packaging and polish are still ahead.
## Building
## Installation
```sh
cargo generate-lockfile # once, so --locked builds work
meson setup _build
meson compile -C _build
meson install -C _build # optional; needs to write to /usr/local
```
Regent is not packaged yet; an [AUR][3] package is planned. Until then, build it
from source — see [Development](doc/dev/development.md).
Run it from the build directory (`GSETTINGS_SCHEMA_DIR` is needed because the
schema is not installed system-wide yet; `REGENT_GRESOURCE` points at the
generated GResource):
## Repositories & Contributions
```sh
GSETTINGS_SCHEMA_DIR=_build/data \
REGENT_GRESOURCE=_build/data/resources/org.kosmos.raucao.Regent.gresource \
./_build/regent
```
The upstream repository is available on both Gitea and ngit (git over Nostr), and
issues and pull requests are accepted on either:
### Nightly (development) build
- Gitea: https://gitea.kosmos.org/raucao/regent
- ngit: https://gitworkshop.dev/raucao@kosmos.org/relay.ngit.dev/regent
A development build is a **separate application identity** — the app id carries a
`.Devel` suffix, so the desktop file, icon, GSettings schema, GResource bundle,
D-Bus name and data directories all follow, and the binary is `regent-devel`.
That lets it install and run beside the stable one:
## Documentation
```sh
meson setup _build -Dprofile=development
meson compile -C _build
GSETTINGS_SCHEMA_DIR=_build/data \
REGENT_GRESOURCE=_build/data/resources/org.kosmos.raucao.Regent.Devel.gresource \
./_build/regent-devel
```
The nightly uses the banded nightly app icon and libadwaita's striped `devel`
header bar, so it is obvious at a glance which build you are looking at.
Headless check (no display needed — useful on servers and in CI):
```sh
dbus-run-session -- sh -c \
'gtk4-broadwayd :5 & sleep 1; \
GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 \
GSETTINGS_SCHEMA_DIR=_build/data \
REGENT_GRESOURCE=_build/data/resources/org.kosmos.raucao.Regent.gresource \
./_build/regent'
```
## Running without a window
Regent can run the signer with no window at all, including on a machine with no
display and no session bus:
```sh
regent --headless
```
Anything not already allowed with "Allow always" is denied — with no window there
is nobody to ask, so pre-approve permissions in the GUI first.
`get_public_key`, `ping` and `get_relays` are still answered automatically.
Your identity keys are stored NIP-49 encrypted under a passphrase, and a locked
vault refuses to sign. Unlock it for an unattended run with a passphrase file
(mode `0400`/`0600`), or with a systemd credential named `regent-passphrase`:
```sh
regent --headless --passphrase-file /run/credentials/regent-passphrase
```
To pair a client without opening the GUI, pass the `nostrconnect://` string the
client shows (the client-initiated flow). Regent joins the client's relays, sends
the connect response, remembers the application, then keeps running headless.
Pairing needs no identity key, so it works while the vault is locked:
```sh
regent --pair 'nostrconnect://…'
```
A graphical client usually shows that string as a QR code; the
`nostrconnect://` URI is its text form. Permissions are never granted
automatically, so a freshly paired application can only ask — approve what it
may do with "Allow always" in the GUI. `regent --help` lists the options.
## Testing on another machine
The build host compiles; you test on the workstation it should actually run on.
`build-aux/deploy-dev.sh` runs on the build host and `build-aux/regent-deploy.sh`
on the workstation; a build is moved with the workstation *pulling*, so nothing
new listens for connections anywhere.
Install the wrapper once, on the workstation:
```sh
mkdir -p ~/.local/bin
ssh nuc-zt 'cat ~/src/regent/build-aux/regent-deploy.sh' > ~/.local/bin/regent-deploy
chmod +x ~/.local/bin/regent-deploy
```
Then, after every change:
```sh
regent-deploy
```
The wrapper keeps itself current: before doing anything it fetches its own copy
from the build host and re-execs if it changed, so the one-time install above
never goes stale. (`REGENT_DEPLOY_NO_UPDATE=1` skips that, and the previous copy
is kept as `regent-deploy.bak`.)
That asks the build host which GTK/libadwaita it builds against, warns if the two
machines have drifted (a mismatch surfaces as a symbol lookup error), pulls the
install tree, unpacks it into `~/.local` (no root needed), recompiles the
GSettings schema, and prints the version it installed. `REGENT_DEPLOY_PKG=1
regent-deploy` builds and installs a real `regent-git` package instead (asks for
`sudo`). `REGENT_PROFILE=development regent-deploy` installs the nightly identity
instead — `regent-devel`, its own desktop file and data directories — so it runs
beside a stable install rather than replacing it. Only the stable build handles
`nostrconnect://` links; the nightly never takes that association over.
Directly on the build host, without a workstation:
```sh
build-aux/deploy-dev.sh # write a tarball to /tmp/regent-dev/
build-aux/deploy-dev.sh --pkg # build the regent-git pacman package
build-aux/deploy-dev.sh --versions # GTK/libadwaita this host builds against
build-aux/deploy-dev.sh --help
```
- [Development](doc/dev/development.md) — prerequisites, building, running, tests
and deployment
- [Advanced usage](doc/advanced.md) — running the signer without a window and
pairing from the CLI
## License
[Unlicense](LICENSE) — public domain.
## Contact
E-Mail, Chat, Social, Lightning: [raucao@kosmos.org](mailto:raucao@kosmos.org)
[1]: https://nostr.org
[2]: https://github.com/nostr-protocol/nips/blob/master/46.md
[3]: https://aur.archlinux.org/
+6 -2
View File
@@ -12,7 +12,7 @@
# # beside the stable one (regent-devel)
#
# Environment:
# REGENT_BUILD_HOST ssh target of the build host (default: nuc-zt)
# REGENT_BUILD_HOST ssh target of the build host (required)
# REGENT_REPO_PATH repo path on the build host (default: ~/src/regent)
# REGENT_PROFILE `default` (stable) or `development` (nightly `.Devel`);
# see meson.options. The nightly installs as `regent-devel`
@@ -20,7 +20,7 @@
# runs alongside a stable install instead of replacing it.
set -euo pipefail
HOST=${REGENT_BUILD_HOST:-nuc-zt}
HOST=${REGENT_BUILD_HOST:-}
REPO=${REGENT_REPO_PATH:-'~/src/regent'}
REMOTE="$REPO/build-aux/deploy-dev.sh"
REMOTE_SELF="$REPO/build-aux/regent-deploy.sh"
@@ -46,6 +46,10 @@ case "$PROFILE" in
;;
esac
# The build host has no sensible default — it used to fall back to a specific
# machine, which silently only ever worked there. Require it instead.
[ -n "$HOST" ] || die "REGENT_BUILD_HOST is not set — point it at your build host's ssh target (e.g. user@build-host)"
# Keep this script current.
#
# It is installed as a *copy*, so without this it silently keeps running whatever
+41
View File
@@ -0,0 +1,41 @@
# Advanced usage
For power users: running the signer with no window at all, and pairing a client
without opening the GUI.
## Running without a window
Regent can run the signer with no window at all, including on a machine with no
display and no session bus:
```sh
regent --headless
```
Anything not already allowed with "Allow always" is denied — with no window there
is nobody to ask, so pre-approve permissions in the GUI first. `get_public_key`,
`ping` and `get_relays` are still answered automatically.
Your identity keys are stored NIP-49 encrypted under a passphrase, and a locked
vault refuses to sign. Unlock it for an unattended run with a passphrase file
(mode `0400`/`0600`), or with a systemd credential named `regent-passphrase`:
```sh
regent --headless --passphrase-file /run/credentials/regent-passphrase
```
## Pairing a client from the CLI
To pair a client without opening the GUI, pass the `nostrconnect://` string the
client shows (the client-initiated flow). Regent joins the client's relays, sends
the connect response, remembers the application, then keeps running headless.
Pairing needs no identity key, so it works while the vault is locked:
```sh
regent --pair 'nostrconnect://…'
```
A graphical client usually shows that string as a QR code; the `nostrconnect://`
URI is its text form. Permissions are never granted automatically, so a freshly
paired application can only ask — approve what it may do with "Allow always" in
the GUI. `regent --help` lists the options.
+162
View File
@@ -0,0 +1,162 @@
# Development
How to build Regent, run it from a build tree, and test it.
> Scope: local setup, building, running, tests and deployment. For running the
> signer unattended and pairing a client from the command line, see
> [Advanced usage](../advanced.md).
## Prerequisites
You will need the following things properly installed on your computer.
- [Rust](https://rustup.rs/) (`cargo`)
- [Meson](https://mesonbuild.com/) and [Ninja](https://ninja-build.org/)
- GTK 4 and libadwaita development headers
- [blueprint-compiler](https://gitlab.gnome.org/GNOME/blueprint-compiler)
- `appstreamcli` and `desktop-file-validate` (for the validation commands below)
- [`nak`](https://github.com/fiatjaf/nak) (optional; only for the relay-level
tests and the acceptance script)
On Arch Linux:
```sh
pacman -S rust meson ninja gtk4 libadwaita blueprint-compiler appstream
```
## Building
```sh
cargo generate-lockfile # once, so --locked builds work
meson setup _build
meson compile -C _build
meson install -C _build # optional; needs to write to /usr/local
```
Run it from the build directory (`GSETTINGS_SCHEMA_DIR` is needed because the
schema is not installed system-wide yet; `REGENT_GRESOURCE` points at the
generated GResource):
```sh
GSETTINGS_SCHEMA_DIR=_build/data \
REGENT_GRESOURCE=_build/data/resources/org.kosmos.raucao.Regent.gresource \
./_build/regent
```
## Nightly (development) build
A development build is a **separate application identity** — the app id carries a
`.Devel` suffix, so the desktop file, icon, GSettings schema, GResource bundle,
D-Bus name and data directories all follow, and the binary is `regent-devel`.
That lets it install and run beside the stable one:
```sh
meson setup _build -Dprofile=development
meson compile -C _build
GSETTINGS_SCHEMA_DIR=_build/data \
REGENT_GRESOURCE=_build/data/resources/org.kosmos.raucao.Regent.Devel.gresource \
./_build/regent-devel
```
The nightly uses the banded nightly app icon and libadwaita's striped `devel`
header bar, so it is obvious at a glance which build you are looking at.
> Cargo is driven by Meson (`custom_target`). **Every source file must be listed
> as an input** in `meson.build`, otherwise edits don't trigger a rebuild.
## Testing
The unit and integration tests run on a plain `cargo test`:
```sh
cargo test
```
The relay-level `nak_*` tests are ignored by default and need a real relay. Each
spins up its own local `nak serve`, and together they cover the NIP-46 approval
paths end to end:
```sh
CARGO_TARGET_DIR=_build/cargo-target REGENT_TEST_RELAY=wss://nostr.kosmos.org \
cargo test --release -- --ignored --nocapture nak
```
There is also a full end-to-end check (vault → responder → app) in a throwaway
HOME, using `gtk4-broadwayd` and `nak`:
```sh
dbus-run-session -- build-aux/acceptance.sh
```
## Validating the package metadata
```sh
appstreamcli validate --no-net _build/data/org.kosmos.raucao.Regent.metainfo.xml
desktop-file-validate _build/data/org.kosmos.raucao.Regent.desktop
glib-compile-schemas --strict --dry-run _build/data/
```
## Deploying to another machine
If you build on one machine and run on another — a fast build host and the desktop
you test on — two helper scripts move a build across. `build-aux/deploy-dev.sh`
runs on the build host; `build-aux/regent-deploy.sh` runs on the machine you test
on. The test machine *pulls* the build over SSH, so neither side has to listen for
inbound connections. You need SSH from the test machine to the build host.
Install the wrapper once, on the test machine:
```sh
mkdir -p ~/.local/bin
ssh BUILD_HOST 'cat PATH/TO/regent/build-aux/regent-deploy.sh' > ~/.local/bin/regent-deploy
chmod +x ~/.local/bin/regent-deploy
```
Then point it at your build host and repository path — either export them or edit
the script:
```sh
export REGENT_BUILD_HOST=user@build-host # required
export REGENT_REPO_PATH='~/src/regent' # default: ~/src/regent
```
After every change, on the test machine:
```sh
regent-deploy
```
It asks the build host which GTK/libadwaita it builds against and warns if the two
machines have drifted (a mismatch surfaces later as a symbol lookup error), pulls
the install tree, unpacks it into `~/.local` (no root needed), recompiles the
GSettings schema, and prints the version it installed. The wrapper keeps itself
current — it fetches its own copy from the build host and re-execs if it changed,
so the one-time install above never goes stale (`REGENT_DEPLOY_NO_UPDATE=1` skips
that; the previous copy is kept as `regent-deploy.bak`).
Options:
- `REGENT_DEPLOY_PKG=1 regent-deploy` — build and install a real `regent-git`
package instead (asks for `sudo`).
- `REGENT_PROFILE=development regent-deploy` — install the nightly `.Devel`
identity instead; it has its own app id, desktop file and data directories, so
it runs beside a stable install rather than replacing it.
Directly on the build host, with no test machine:
```sh
build-aux/deploy-dev.sh # write a tarball to /tmp/regent-dev/
build-aux/deploy-dev.sh --emit # stream the install tree to stdout
build-aux/deploy-dev.sh --pkg # build the regent-git pacman package
build-aux/deploy-dev.sh --versions # GTK/libadwaita this host builds against
build-aux/deploy-dev.sh --help
```
## Further reading
- [GTK 4 documentation](https://docs.gtk.org/gtk4/)
- [libadwaita](https://gnome.pages.gitlab.gnome.org/libadwaita/)
- [GNOME Human Interface Guidelines](https://developer.gnome.org/hig/)
- [Blueprint](https://jwestman.pages.gitlab.gnome.org/blueprint-compiler/)
- [NIP-46](https://github.com/nostr-protocol/nips/blob/master/46.md)
- [NIP-49](https://github.com/nostr-protocol/nips/blob/master/49.md)