v0.0.5 - Add CLIENT_IMPLEMENTATION.md agent integration spec

This commit is contained in:
Laan Tungir
2026-05-02 16:19:05 -04:00
parent ee0c60c343
commit 3e86e539e0
19 changed files with 5797 additions and 112 deletions

View File

@@ -74,7 +74,7 @@ When started, `n_signer` immediately enters terminal input mode:
- On `E`: prompt for mnemonic with terminal echo disabled, then validate.
- On `G`: generate a fresh 12-word BIP-39 mnemonic from `getrandom(2)`, display it numbered with a "WRITE THIS DOWN — IT WILL NOT BE SHOWN AGAIN" warning, then continue. There is no confirmation step.
2. Build in-memory role/selector state from the mnemonic.
3. Pick the abstract socket name (random BIP-39 pair, or `--socket-name` override).
3. Pick the abstract socket name (random BIP-39 pair, or `--socket-name` / `--name` / `-n` override).
4. Initialize transport endpoints and bind the socket.
5. Switch to running status display, with the signer name and socket address shown in the banner.
@@ -108,9 +108,9 @@ Activity (latest first)
Hotkeys
-------
a add role
a toggle auto-approve(prompt) for this session
r refresh
l lock session
l lock/reunlock session
q quit
```
@@ -127,7 +127,7 @@ method: sign_event
selector: role=ops
purpose/curve: nostr/secp256k1
[y] allow once [n] deny [a] always allow for this session
[y] allow once [n] deny [a] always allow this session
```
No response is emitted to caller until the local user decides.
@@ -173,6 +173,13 @@ Request shape is JSON-RPC with NIP-46-style methods and optional trailing select
{ "id": "4", "method": "sign_event", "params": ["<event_json>", { "role_path": "m/84'/0'/0'/0/5", "purpose": "bitcoin", "curve": "secp256k1" }] }
```
Implemented signer verbs in this build:
- `get_public_key`
- `sign_event`
- `nip04_encrypt` / `nip04_decrypt`
- `nip44_encrypt` / `nip44_decrypt`
Selector resolution order:
1. `role`
@@ -224,8 +231,8 @@ Properties:
Naming rules:
- Default: random pick at startup, displayed in the TUI banner.
- Override: `--socket-name <name>` forces a specific name (useful for scripts and tests).
- Collision: if the chosen random name is already bound by another process, `nsigner` retries with a fresh pair up to 8 times before erroring out with a hint to use `--socket-name`.
- Override: `--socket-name <name>` (alias: `--name <name>` / `-n <name>`) forces a specific name (useful for scripts and tests).
- Collision: if the chosen random name is already bound by another process, `nsigner` retries with a fresh pair up to 8 times before erroring out with a hint to use an explicit name override.
Discovery:
@@ -278,7 +285,7 @@ Program starts in attached foreground mode and prompts for mnemonic. After mnemo
To force a specific socket name (e.g. for scripted clients):
```bash
nsigner --socket-name my_test_signer
nsigner --name my_test_signer
```
### 9.2 Send a request (client mode)
@@ -286,7 +293,7 @@ nsigner --socket-name my_test_signer
From another terminal, target the signer by its socket name:
```bash
nsigner client --socket-name nsigner_hairy_dog '{"id":"1","method":"get_public_key","params":[]}'
nsigner --socket-name nsigner_hairy_dog client '{"id":"1","method":"get_public_key","params":[]}'
```
If only one signer is running you can omit the override and the client will use the default discovery rule.
@@ -294,7 +301,7 @@ If only one signer is running you can omit the override and the client will use
Example signing request:
```bash
nsigner client --socket-name nsigner_hairy_dog '{"id":"2","method":"sign_event","params":["<event_json>",{"role":"main"}]}'
nsigner -n nsigner_hairy_dog client '{"id":"2","method":"sign_event","params":["<event_json>",{"role":"main"}]}'
```
### 9.3 List running signers
@@ -327,7 +334,7 @@ $ nsigner
Terminal B:
```text
$ nsigner client --socket-name nsigner_hairy_dog '{"id":"2","method":"sign_event","params":["<event_json>",{"role":"main"}]}'
$ nsigner --socket-name nsigner_hairy_dog client '{"id":"2","method":"sign_event","params":["<event_json>",{"role":"main"}]}'
{"id":"2","result":"<signed_event_json>"}
```
@@ -339,13 +346,13 @@ Build outputs a single executable artifact.
- [`Makefile`](Makefile): local build targets
- [`Dockerfile.alpine-musl`](Dockerfile.alpine-musl): reproducible Alpine musl toolchain
- [`increment_and_push.sh`](increment_and_push.sh): version/tag/release workflow
- [`src/main.h`](src/main.h): version macros
- [`src/main.c`](src/main.c): version macros (`NSIGNER_VERSION*`)
Local dev build:
```bash
make dev
./build/nsigner_dev --version
./build/nsigner --version
```
Static build: