From 821d3884a3f554243e1aabea625c86049e2a4b23 Mon Sep 17 00:00:00 2001 From: Monserrat Mendoza <210256392+M0nsxx@users.noreply.github.com> Date: Sat, 7 Nov 2026 10:54:31 -0600 Subject: [PATCH] feat(cli): nirium anchor --sign - attach an agent attestation Adds --sign and --key-env to `nirium anchor`. Signs nirium-audit-v1: locally with ed25519 - the secret key (from --key-env or the config store's secretKey) never leaves this process, only the signature and derived public key do. 7 new tests with a fake agent server that verifies the signature for real (ed25519 over the same statement the real node checks), so a genuinely bad signature gets a real 400 and nothing is cataloged as anchored; the happy path round-trips through `nirium verify`, which reports SIGNATURE: VALID against the same key. Full suite 83/83. Closes #134 Co-Authored-By: Claude Sonnet 5 --- packages/cli/CHANGELOG.md | 1 + packages/cli/README.md | 19 +++ packages/cli/bin/nirium.js | 49 +++++- packages/cli/package.json | 2 +- packages/cli/test/anchor-sign.test.js | 215 ++++++++++++++++++++++++++ 5 files changed, 281 insertions(+), 5 deletions(-) create mode 100644 packages/cli/test/anchor-sign.test.js diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index e1dfe84..56faba9 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to the `nirium-cli` package are documented here. ### Added - `nirium anchor` ([#133](https://github.com/nirium-protocol/nirium/issues/133)): anchors a sha-256 hash (`--hash`), a file's sha-256 (`--file`, the file itself is never uploaded), or a small JSON record (`--record`, max 8KB, enforced client-side) to IPFS via an Audit Trail node's `POST /api/audit/log`. Optional `--tx`/`--tag`; no `--network` flag by design - the agent box decides its own network. Prints the CID, content hash, gateway URL, and a `nirium verify` suggestion. +- `nirium anchor --sign` ([#134](https://github.com/nirium-protocol/nirium/issues/134)): attaches an ed25519 attestation of which key produced the anchor. Signs `nirium-audit-v1:` locally with a key from `--key-env ` or the config store's `secretKey` - the secret key itself never leaves this process. A rejected signature gets a `400` and anchors nothing; `nirium verify` reports `SIGNATURE: VALID` on the round trip. ## 3.0.1 - 2026-10-24 diff --git a/packages/cli/README.md b/packages/cli/README.md index 58aa02a..a30c416 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -235,6 +235,8 @@ client-supplied network field is rejected server-side anyway. | `--record ` | anchor this small JSON object verbatim | none | | `--tx ` | associate a transaction hash | none | | `--tag