From ccc02004722de8fdcd1eaedf84bb04685d892af6 Mon Sep 17 00:00:00 2001 From: everbarry Date: Thu, 16 Apr 2026 01:29:59 +0200 Subject: [PATCH] add cli --- cli/README.md | 121 +++++ cli/pyproject.toml | 17 + cli/zkac_cli/__init__.py | 3 + .../__pycache__/__init__.cpython-314.pyc | Bin 0 -> 255 bytes .../__pycache__/client_ops.cpython-314.pyc | Bin 0 -> 3888 bytes .../__pycache__/creds.cpython-314.pyc | Bin 0 -> 6454 bytes .../__pycache__/issuance_util.cpython-314.pyc | Bin 0 -> 1617 bytes cli/zkac_cli/__pycache__/main.cpython-314.pyc | Bin 0 -> 29163 bytes .../__pycache__/paths.cpython-314.pyc | Bin 0 -> 1490 bytes .../registry_local.cpython-314.pyc | Bin 0 -> 4576 bytes .../__pycache__/registry_log.cpython-314.pyc | Bin 0 -> 4140 bytes .../__pycache__/server_app.cpython-314.pyc | Bin 0 -> 16150 bytes cli/zkac_cli/client_ops.py | 64 +++ cli/zkac_cli/creds.py | 84 ++++ cli/zkac_cli/issuance_util.py | 26 ++ cli/zkac_cli/main.py | 416 ++++++++++++++++++ cli/zkac_cli/paths.py | 19 + cli/zkac_cli/registry_local.py | 68 +++ cli/zkac_cli/registry_log.py | 59 +++ cli/zkac_cli/server_app.py | 272 ++++++++++++ 20 files changed, 1149 insertions(+) create mode 100644 cli/README.md create mode 100644 cli/pyproject.toml create mode 100644 cli/zkac_cli/__init__.py create mode 100644 cli/zkac_cli/__pycache__/__init__.cpython-314.pyc create mode 100644 cli/zkac_cli/__pycache__/client_ops.cpython-314.pyc create mode 100644 cli/zkac_cli/__pycache__/creds.cpython-314.pyc create mode 100644 cli/zkac_cli/__pycache__/issuance_util.cpython-314.pyc create mode 100644 cli/zkac_cli/__pycache__/main.cpython-314.pyc create mode 100644 cli/zkac_cli/__pycache__/paths.cpython-314.pyc create mode 100644 cli/zkac_cli/__pycache__/registry_local.cpython-314.pyc create mode 100644 cli/zkac_cli/__pycache__/registry_log.cpython-314.pyc create mode 100644 cli/zkac_cli/__pycache__/server_app.cpython-314.pyc create mode 100644 cli/zkac_cli/client_ops.py create mode 100644 cli/zkac_cli/creds.py create mode 100644 cli/zkac_cli/issuance_util.py create mode 100644 cli/zkac_cli/main.py create mode 100644 cli/zkac_cli/paths.py create mode 100644 cli/zkac_cli/registry_local.py create mode 100644 cli/zkac_cli/registry_log.py create mode 100644 cli/zkac_cli/server_app.py diff --git a/cli/README.md b/cli/README.md new file mode 100644 index 0000000..741fb30 --- /dev/null +++ b/cli/README.md @@ -0,0 +1,121 @@ +# zkac-node CLI + +Command-line interface for [ZKAC](../README.md) using the **Python bindings only** (`zkac` package). It runs a **registry-capable server** (management + client-managed registries + optional issuance relay) and **per-user** material under `~/.zkac/` (or `$ZKAC_HOME`). + +## Prerequisites + +- Python ≥ 3.9 +- The **`zkac`** extension built and installed from the repository root, for example: + + ```bash + cd /path/to/ZKAC + maturin develop + # or: pip install -e . + ``` + +## Installation + +```bash +cd /path/to/ZKAC/cli +pip install -e . +``` + +This installs the **`zkac-node`** console script. + +## Environment + +| Variable | Meaning | +|------------|---------| +| `ZKAC_HOME` | Base directory for users (default: `~/.zkac`). Each user lives at `$ZKAC_HOME//`. | + +## Server vs client + +- **Server** (`zkac-node serve`): a node that can **accept registry create/update** from an operator with the **`zkac.mgmt`** credential. It also serves **managed** sessions (BBS+ auth against stored client-managed registries) and optionally a **relay** port for blind issuance queues. +- **Client**: a **userid** with files under `$ZKAC_HOME//` (transport key, registries, credentials). + +## Ports (defaults) + +| Port role | Default | Purpose | +|------------|---------|---------| +| Management | 7400 | ZKAC + static role `zkac.mgmt`; JSON commands (create/update registry, issuance peek/grant). | +| Managed | 7401 | ZKAC + `RegistryManager`; member proves a role in a client-managed registry. | +| Relay | 7402 | Optional **plaintext** JSON line protocol for enqueue/poll of issuance requests. Use `--relay-port 0` on `serve` to disable. Binds with `--relay-bind` (default `127.0.0.1`). | + +## Layout on disk + +**Per user** (`$ZKAC_HOME//`): + +- `transport.json` — Ristretto **client** transport keypair (`zkac.Keypair`). +- `profile.json` — `userid` and metadata. +- `registries//` — one directory per logical registry: + - `admin.json` / `registry.json` — produced by `registry-init` (admin issuer material + public state + state cert). + - `roles/.json` — member credential payloads for `connect`. + - `issued/` — files from `issue-member` (handoff). +- `pending/.json` — saved by `issuance-request` until `issuance-poll` finalizes. +- `servers/