Rewrite the README in Marco's style and split out the docs
The README mixed a short introduction with the build steps, the nightly build, headless mode, CLI pairing and the two-machine deploy workflow, all in one file. It now opens with the app icon and a prose description, then Status, Installation (build from source for now, AUR planned), Repositories & Contributions (Gitea and ngit), Documentation, License and Contact — the shape Marco's README uses. The build, test, validation and dev-deploy material moves to doc/dev/development.md, and headless mode plus `regent --pair` to doc/advanced.md, both linked from the README. The description is also more accurate: Regent runs on GNOME and other Linux desktops (not GNOME only), requests covered by an "Allow always" permission are answered without a prompt (so not *every* request is shown), and several keys can be held and used in parallel.
This commit is contained in:
3 files changed
+230
-126
No files matched your search
@@ -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/
|
||||
@@ -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.
|
||||
@@ -0,0 +1,151 @@
|
||||
# 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/
|
||||
```
|
||||
|
||||
## 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
|
||||
```
|
||||
|
||||
## 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)
|
||||
Reference in new issue
Block a user