VVeritia documentation

Original sources · POC — modules

Outil Local — manual testing

poc-code/outil-local/MANUAL-TESTING.md POC EN updated 2026-12-01 12 KBraw file · styled HTML version

Summarised in: Status & testing

Outil Local — manual testing

How to exercise this module by hand. Keep this file in sync with the code: every new mode / flag / behaviour gets a row here in the same PR.

A more visual companion, MANUAL-TESTING.html, sits next to this file — same content, sticky TOC, collapsible sections, copy buttons. Self-contained (no external libraries), open it directly in a browser. Regenerate it by hand if this file changes; there is no committed conversion script yet.

Setup (once)

bash
cd poc-code/outil-local
npm install
npm run build          # tsc -> dist/

Use a throwaway key dir so your real ~/.veritia stays clean:

bash
export NP_HOME=/tmp/np-test
rm -rf "$NP_HOME"

Coverage

#WhatState
initgenerate agent Ed25519 keypair, print public JWK + kid; --force mandate-breakage warning (contracts §9); --show re-prints the existing key without touching it (added 2026-10-12, spec §3.2)✅ testable
runtime proxystdio ↔ Claude Desktop, DPoP-signed forward to provider; NP_HOME/NP_MANDATE folder resolution (contracts §9.5)✅ testable
setupredeem a one-time setup code into ${NP_HOME}/<slug>/config.json (contracts §9, build step 5b)✅ testable

init — test matrix

Run each from poc-code/outil-local/ after npm run build.

#CommandExpectedExit
1node dist/index.js initkey written to $NP_HOME/agent.key; prints one-liner {"kty":"OKP","crv":"Ed25519","x":"…"} + kid0
2ls -la "$NP_HOME"-rw------- agent.key inside drwx------ dir—
3head -1 "$NP_HOME/agent.key"-----BEGIN PRIVATE KEY----- (PKCS#8 PEM)—
4node dist/index.js init (again)refusing to overwrite … on stderr, nothing rewritten1
5node dist/index.js init --forcenew keypair (different x), file replaced0
6NP_HOME=/tmp/np-other node dist/index.js initwrites under /tmp/np-other, not the default0
7node dist/index.js (zero mandate folders under NP_HOME)no mandate configured — run "mcp-server setup <url>" first on stderr (O-6)1
8node dist/index.js frobnicateunknown subcommand: frobnicate … on stderr1
9node dist/index.js init --show (no key yet)no agent key found … run "mcp-server init" first on stderr (O-1f)1
10node dist/index.js init then node dist/index.js init --showboth print the same one-liner + kid (O-1g); sha256sum "$NP_HOME/agent.key" unchanged before/after --show0

Confirmed 2026-10-12: both verified live (including the sha256sum before/after check, and --show --force together — shows, does not regenerate).

--force mandate-breakage warning (contracts §9, one agent.key per machine)

Since a regenerated key breaks every mandate folder under NP_HOME at once, --force warns first. Setup: create at least one mandate folder (either via real setup <url> below, or by hand-writing ${NP_HOME}/<label>/config.json with a real AGENT_DELEGATION_TOKEN).

#CommandExpectedExit
O-1binit --force, answer N at the promptlists every mandate folder + its expiry, aborted — key untouched…; agent.key and all folders unchanged1
O-1cinit --force, answer ysame listing, then a fresh keypair is written; mandate folders and their config.jsons are left on disk untouched (now orphaned — useless until re-setup)0
O-1dinit --force --yeswarning printed to stderr, no prompt, proceeds straight to a fresh keypair0
O-1einit --force with zero mandate folders under NP_HOMEproceeds exactly like a plain --force always did — no warning at all0

Confirmed 2026-09-25: all four verified live against real AGENT_DELEGATION_TOKENs (decoded act.sub for the label, exp for the timestamp — no signature check, matching spec §3).

Invariants to eyeball on test 1:

  • Private key bytes appear only in the file — never in stdout, never in a log line.
  • The printed one-liner has keys in order kty, crv, x and no whitespace.

Keypair verification (round-trip)

Proves the printed public key matches the stored private key and the kid is correct.

bash
node --input-type=module -e '
import { readFileSync } from "node:fs";
import { createPrivateKey, createPublicKey, sign, verify } from "node:crypto";
import { calculateJwkThumbprint, importJWK } from "jose";
const priv = createPrivateKey(readFileSync(process.env.NP_HOME + "/agent.key", "utf8"));
const x = createPublicKey(priv).export({ format: "jwk" }).x;
const oneLiner = `{"kty":"OKP","crv":"Ed25519","x":"${x}"}`;
console.log("one-liner :", oneLiner);
console.log("kid       :", await calculateJwkThumbprint({ kty:"OKP", crv:"Ed25519", x }, "sha256"));
const pub = await importJWK(JSON.parse(oneLiner), "EdDSA");
const sig = sign(null, Buffer.from("msg"), priv);
console.log("PoP ok    :", verify(null, Buffer.from("msg"), pub, sig));
console.log("tamper no :", verify(null, Buffer.from("xxx"), pub, sig) === false);
'
LineMust match
one-lineridentical to what init printed
kididentical to the kid init printed
PoP oktrue
tamper notrue

runtime — test matrix

Needs a real provider to discover tools from. Either the real PDS /mcp route — fixed 2026-09-19 by step 6's isolated /mcp/** filter: the PDS's global oauth2ResourceServer filter used to 401 any Authorization: DPoP … request before it reached the /mcp/** permitAll rule (Spring Security 6.5's native DPoP-scheme recognition intercepting it); the isolated filter's separate chain sidesteps that entirely, and the full happy path (real mandate → real outil-local → real PDS → real balance data) is now live-verified against the real PDS, not just refusal/discovery-failure scenarios — or a throwaway MCP server built with the same @modelcontextprotocol/sdk (Server + StreamableHTTPServerTransport from @modelcontextprotocol/sdk/server/*) for the happy path.

bash
cd poc-code/outil-local
npm run build
export NP_HOME=/tmp/np-test   # from the init matrix above, real keypair already on disk
#SetupCommandExpectedExit
O-2no key at $NP_HOME/agent.keyAGENT_DELEGATION_TOKEN=x PROVIDER_API_ENDPOINT=http://localhost:8081/mcp node dist/index.jsstderr: agent key not found … run "mcp-server init" first1
O-3chmod 644 $NP_HOME/agent.keysame as O-2stderr: … is readable by group/other (mode 644) — refusing to start …1
O-3 (Windows)n/a — the check is skipped entirely on win32 (no POSIX mode bits on NTFS; fs.stat() always reports 0666/0444 there regardless of real ACLs — found live 2026-10-09, refused to start on every launch before this exemption was added)server starts normally0
—key present, both env vars setAGENT_DELEGATION_TOKEN=x PROVIDER_API_ENDPOINT=http://localhost:8081/mcp node dist/index.jsenv wins outright, no mandate folder needed at all (spec §4.1, manual-testing escape hatch) — proceeds straight to discovery—
O-6key present, zero mandate folders under NP_HOME, no env overridenode dist/index.js (no env)stderr: no mandate configured — run "mcp-server setup <url>" first1
O-7key present, ≥2 mandate folders under NP_HOME, NP_MANDATE unsetnode dist/index.jsstderr: multiple mandates configured — set NP_MANDATE to one of: <name>, <name> (sorted)1
O-8NP_MANDATE=does-not-existNP_MANDATE=does-not-exist node dist/index.jsstderr: no mandate folder named "does-not-exist" under <NP_HOME>1
O-4key + config present, nothing listeningPROVIDER_API_ENDPOINT=http://localhost:9/mcp node dist/index.jsstderr: discovery failed against http://localhost:9/mcp: … — names the endpoint, no tools served1
happy pathreal MCP server up, valid delegation tokendrive over stdio with an @modelcontextprotocol/sdk Client + StdioClientTransport pointed at node dist/index.jstools/list returns the server's tools verbatim; tools/call relays the result unchanged; every outbound request (POST and the GET SSE stream) carries Authorization: DPoP <token> + a fresh DPoP: <proof> (unique jti/iat each time)—
S2–S4provider returns 401/403 with {"error":"<code>"} on a tools/callsame stdio client, call the tool that triggers the rejectionMCP result isError:true, content[0].text = provider rejected the call: <code> (HTTP <status>) — call does not throw, the process keeps running—
O-5call a tool name never returned by tools/listsame stdio clientMCP protocol error -32601 unknown tool: <name> — never forwarded to the provider (confirm no log line on the provider side)—

Confirmed 2026-09-25: O-6/O-7/O-8 live-verified with hand-built mandate folders under a throwaway NP_HOME (real 2-folder listing, sorted names in the O-7 message).

Confirmed 2026-09-18 against a real PDS (steps 1–4, poc-code/pds jar + poc-code/platform/stub, real minted delegation token bound to a freshly-init'd key) for O-2/O-3/O-4/config-missing, and against a throwaway loopback MCP server (same SDK) for the happy path + S2–S4 + O-5 — see the note above on why the PDS itself can't carry the happy path yet.

setup — test matrix

Needs the real stub up (poc-code/platform/stub) with a real minted mandate (contracts §5.3 now also returns setup_redeem_url). init must have already run once for this NP_HOME.

bash
cd poc-code/outil-local
npm run build
export NP_HOME=/tmp/np-test
node dist/index.js init   # if not already done for this NP_HOME
#SetupCommandExpectedExit
U-1no agent.key yetNP_HOME=/tmp/np-nokey node dist/index.js setup <url>stderr: agent key not found … run "mcp-server init" first1
U-2valid, unredeemed setup_redeem_url from a real POST /mandates responsenode dist/index.js setup <url>${NP_HOME}/<slug>/config.json written, mode 0600; stdout names the mandate + NP_MANDATE=<slug>0
U-3same URL, run againnode dist/index.js setup <url> (second time)stderr: this setup link was already used, or never existed — get a new one from the platform1
U-4code past its 10-minute TTLnode dist/index.js setup <url>stderr: this setup link has expired (10 minute TTL) — get a new one from the platform1
U-5platform unreachablenode dist/index.js setup http://localhost:1/setup-codes/x/redeemstderr: could not reach …: fetch failed1
U-6two mandates, two different agent_labels, setup run once each—two separate folders under NP_HOME; runtime with NP_MANDATE unset then refuses and lists both (O-7)—
U-7a second mandate reusing an existing agent_label, then setup for it—overwrites that one folder's config.json (confirm via checksum); no third folder appears—

Confirmed 2026-09-25 against the real stub (platform/stub/) + a throwaway PDS assert/JWKS stand-in (same fake used by the stub's own node:test suite) for a real provider_account_ref assertion: U-1 through U-7 all live-verified end to end, including two real mandates with distinct labels and a third reusing one of them.

Cleanup

bash
rm -rf "$NP_HOME" /tmp/np-other

When you change the module

ChangeUpdate
new subcommand / flagadd a row to the init matrix (or a new matrix)
key path / perms / formattests 2–3 and the round-trip block
public-key output formatthe "invariants" list + round-trip one-liner check
runtime proxy behaviourthe runtime matrix above
Generated 2026-11-30 by documentation/build.mjs · edit the Markdown, never this HTML.