Repository navigation
feat(cli): nirium anchor --sign (re-land, #264 merged to the wrong branch) - #268
Merged
Merged
Conversation
Adds --sign and --key-env <VAR> to `nirium anchor`. Signs nirium-audit-v1:<content_sha256> 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 <noreply@anthropic.com>
Eras256
approved these changes
Nov 7, 2026
Eras256
left a comment
Collaborator
There was a problem hiding this comment.
Approving - re-lands #264's content directly against main this time (the original merged into the now-gone issue-133-anchor branch instead). Same spec: ed25519 attestation over nirium-audit-v1:<content_sha256>, key never leaves the machine or gets printed, throwaway Keypair.random() in tests. 106/106 tests pass locally, CI 3/4 green and the last one still running. Merging once it finishes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Re-lands #264's content directly against
main. The original PR merged intoissue-133-anchor(its stacked base) instead ofmain- by the time #263 merged tomain, #264's commit hadn't landed there yet, so--sign/--key-envnever actually shipped. GitHub still shows #264 as "merged," which is accurate but misleading here: merged into the wrong target.Same spec as before:
nirium-audit-v1:<content_sha256>locally with ed25519 - only the resulting signature and the derived public key (G...) leave this process, never the secret itself.--key-env <VAR>if given, otherwise the config store'ssecretKey. Either missing path fails locally with a clear message, before any network call.Keypair.fromSecretthrowing).400and nothing is anchored.Test plan
test/anchor-sign.test.js(7 cases) against a fake agent server that actually verifies the signature (same ed25519-over-statement check the real node does), not a stub that always accepts - so "bad signature -> 400, nothing anchored" is real. Covers: happy-path round trip throughnirium verify(reportsSIGNATURE: VALIDagainst the same key) for both--hashand--recordmode, a rejected signature, a malformed secret key, an unset--key-envvariable, no key configured at all, and that omitting--signleaves the request body unchanged.npm test- 106/106 (includes CLI: nirium anchor, anchor a file or hash to the Audit Trail #133/CLI: nirium verify should retry and fall back to another gateway #135/CLI: nirium report, summary and export from the Reporting node #136, already onmain).node --check bin/nirium.jsclean.Closes #134