Original sources · POC — architecture & contracts
POC cross-module contracts (frozen wire)
Summarised in: Home · Glossary · End-to-end flow · Tokens and keys · Proof of possession · Account linking · Revocation & audit · Local tool · Threat model · POC overview · POC components · Wire reference · Status & testing · Decision log · Known inconsistencies
POC — cross-module contracts
Frozen. These are the things two or more modules must implement identically. Change one here → update every consumer listed in the same section, in the same PR. Everything module-local lives in that module's
spec.md. Narrative rationale is inarchitecture.md; this file is the exact wire.
Modules: pds/ · platform/ (spa/ + stub/) ·
outil-local/ · deploy/ · demo/.
0. Global build order
Steps 1–2 unblock everyone. Then the PDS track (3→4→6) and the SPA track (7) run in parallel. Riskiest work (Spring bump + MCP transport) is front-loaded as step 0b.
| # | Deliverable | Spec | Precondition | Why this order |
|---|---|---|---|---|
| 0 | Freeze this file | — | — | Steps 1–3 hard-code values from §2–§6 |
| 0b | Spike — ✅ done 2026-09-09, pds/spike-notes.md. Verdict GO. Pins: Spring Boot 3.5.13, spring-ai-bom 1.1.8, @modelcontextprotocol/sdk 1.30.0; negotiated MCP protocol 2025-11-25 (session-scoped); per-request Authorization: DPoP + DPoP header injection via the TS transport fetch option confirmed end to end | pds §3.1 | 0 | retire the transport + Spring-bump risk before any dependent code |
| 1 | Platform stub — ✅ done 2026-09-09, poc-code/platform/stub/ (Node 20 + TS CJS + Express 4 + jose 5, in-memory Maps). All §5 endpoints + POST /providers / GET /providers/:id (spec A4/B5). POST /discover runs the real MCP initialize→notifications/initialized→tools/list handshake (Streamable HTTP; parses application/json and text/event-stream), protocol 2025-11-25. GET /mandates requires itsme_sub → 400 missing_itsme_sub (no "all" / no silent []). createApp({config,signer,state}) = testable seam. 19 node:test cases green, tsc --noEmit clean. deploy/gen-keys.sh + .gitignore line + Dockerfile + README.md/TESTING.md. Account-linking rework done 2026-09-09 — src/assertion.ts (verify the PDS JWS: JWKS fetch + jose), POST /account-link/initiate (§5.8), POST /mandates now takes link_session_id + embeds the raw assertion + real provider_jkt, linkSessions + usedAssertionJti state, SEED_ACCOUNT_LINK removed. 29/29 node:test green at the time (incl. A-2b/c/d, S16, S17), tsc + build clean. Step 5b (2026-09-25) added setup-code minting/redeem — now 34/34 node:test green, see row 5b | platform §Stub | §2 §3 §5 §6 §8 | Everyone signs/verifies against it. Hand-forge an agent keypair (step 2) to sign test tokens until step 5 |
| 2 | Outil Local — init — ✅ done 2026-09-09, poc-code/outil-local/ (TS ESM + jose 5; node dist/index.js init). Ed25519 keygen → PKCS#8 PEM at ${NP_HOME:-~/.veritia}/agent.key (0600, dir 0700, refuse-overwrite / --force); prints the compact JWK one-liner + RFC 7638 kid. All 8 init scenarios + keypair round-trip verified; outil-local/MANUAL-TESTING.md added; tsc clean. Runtime proxy (step 5) stubbed with a non-zero exit | outil-local §init | §4 | Produces a real Ed25519 agent keypair for real test JWTs |
| 3 | PDS — standup — ✅ done 2026-09-11, poc-code/pds/ (Boot 3.5.13 / JDK 21, matching the spike pins, not 3.4). JPA + H2 (file mode) + Flyway (V1__schema.sql all 4 tables incl. mcp_call_audit for later steps, V2__seed.sql exact contracts §4 rows) + accounts domain (Customer/Account/AccountLink/McpCallAudit entities + repositories). GET /accounts/me (bqt-Keycloak protected, role CUSTOMER); bqt realm swap done in docker/realm-export.json (client bqt-rest/bqt-secret, users pieter/sofie/noah). Account-linking (§7) done together — bqt-assertion-1 Ed25519 key (generated once, persisted to data/pds-assertion.jwk.json, restart-stable, verified live), GET /pds-jwks.json, POST /account-link/assert (dev-secret gated, §8.3). Two pre-existing upstream bugs fixed: SecurityConfig.jwtDecoder() was eager (fromIssuerLocation blocked app boot without live Keycloak) → rebuilt lazily via withJwkSetUri; UserControllerUnitTest's jwt() mocks never actually applied KeycloakRoleConverter, masked until the context could load. /account-link/** CSRF-exempted (header-secret-gated, no session). 12/12 mvn test green (H2+Flyway integration tests, no live Keycloak needed); real boot + curl smoke-tested end to end (/pds-jwks.json, /account-link/assert all 3 cases, /accounts/me 401). Maven wrapper added (.mvn/, mvnw). §9 isolated filter is step 6, below | pds §4–§7 | 0b, §3 | §9 evaluation already done — this is execution |
| 4 | PDS — MCP route — ✅ done 2026-09-11, tools/list + get_balance on Streamable HTTP at /mcp (spring-ai-starter-mcp-server-webmvc 1.1.8, MCP Java SDK 0.18.3, matching the spike pins; spring.ai.mcp.server.protocol=STREAMABLE). Tool built by hand against McpSchema.Tool/SyncToolSpecification (not @Tool/MethodToolCallbackProvider — confirmed by reading McpToolUtils sources that annotations don't survive that conversion in 1.1.8) so annotations.readOnlyHint/title match §8 exactly. McpPrincipal (the shape step 6's filter will set, contracts §2 step 19 + jti for the audit correlation) read via SecurityContextHolder; today always absent (/mcp/** is permitAll + CSRF-exempt, marked TEMPORARY in SecurityConfig per spec.md §2), so every tools/call resolves to a no_mandate_context tool error — unknown_account (S10) and the happy path (real balance + mcp_call_audit ALLOW row) are exercised by pushing a hand-built McpPrincipal directly in tests. 18/18 mvn test green (4 new unit tests on the tool logic + 2 integration tests using a real MCP Java SDK client over Streamable HTTP on a random port); real jar boot + live-tested with @modelcontextprotocol/inspector --cli (tools/list, tools/call) and raw curl initialize, output matches this row | pds §8 | 3 | Test with a raw MCP client before the Outil Local exists |
| 4b | PDS — mirror list_transactions — ✅ done 2026-09-18. Real Java equivalent of the fake PDS's demo prop, built the same way as GetBalanceTool: ListTransactionsTool.java (hand-built McpSchema.Tool, same annotation-preservation reason), new transaction JPA entity/repository, V3__transactions.sql (schema + 10 seeded rows/customer, pds/spec.md §5.5). Same no_mandate_context/unknown_account handling as get_balance; max_results (default 20, else [1,50] or invalid_max_results) and period (7j/30j/90j or invalid_period) filter against the customer's own most recent transaction, not wall-clock "now", so demo result counts stay deterministic. Registered as a second List<McpServerFeatures.SyncToolSpecification> bean — confirmed (by decompiling spring-ai-autoconfigure-mcp-server-common 1.1.8) that McpServerAutoConfiguration collects all such beans via ObjectProvider<List<...>>> and flattens them, so both tools coexist without touching GetBalanceTool; tools/list now returns 2. pds/spec.md §5/§8 updated (new transaction table as §5.5, tool doc added to §8); this row and §8's link updated. 28/28 mvn test green (9 new unit tests in ListTransactionsToolTest, McpRouteIntegrationTest updated for 2 tools + a new list_transactions no-mandate-context case, GetBalanceToolTest unaffected) | pds §5.5, §8 | 4 | Demo-prop-first: validate the review-screen UX on the cheap fake tool before spending Java+test+contract effort on the real one |
| 5 | Outil Local — runtime — ✅ done 2026-09-18, poc-code/outil-local/src/{paths,agent-key,dpop,provider-client,runtime}.ts. Low-level MCP Server + StdioServerTransport toward Claude Desktop; Client + StreamableHTTPClientTransport toward the PDS with DPoP injected via the transport's fetch option (fresh proof, jti/iat per request, on POSTs and the GET SSE stream — the spike-confirmed pattern). Discovery keeps tools/list verbatim; a tool name Claude Desktop asks for that was never discovered is rejected locally (McpError MethodNotFound, never forwarded); a PDS 401/403 is mapped to an MCP isError tool result naming the provider's error code (doesn't crash the process); missing/world-readable key, missing config, and discovery failure all refuse to start with a clear stderr message. Manual testing only (Raul's call, not automated): O-2/O-3/config-missing/O-4 verified live against the real PDS + stub with a freshly-minted keypair and token; the happy path + S2–S4 + O-5 were first only verified against a throwaway loopback MCP server (same SDK), because the PDS's global Spring Security filter chain at the time intercepted the DPoP auth scheme before /mcp/**'s permitAll applied (Spring Security 6.5 added native DPoP recognition) — a step-6 concern, documented in outil-local/MANUAL-TESTING.md. Fixed by step 6 (below): the happy path is now also live-verified against the real PDS | outil-local §runtime | 1, 2, 4, §1 §2 | Needs a real JWT (1) + real keypair (2) + a real MCP server (4) |
| 5b | Platform — one-time setup code + mandate-replace check + Outil Local — setup subcommand + multi-mandate layout — ✅ done 2026-09-25. Stub: POST /mandates mints a setup code atomically (setup_code/setup_redeem_url/setup_code_expires_at, URL built from the request's own Host header), POST /setup-codes/:code/redeem (200/404/410, burn-on-success), GET /mandates gains provider_id/agent_label per row, audit event SETUP_CODE_REDEEMED — 34/34 node:test green. SPA: /mandate/new pre-submit collision check (§9.4) with Replace/Change label/Cancel, default agent_label now <provider-name>-<firstname>, success screen shows the one-line setup command and the raw config block, new §B5bis accordion (Claude Desktop/Claude Code/GitHub Copilot CLI) — ng build clean. Outil Local: init --force's mandate-breakage warning (decodes act.sub/exp from each config.json's token, requires interactive y unless --yes), new setup <redeem-url> subcommand (slugifies agent_label, writes ${NP_HOME}/<slug>/config.json mode 0600, always overwrites that one folder), runtime's NP_HOME/NP_MANDATE split (zero/one/many folders + named selection, both-env-vars-set still bypasses folder resolution for manual testing). Full real end-to-end smoke test: real mandate (real PDS account-link assertion, not faked) → real setup → real runtime → real DPoP-signed tools/call get_balance against the real PDS jar → correct balance back. All scenarios (O-1b–e, U-1–U-7, O-6/O-7/O-8) live-verified, not just unit-tested — see implementation checklist | outil-local §5, contracts §9, platform §B5/§B5bis, implementation checklist | 1, 5 | Closes the "config.json is documented but nothing writes it" gap found while manually verifying step 5; §9's two design revisions (2026-09-19) replaced the original one-keypair-per-client / flat-default-folder design after neither survived scrutiny. 2026-10-10 addendum: /mandate/new gained a new step 1 ("Installer l'outil local") before the B5 form — the end-user-facing gap where the demo narrated/pre-staged outil-local init but never actually showed a screen for it. ng build clean; not yet re-verified against a live stub/PDS in this sandbox (no running services here) — see platform §B5-pre. 2026-10-11 revision: dropped the localStorage "already installed" skip added the same week — step 1 is now shown on every visit (the real gate is server-side, out of scope here); going back from step 2 is now the step-indicator's clickable "1" tab, not a dedicated button. 2026-10-12 addendum: outil-local init gains --show — re-prints the existing agent key's public one-liner + kid without touching agent.key, closing a real gap found live while diagnosing a pop_key_mismatch: init never re-prints the key once it already exists, so a human minting a new mandate months later (a different provider, nothing to collide with) had no supported way to retrieve the public key their mandate still needs to be bound to — see outil-local §3.2. |
| 6 | PDS — isolated filter on /mcp/** — ✅ done 2026-09-19, pds/src/main/java/.../mcp/MandateDpopFilter.java + McpSecurityConfig.java. All 19 contracts §2 steps, in order (delegation JWT verify + introspect, DPoP proof verify + PoP match + replay, tool allow-list, account-link assertion re-verify). Two real bugs found and fixed: exposing the filter as its own @Bean made Spring Boot auto-register it globally (fixed by constructing it inline inside the chain's @Bean); ContentCachingRequestWrapper doesn't make the body re-readable for the MCP handler after this filter's own bsha check reads it (fixed with a small hand-rolled CachedBodyRequest). Happy path (S1) and revocation (S4) live-verified end to end against the real stack; the rest of the scenario matrix (S2/S3/S5–S9/S14/S15) covered by a dedicated MandateDpopFilterTest unit-test class against an in-process platform test double. Follow-up fix, 2026-09-25: a post-implementation review found pds/spec.md §8's documented "discovery is left public" intent had never actually been implemented — the filter blocked all unauthenticated /mcp/** traffic including initialize/tools/list, silently breaking the demo's own live PDS-registration step (demo/script.md, /admin/register → Discover) against a step-6-protected PDS. Fixed by exempting initialize/notifications/initialized/tools/list from all 19 steps (never tools/call) — live-reverified against the real PDS with the exact curl sequence the bug was found with, plus 4 new unit tests and a rewritten McpRouteIntegrationTest. 41/41 mvn test green | pds §9, implementation checklist | 1, 4, 5, §1 §2 | Build after the Outil Local runtime so it is exercised against real DPoP proofs; unit-test earlier with forged proofs. Started ahead of 5b (2026-09-19) — fixed a live Spring Security DPoP-interception bug found during step 5's manual testing that would otherwise sabotage 5b |
| 7 | Angular SPA — ✅ done 2026-09-11, poc-code/platform/spa/. All 6 §B3 routes (registration, review/accept, fake itsme, mandate form, dashboard, pds-space); ng build clean; live-smoke-tested against the running stub (no headless-browser screenshot in that sandbox, no root). Demo-realism polish 2026-09-16/17: itsme + pds-space full-viewport takeover branding, admin-register 2-step wizard, mandate-new tool descriptions + limits | platform §SPA | 1 | Independent of the PDS track. Use a canned tools/list fixture until step 4 is reachable |
| 8 | compose.yaml + bqt realm export + key provisioning + address wiring — ✅ done 2026-09-26, poc-code/deploy/compose.yaml (3 services: pds-keycloak, web-platform-stub, pds) + new pds/Dockerfile + pds/.dockerignore (the stub's Dockerfile already existed from step 1; gen-keys.sh had already been run at step 1). Realm import reuses pds/docker/realm-export.json directly — no separate copy. Two real gaps found and fixed while wiring this: the Keycloak iss-mismatch failure mode flagged since step 3 (KC_HOSTNAME=pds-keycloak pins the issued-token issuer to the container-network name regardless of which host:port a client used) and the known-flaky /health/ready healthcheck pds/TESTING.md §7 already documented (KC_HEALTH_ENABLED=true, needed now because pds's depends_on: service_healthy is load-bearing). Live-tested 2026-10-09 (Raul's own machine, WSL2 + Podman, step 9 under way) — the KC_HEALTH_ENABLED=true fix alone wasn't sufficient once actually run: Keycloak 26 serves /health/ready on a separate management port 9000, not :8080, and this image ships no curl/wget/which at all, so no HTTP-based healthcheck could ever pass on it. Fixed with a plain TCP-connect probe (bash's /dev/tcp) against :9000 instead — confirmed live, pds-keycloak now reports (healthy) and pds starts. Full detail: deploy/spec.md §2, pds/TESTING.md Troubleshooting | deploy | 3, 6 | Needs the PDS image and the finished filter |
| 9 | End-to-end dry run + finalize demo/script.md | demo | all | Rehearse on the real demo machine |
| 9b | PDS — Trace Prestataire endpoint + SPA — dashboard side-by-side trails — ✅ done 2026-10-09, found and fixed while actually rehearsing step 9's demo beat 8 ("two audit trails"). mcp_call_audit had existed since steps 3/4/6 but was never actually exposed anywhere — pds/spec.md §5.4's own "emit each row as a stdout log" intent was never implemented, and demo/script.md beats 5/7/8 all pointed presenters at a T2 terminal log line that didn't exist on either the PDS or the stub side. Fixed with a new GET /mcp-audit/:jti PDS endpoint (McpAuditController.java + a repository finder; permitAll + open CORS, same posture as /pds-jwks.json; unknown/no-rows jti → 200 [], not 404, matching the stub's own /audit/:jti precedent) — 43/43 mvn test green (2 new). SPA dashboard's row expansion now renders this directly fetched by the browser (bypassing the stub entirely — matches architecture.md's "platform never sees the transaction traffic" boundary for real) as a second "Trace Prestataire" panel next to "Trace Plateforme" — ng build clean. demo/script.md beats 5/7/8 rewritten to point at the dashboard instead of a terminal, and the pre-flight's T2 terminal dropped entirely (one fewer visible terminal on stage) | contracts §8.6, pds §5.4, platform §B-4 | 3, 4, 6, 7 | Chosen over a log line or an H2 console specifically to keep the demo's climax beat on one browser tab, no terminal, for a non-technical audience |
Account-linking un-mock (decided 2026-09-09).
provider_account_refis no longer a hardcoded map — it is a real PDS-signed assertion (§8,liaison-compte-prestataire.mdVariante 2). This is additive scope on existing steps, no new global step: step 1 (stub) needs rework (POST /account-link/initiate+ the new/mandatesshape
- assertion verify + embed — unit-testable now with a hand-forged Ed25519 assertion); step 3 adds the PDS assertion key +
GET /pds-jwks.json+POST /account-link/assert; step 6 adds §2 steps 14–18; step 7 adds the fake espace-client screen.outil-local/is untouched.
1. Contract A — Agent Delegation Token (the mandate JWT)
Spec-faithful claim set (see specification-v1-authentification.md
Phase 2 and liaison-compte-prestataire.md §5.1).
- Signed by the platform stub. Verified by the PDS isolated filter (step 6).
- JWS:
alg: RS256, headertyp: at+jwt,kid= the stub's stable key id (§3). - Encoding: compact JWS string, handed to the human inside
ready_to_use_config(§5.3).
Privacy note on
sub/act.sub. A JWS is signed, not encrypted — its claims are plaintext to anyone holding the string, whether or not they can produce a valid DPoP proof.sub(itsme identity) andact.sub(=agent_label, human free text) are the two claims most likely to carry identifying information, and their exposure is realistic social-engineering material (name + bank + amount caps + expiry). This POC keepssubas a readable test name andact.subunminimized for demo legibility on localhost, where nothing leaves the machine — see architecture.md's POC-deviations table for the tracked gap and what a real deployment must do instead (pseudonymoussub,agent_labeltreated as identifying, andAuthorization/DPoPheader redaction in logs/APM — TLS alone doesn't cover that).
{
"iss": "https://veritia.eu",
"aud": "http://localhost:8081/mcp", // §2: canonical MCP URI, NOT the provider UUID
"sub": "itsme:be:sofie.maes", // fake itsme identity (§4)
"act": { "sub": "claude-desktop-sofie" }, // agent label from the mandate form
"cnf": { "jwk": { "kty": "OKP", "crv": "Ed25519", "x": "<agent public key, b64url>" } },
"provider_account_ref": {
"value": "pacr_bqt_2c8d40", // opaque, pairwise (§4). PDS resolves this → account
"source": "signed_assertion", // constant. The value comes from a PDS-signed assertion (§8)
"asserted_at": 1786536000, // = the assertion's iat
"provider_jkt": "aB3…xYz", // real RFC 7638 thumbprint of the PDS assertion key (§8)
"assertion": "<compact JWS, signed by the PDS>" // the raw assertion — PDS re-verifies its own signature (§8, §2 step 15)
},
"iat": 1786536000,
"exp": 1786539600, // iat + ttl_seconds (default 3600)
"jti": "b1e5c0de-0000-4000-8000-000000000001",
"purpose": "consultation de solde", // declarative, non-binding
"disclosed_scope": {
"allowed_tools": ["get_balance", "list_transactions"],
"tool_constraints": {
"list_transactions": { "period": "30j", "max_results": 10 } // §1.1 — optional, per-tool
},
"binding": false,
"note": "Declared by the human at issuance. Not verified by the platform. The provider is solely responsible for enforcement."
},
"transparency": { "is_ai_agent": true, "audit_log": "https://veritia.eu/audit/<jti>" },
"revocation_check": "https://veritia.eu/introspect/<jti>"
}NOTE — provider_account_ref in the POC. The POC implements the account-linking
handoff, in the front-channel signed-assertion variant
(liaison-compte-prestataire.md §4.2,
"Variante 2"). The full mechanism and what stays mocked is in §8. Short version: the PDS
signs a short-lived assertion binding itsme session → opaque pairwise ref; the stub verifies
it against the PDS's JWKS and embeds the raw assertion in the token; the PDS re-verifies its
own signature at call time (§2 steps 14–18) before resolving value → account.
NOTE — disclosed_scope.tool_constraints, added 2026-10-12. Still no amount/account
caps (max_amount, allowed_accounts) — this PDS has no write tools, and resurrecting those
specifically was already rejected for this POC on liability grounds
(specification-v1-authentification.md
§"decision history"). What's new is narrower: a per-tool cap on that tool's own request
parameters (e.g. list_transactions' period/max_results), so the human can bound not just
which tools an agent may call but how much each call may ask for. See §1.1 for the
shape and enforcement point. (2026-11-30: architecture.md §2 and pds/spec.md §8 have since
been updated to describe tool_constraints — this note used to say that update was still pending.)
1.1 tool_constraints — shape and enforcement
- Shape:
tool_constraints.<tool_name> = { <param_name>: <cap value> }.<param_name>must be one of that tool's own declaredinputSchemaproperties;<cap value>is expressed in the same vocabulary/units as the parameter itself —periodstays one of"7j"/"30j"/"90j",max_resultsstays a plain integer. No separate unit-conversion table: the tool already knows how to compare its own parameter's values (e.g.ListTransactionsTool's existingPERIOD_DAYSmap), so the cap is compared the same way. - Optional, per-tool, per-param. Absent entirely, absent for a given tool, or absent for a
given param all mean "no cap beyond that tool's own hardcoded range" (e.g.
max_results' existing[1,50]bound). A tool not inallowed_toolsat all can still carry an entry here harmlessly (step 13 already rejects the call before constraints are ever consulted). - Who enforces it, and where. Not the generic 19-step filter (§2) — that filter has no
per-tool parameter knowledge and never inspects
tools/callarguments.tool_constraintsis forwarded opaquely intoMcpPrincipalat filter step 19 (§2); each tool's own handler (pds/spec.md §8) reads its own entry and compares the incoming request args against it, using the same parsing/ordering logic it already has for its own schema. - Fail code: an MCP tool error (JSON-RPC
200,CallToolResult.isError=true), not an HTTP-level 403 from the filter — same channel asunknown_account/invalid_max_results, not the same channel astool_not_allowed(§2 step 13). Shape:{ "code": "<param_name>_exceeds_mandate" }, e.g.max_results_exceeds_mandate/period_exceeds_mandate— one specific code per capped param, not a generic code + a separatedetailfield, matching this codebase's existing convention for every other MCP tool error (invalid_max_results,invalid_period,unknown_account, all flat{ "code": ... }, no second field). Still produces anmcp_call_audit DENYrow (deny_reason= the same code). - Still advisory only in one sense: the platform (stub) never verifies these values are
sane or signs off on them being honored — same
binding: falseposture asallowed_toolsalways had. What's new is that this PDS, by its own policy, chooses to actually enforce them rather than just logging them. A different provider could legally ignoretool_constraintsentirely and only this PDS's own behavior would be "wrong" by it.
Who does what with each claim
| Claim | Stub (produce) | PDS filter (enforce?) | Notes |
|---|---|---|---|
iss | constant PLATFORM_ISSUER | ✅ equals expected issuer | |
aud | constant PDS_MCP_URI | ✅ equals MCP_CANONICAL_URI → else 403 aud_mismatch (4.6c-bis) | single source, §2 |
sub | from mandate form (fake itsme pick) | logged only | imputability; identifying — see privacy note above |
act.sub | from mandate form field (agent_label) | logged only | identifying free text — see privacy note above |
cnf.jwk | from mandate form (pasted JWK) | ✅ RFC 7638 thumbprint must match the DPoP proof key | PoP anchor |
provider_account_ref.value | = assertion.sub from the verified PDS assertion (§8) | ✅ resolved → account; unknown → MCP error unknown_account | never derived from sub at the PDS |
provider_account_ref.assertion | raw PDS-signed JWS, passed through verbatim (§8) | ✅ re-verify PDS signature + iss/aud/sub/freshness (§2 steps 14–18) | this is what makes the ref vouched, not asserted by us |
provider_account_ref.provider_jkt | RFC 7638 thumbprint of the PDS assertion key (§8) | ✅ equals thumbprint of the PDS's own assertion key → else 403 account_ref_jkt_mismatch | |
iat/exp | iat=now, exp=iat+ttl | ✅ exp/nbf/iat with ±60 s skew | |
jti | UUIDv4 | used for introspection + audit correlation | |
purpose | from form | logged only | |
disclosed_scope.allowed_tools | from form checkboxes | ✅ requested tool must be in the list → else 403 tool_not_allowed | checked by the generic filter (§2 step 13) |
disclosed_scope.tool_constraints | from form, optional per-tool param caps (§1.1) | ✅ request args for that tool must not exceed the cap → else MCP tool error <param_name>_exceeds_mandate (not an HTTP 403 — a JSON-RPC 200 with isError:true) | checked by the tool's own handler, not the filter — filter only forwards it opaquely (§2 step 19) |
disclosed_scope.binding | constant false | — | |
transparency | constant + <jti> | logged only | EU AI Act beat |
revocation_check | constant + <jti> | not dereferenced — PDS uses its configured PLATFORM_INTROSPECT_BASE (§6) | claim carries the canonical (unreachable) URL for shape-fidelity only |
2. Contract B — Proof of Possession wire format (DPoP, RFC 9449 + bsha)
Implemented by the Outil Local runtime (build) and the PDS isolated filter (verify). Decided in architecture.md §11.1.
Request the Outil Local sends to the PDS
POST http://localhost:8081/mcp (Streamable HTTP; body = one JSON-RPC message)
Authorization: DPoP <delegation JWT> ← scheme is "DPoP", never "Bearer"
DPoP: <proof JWT>
Content-Type: application/json
{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_balance","arguments":{}}}Spike-confirmed context (pds/spike-notes.md): MCP protocol negotiates to
2025-11-25 (session-scoped Streamable HTTP). After initialize, requests also carry
Mcp-Session-Id and MCP-Protocol-Version headers, and there is a GET /mcp SSE stream that
carries the same Authorization: DPoP + DPoP pair. The filter authenticates every
/mcp request (POST and GET) and does not require MCP-Protocol-Version on the first
initialize POST.
Proof JWT
| Part | Value |
|---|---|
header typ | dpop+jwt |
header alg | EdDSA |
header jwk | the agent public JWK — byte-identical to cnf.jwk in the delegation token |
claim jti | fresh UUIDv4, unique per request |
claim htm | POST |
claim htu | http://localhost:8081/mcp — scheme+host+path only, no query, no fragment |
claim iat | now, epoch seconds |
claim bsha | base64url( sha256( exact request body bytes ) ) — the one non-standard claim, restores spec hypothesis 6 body binding |
PDS verification order (fail → 401/403, machine-readable error code in body)
Exempt from all 19 steps below: initialize, notifications/initialized, tools/list
(pds/spec.md §8 — "discovery is left public for the POC"; added 2026-09-25 after a
post-implementation review found this was documented intent that had never actually been
implemented, silently breaking the platform stub's live registration-time discovery,
mcp-discover.ts, against a step-6-protected PDS). All three must be exempt together — Streamable
HTTP's session handshake is ordered, so a caller can't reach tools/list without completing
initialize first. tools/call is never exempt; the check below applies to it unconditionally.
| # | Check | Fail code |
|---|---|---|
| 1 | Authorization scheme is DPoP; extract delegation JWT | 401 missing_dpop |
| 2 | Delegation JWS verifies against platform JWKS (cached); alg=RS256; typ=at+jwt; iss ok | 401 bad_token |
| 3 | exp/nbf/iat valid, ±60 s skew | 401 token_expired |
| 4 | aud == MCP_CANONICAL_URI | 403 aud_mismatch |
| 5 | introspect(jti) → active:true (§6). Non-2xx / 404 / timeout / connect error → fail-closed | 403 revoked_or_unknown / 403 introspection_unreachable |
| 6 | Extract cnf.jwk; compute RFC 7638 thumbprint jkt_cnf | 401 bad_token |
| 7 | Parse DPoP proof; typ=dpop+jwt; alg=EdDSA; signature verifies against its header jwk | 401 bad_dpop |
| 8 | thumbprint(proof.header.jwk) == jkt_cnf | 403 pop_key_mismatch |
| 9 | htm == method AND htu == canonical request URL (no query) | 403 dpop_htu_htm_mismatch |
| 10 | proof iat within ±60 s of now | 403 dpop_stale |
| 11 | bsha == base64url(sha256(received raw body)) | 403 body_hash_mismatch |
| 12 | proof jti not in replay cache; then insert (TTL 120 s) | 403 dpop_replay |
| 13 | requested tool ∈ disclosed_scope.allowed_tools | 403 tool_not_allowed |
| 14 | provider_account_ref.source == "signed_assertion" and .assertion present; parse the assertion JWS, alg == EdDSA | 403 account_ref_assertion_invalid |
| 15 | assertion signature verifies against the PDS's own assertion key (bqt-assertion-1, held locally — not fetched); iss == PDS_PROVIDER_ID; aud == PLATFORM_EXPECTED_ISS | 403 account_ref_assertion_invalid |
| 16 | assertion.sub == provider_account_ref.value | 403 account_ref_value_mismatch |
| 17 | provider_account_ref.provider_jkt == thumbprint(PDS assertion key) and provider_account_ref.asserted_at == assertion.iat | 403 account_ref_jkt_mismatch |
| 18 | assertion was valid at mandate issuance: assertion.iat ≤ delegation.iat ≤ assertion.exp + 60 s (do not require the assertion still-fresh now — 5 min TTL, 1 h mandate) | 403 account_ref_stale |
| 19 | build Authentication { provider_account_ref.value, sub, agent_jkt, allowed_tools, tool_constraints }; hand to MCP handler | — |
tool_constraints(§1.1) rides along in thisAuthentication/McpPrincipalobject opaquely — this filter parses it only as a nested JSON object, never interprets a param name or cap value. Per-tool enforcement happens inside that tool's own handler (pds/spec.md §8), which is the only place that already knows that tool's parameter vocabulary.- Replay cache: in-memory (
ConcurrentHashMap+ scheduled purge, or Caffeine with 120 s expiry). No DB table — it is ephemeral by nature; losing it on restart is harmless at POC scale. The RFC 9449DPoP-Nonceserver challenge is not implemented in v0. - Ed25519 verification on the PDS: Nimbus
OctetKeyPair+Ed25519Verifier. Confirm in the spike (step 0b) that no extra provider (Tink/BouncyCastle) is needed.
3. Contract C — Platform signing key
| Property | Value |
|---|---|
| Type | RSA 2048, use sig, alg RS256 |
kid | platform-poc-1 — stable across restarts (PDS caches JWKS by kid) |
| Private key file | deploy/keys/platform-signing.jwk.json (private JWK). Generated once by deploy/gen-keys.sh. Git-ignored. Mounted into the stub container at /keys/platform-signing.jwk.json |
| Public exposure | stub GET /jwks.json → { "keys": [ <public JWK, same kid> ] } |
| PDS consumption | PLATFORM_JWKS_URI (§6) → standard Spring NimbusJwtDecoder with JWKS caching |
The agent keypair is not here — the Outil Local generates it locally (Ed25519) and never transmits the private half. See outil-local §init.
4. Contract D — Shared seed data
Identical values wherever they appear. _ groups digits for readability only.
Fake itsme identities (SPA login screen picks one)
sub | Display name |
|---|---|
itsme:be:pieter.janssens | Pieter Janssens |
itsme:be:sofie.maes | Sofie Maes |
itsme:be:noah.dubois | Noah Dubois |
provider_account_ref ↔ customer ↔ account (fictional "Banque Test", bqt)
itsme sub | provider_account_ref.value | PDS customer.id | account.iban | account.balance_cents | display |
|---|---|---|---|---|---|
itsme:be:pieter.janssens | pacr_bqt_7f3a91 | cust-001 | BE68 5390 0754 7034 | 423117 | € 4 231,17 |
itsme:be:sofie.maes | pacr_bqt_2c8d40 | cust-002 | BE71 0961 2345 6769 | 1280250 | € 12 802,50 |
itsme:be:noah.dubois | pacr_bqt_9b1e05 | cust-003 | BE62 5100 0754 7061 | 31804 | € 318,04 |
- The
itsme sub ↔ customerpairing in this table is the demo-intended pairing the presenter follows (Sofie Maes →cust-002). It is not a code linkage: in the flow the human picks the customer in the fake PDS espace-client screen (platform §B), and the PDS vouches for it via a signed assertion (§8). The stub no longer owns anyitsme_sub → refmap. pds_customer_id → provider_account_ref.valuelives in the PDS (account_linkread bycustomer_id) and is only reachable through the PDS assert endpoint (§8).provider_account_ref.value → customer → accountlives in the PDS (account_link+accounttables, §pds).- Currency
EUReverywhere.account.balance_centsis an integer; format to euros for display only.
PDS assertion key (§8 — the third keypair)
| Property | Value |
|---|---|
| Type | Ed25519 (kty:OKP, crv:Ed25519), use:sig, alg:EdDSA |
kid | bqt-assertion-1 — stable across restarts |
| Private key | generated once by the PDS at boot → pds/data/pds-assertion.jwk.json (H2-style, survives restart, wiped by podman compose down -v + rm -rf data) |
| Public exposure | PDS GET /pds-jwks.json → { "keys": [ <public JWK, kid bqt-assertion-1> ] } |
| Stub consumption | PDS_ASSERTION_JWKS_URI (§6), cached |
| Distinct from | the platform signing key (§3, RSA) and the agent key (Ed25519, Outil Local). Three parties, three keypairs |
Identifiers, ports, URLs
| Thing | Value |
|---|---|
provider_id (mandate-link UUID) | 9b7c1e40-2f6a-4c11-9e2a-000000000bqt (any fixed UUIDv4; keep it constant for repeatable demos) |
| Mandate link | http://localhost:4200/mandate/new?provider=<provider_id> |
Canonical MCP URI (aud) | http://localhost:8081/mcp |
PLATFORM_ISSUER | https://veritia.eu (identifier only; nothing is hosted there) |
| PDS Keycloak realm | bqt; REST client bqt-rest (secret bqt-secret, direct access grants on) |
| PDS Keycloak demo user | pieter / demo, realm role CUSTOMER |
| SPA PDS-admin account | admin@bqt.example / demo (SPA-local check, no IdP) |
| Ports | Keycloak 8080 · PDS 8081 · stub 3000 · SPA ng serve 4200 |
Mandate purpose | consultation de solde |
Mandate ttl_seconds | 3600 |
PDS_PROVIDER_ID (assertion iss, §8) | 9b7c1e40-2f6a-4c11-9e2a-000000000bqt (same UUID as provider_id) |
Account-link assertion TTL (exp − iat) | 300 s |
| Link-session TTL (stub, §5.8) | 600 s |
POC assert dev-secret (X-Poc-Dev-Auth, §8) | poc-dev-secret |
5. Contract E — Stub HTTP API (shared: SPA + PDS + Outil Local all call it)
Base URL: host http://localhost:3000, compose network http://web-platform-stub:3000
(deploy §addresses). JSON in/out. No auth in the POC (localhost only).
5.1 GET /jwks.json — consumed by the PDS
200 { "keys": [ { "kty":"RSA","use":"sig","alg":"RS256","kid":"platform-poc-1","n":"…","e":"AQAB" } ] }
5.2 POST /discover — consumed by the SPA (Phase 0), dodges browser CORS
req { "mcp_endpoint": "http://localhost:8081/mcp" }
200 { "fetched_at": "2026-09-09T10:00:00Z",
"tools": [ { "name":"get_balance", "description":"…",
"inputSchema": { "type":"object", "properties":{}, "required":[] },
"annotations": { "readOnlyHint": true, "title":"Consulter le solde" } } ] }
502 { "error": "discovery_failed", "detail": "<message>" }Stub performs the JSON-RPC initialize + tools/list handshake server-side.
5.3 POST /mandates — consumed by the SPA (Phase 2), signs the token
req { "provider_id": "<uuid>",
"link_session_id": "<uuid>", // from §5.8, carries the verified PDS assertion
"itsme_sub": "itsme:be:sofie.maes", // still needed for the sub claim
"agent_jwk": { "kty":"OKP","crv":"Ed25519","x":"<b64url>" },
"agent_label": "claude-desktop-sofie",
"purpose": "consultation de solde",
"allowed_tools": ["get_balance"],
"tool_constraints": { "list_transactions": { "period": "30j", "max_results": 10 } }, // optional, §1.1
"ttl_seconds": 3600 }
200 { "jti": "<uuid>",
"delegation_token": "<compact JWS>",
"provider_api_endpoint": "http://localhost:8081/mcp",
"ready_to_use_config": {
"AGENT_DELEGATION_TOKEN": "<compact JWS>",
"PROVIDER_API_ENDPOINT": "http://localhost:8081/mcp" },
"setup_code": "<opaque>",
"setup_redeem_url": "http://localhost:3000/setup-codes/<opaque>/redeem",
"setup_code_expires_at": 1789731234 }
400 { "error": "unknown_provider" | "unknown_link_session" | "link_session_expired"
| "link_session_provider_mismatch" | "unknown_itsme_sub" | "empty_allowed_tools"
| "invalid_agent_jwk" | "invalid_tool_constraints" }Side effects: load the link session (§5.8) by link_session_id — must exist, not be expired,
and its provider_id must match; take provider_account_ref.value / provider_jkt /
asserted_at / raw assertion from it; mint JWT per §1 (with the full provider_account_ref
object incl. assertion; tool_constraints, if present in the request, embedded verbatim into
disclosed_scope.tool_constraints — the stub does not validate its shape against any tool's
real schema, same non-verification posture as allowed_tools, §1.1); consume the link
session (single-use); store
jti → { status:"VALID", sub, aud, iat, exp, provider_account_ref_value, allowed_tools, purpose };
also mint a one-time setup code bound to this jti (§9); append audit event MANDATE_ISSUED.
5.4 GET /introspect/:jti — consumed by the PDS filter, every call (RFC 7662-style)
200 { "active": true, "jti":"…","sub":"…","aud":"…","iat":…, "exp":… }
200 { "active": false, "jti":"…","reason": "revoked", "revoked_at": … }
200 { "active": false, "jti":"…","reason": "expired" }
404 { "active": false, "reason": "unknown_jti" }Side effect: append audit event INTROSPECT_CALLED { caller_ip, result }.
PDS rule: proceed only on active:true; everything else (incl. 404, timeout, connection
error) → deny, fail-closed (§2 step 5).
5.5 POST /mandates/:jti/revoke — consumed by the SPA dashboard (Phase 5)
200 { "jti":"…","status":"REVOKED","revoked_at": … }
404 { "error":"unknown_jti" }Side effect: flip stored status; append audit event MANDATE_REVOKED.
5.6 GET /mandates?itsme_sub=<sub> — consumed by the SPA dashboard
200 { "mandates":[ { "jti","aud","purpose","allowed_tools","iat","exp","status","provider_id","agent_label" } ] }
400 { "error": "missing_itsme_sub" } — itsme_sub absent or blank. The stub does not
fall back to "all mandates" (data-leak shape once authz-scoped) nor to [] (a silently empty
dashboard reads as "no mandates"); the SPA shows an empty list plus an error.
(Addition beyond architecture.md §5's stub list: lets the dashboard
survive a page reload instead of holding mandate state only in an Angular service. Cheap,
more realistic.) agent_label added 2026-09-19 (§9.4) — the mandate form's
pre-submit collision check matches on it alone (any provider). provider_id added alongside
it, for display only (which provider each row belongs to), not part of the match.
5.7 GET /audit/:jti — consumed by the SPA dashboard + demo step 8
200 { "jti":"…", "platform_trace":[ { "ts","event","detail" } ] }
event ∈ { MANDATE_ISSUED, INTROSPECT_CALLED, MANDATE_REVOKED, ACCOUNT_LINK_VERIFIED, SETUP_CODE_REDEEMED } (§9). This
is the Trace Plateforme; the Trace Prestataire is the PDS mcp_call_audit table
(§pds), correlated by jti. ACCOUNT_LINK_VERIFIED is keyed by the assertion jti until a
mandate jti exists, then copied onto the mandate's trace.
5.8 POST /account-link/initiate — consumed by the SPA (Phase 2.0ter), obtains + verifies the PDS assertion
req { "provider_id": "<uuid>", "pds_customer_id": "cust-002" }
200 { "link_session_id": "<uuid>",
"provider_account_ref": "pacr_bqt_2c8d40", // echoed so the SPA can show "linked to your BQT account"
"expires_at": 1786536600 } // now + link-session TTL (§4)
400 { "error": "unknown_provider" }
502 { "error": "assertion_fetch_failed", "detail": "<message>" } // PDS assert endpoint unreachable / non-2xx
422 { "error": "assertion_invalid", "detail": "sig" | "iss" | "aud" | "exp" | "jti_replay" }Side effects: POST to PDS_ASSERT_URI (§6) with { pds_customer_id } and header
X-Poc-Dev-Auth: <secret> (§4); receive { assertion }; verify per §8 (signature via
PDS_ASSERTION_JWKS_URI cached JWKS; aud == PLATFORM_ISSUER; iss == a known provider's id;
exp not passed ±60 s skew; jti not in the used-assertion set → then add it); on success
create a link session { link_session_id → { provider_id, provider_account_ref value, provider_jkt, asserted_at, raw_assertion, expires_at } } and audit ACCOUNT_LINK_VERIFIED.
5.9 POST /setup-codes/:code/redeem — consumed by mcp-server setup (§9)
200 { "AGENT_DELEGATION_TOKEN": "<jws>", "PROVIDER_API_ENDPOINT": "http://localhost:8081/mcp",
"agent_label": "claude-desktop-sofie" }
404 { "error": "unknown_code" } // never existed, or already redeemed
410 { "error": "code_expired" }agent_label lets setup derive the mandate's folder name (§9.1 step 6) without the human
typing anything new. Full shape, rationale, and why the human copies a URL rather than a bare
code: §9.
6. Contract F — Cross-container configuration
One value, one name per side. Full matrix in deploy §addresses.
| Meaning | Stub env | PDS env | Value (host) | Value (compose net) |
|---|---|---|---|---|
Canonical MCP URI = token aud | PDS_MCP_URI | MCP_CANONICAL_URI | http://localhost:8081/mcp | http://localhost:8081/mcp (identity, not an address — same on both) |
| Platform JWKS | — (self) | PLATFORM_JWKS_URI | http://localhost:3000/jwks.json | http://web-platform-stub:3000/jwks.json |
Introspection base (PDS appends /<jti>) | — (self) | PLATFORM_INTROSPECT_BASE | http://localhost:3000/introspect | http://web-platform-stub:3000/introspect |
Platform issuer (token iss) | PLATFORM_ISSUER | PLATFORM_EXPECTED_ISS | https://veritia.eu | same |
| PDS discovery endpoint (stub calls it) | PDS_DISCOVERY_URI | — | http://localhost:8081/mcp | http://pds:8081/mcp |
| PDS account-link assert endpoint (stub calls it, §8) | PDS_ASSERT_URI | — | http://localhost:8081/account-link/assert | http://pds:8081/account-link/assert |
| PDS assertion JWKS (stub verifies with it, §8) | PDS_ASSERTION_JWKS_URI | — | http://localhost:8081/pds-jwks.json | http://pds:8081/pds-jwks.json |
PDS's own provider id (assertion iss, §8) | — | PDS_PROVIDER_ID | 9b7c1e40-2f6a-4c11-9e2a-000000000bqt | same |
| POC assert dev-secret (§8) | PDS_ASSERT_DEV_SECRET | PDS_ASSERT_DEV_SECRET | poc-dev-secret | same |
| Keycloak issuer (PDS's own REST security) | — | spring.security.oauth2.resourceserver.jwt.issuer-uri | http://localhost:8080/realms/bqt | http://pds-keycloak:8080/realms/bqt |
aud is an identifier, not a routing address — it stays http://localhost:8081/mcp on
both sides even though containers reach each other by service name (RFC 8707 / MCP
Authorization). The Outil Local runs on the host, so it always uses localhost.
7. Cross-module scenario matrix
Each row is one end-to-end behaviour; the owning module's spec.md has the local detail and
the unit test.
| # | Scenario | Trigger | Expected | Enforced in |
|---|---|---|---|---|
| S1 | Happy path | get_balance via Claude Desktop with a fresh valid mandate | € balance for the mandate's provider_account_ref; mcp_call_audit row decision=ALLOW; stub INTROSPECT_CALLED active | pds §9 |
| S2 | Stolen token, no key | replay the JWT from another shell without the agent private key | cannot build a valid DPoP proof → 401 bad_dpop / 403 pop_key_mismatch | pds §2.7–2.8 |
| S3 | Expired mandate | wait past exp (or issue ttl_seconds:60) | 401 token_expired, no introspection needed (defence in depth) | pds §2.3 |
| S4 | Revoked mandate | human clicks Revoke in SPA, then agent calls again | 403 revoked_or_unknown; stub audit shows MANDATE_REVOKED then INTROSPECT_CALLED reason=revoked | stub §5.5 + pds §2.5 |
| S5 | Wrong provider | present a token with aud ≠ this PDS | 403 aud_mismatch even though the signature is valid | pds §2.4 |
| S6 | Replay of a valid signed request | capture a full request (JWT+DPoP+body) and resend verbatim | first passes, second → 403 dpop_replay | pds §2.12 |
| S7 | Tampered body | modify the JSON-RPC body after signing | 403 body_hash_mismatch | pds §2.11 |
| S8 | Introspection down | stop the stub, then agent calls | 403 introspection_unreachable (fail-closed), not allowed through | pds §2.5 |
| S9 | Tool not in mandate | mandate lists get_balance only; agent calls a different tool | 403 tool_not_allowed | pds §2.13 |
| S10 | Unknown account link | token provider_account_ref has no account_link row | MCP error unknown_account | pds §8 |
| S11 | Read-only provider registration | register the PDS in the SPA | review screen shows one tool, readOnlyHint badge, no amount/ceiling fields | spa §Registration |
| S12 | Discovery failure | register with an unreachable MCP endpoint | SPA shows discovery_failed, no provider_id issued | stub §5.2 + spa |
| S13 | Stub restart mid-demo | restart the stub container | previously issued jti → 404 unknown_jti → PDS fail-closes (403). Re-run registration + mandate to recover | deploy §scenarios |
| S14 | Tampered account-link assertion | alter provider_account_ref.assertion in a minted token, then call | 403 account_ref_assertion_invalid; mcp_call_audit DENY | pds §9 (steps 14–15) |
| S15 | Assertion / value mismatch | keep a valid assertion but change provider_account_ref.value | 403 account_ref_value_mismatch | pds §9 (step 16) |
| S16 | Replayed link assertion at issuance | capture an assertion and POST /account-link/initiate with its jti twice (or a captured raw assertion) | 2nd → 422 assertion_invalid (jti_replay); no link session created | stub §5.8 + §8 |
| S17 | Cross-provider link session | link session from provider A used in POST /mandates for provider B | 400 link_session_provider_mismatch | stub §5.3 |
| S18 | Request exceeds mandate's declared tool constraint | mandate's tool_constraints.list_transactions caps period at 30j; agent calls with period: "90j" (or omits period — unbounded also exceeds a finite cap) (or max_results over its cap, incl. via the tool's own default) | MCP tool error period_exceeds_mandate / max_results_exceeds_mandate (JSON-RPC 200, isError:true, not an HTTP 403); mcp_call_audit DENY | pds §8 (tool handler, not the filter — §1.1) |
8. Contract G — Account-linking handoff (provider_account_ref)
Implements liaison-compte-prestataire.md
§4.2 "Variante 2" — front-channel signed assertion (the variant that doc earmarks for the
POC / a small PDS). Replaces the earlier hardcoded itsme_sub → ref map. The point: the PDS
vouches for "which of my customers this is" with its own signature, and proves that to
itself again at call time — the platform never fabricates the binding.
8.1 Sequence
1. Human opens the PDS link → SPA fake "Banque Test — Espace client" (/pds-space?provider=…)
2. Picks which BQT customer they are ← MOCKED: no real PDS login (see 8.5)
3. Clicks "Configurer un agent IA"
4. SPA → stub POST /account-link/initiate { provider_id, pds_customer_id } (§5.8)
5. stub → PDS POST /account-link/assert { pds_customer_id } + X-Poc-Dev-Auth (§8.3)
6. PDS signs a short-lived assertion with bqt-assertion-1, returns { assertion }
7. stub verifies it (§8.4), stores a link session, returns link_session_id
8. Human: itsme pick (unchanged) → mandate form (unchanged)
9. SPA → stub POST /mandates { …, link_session_id } (§5.3)
stub embeds value + provider_jkt + raw assertion into provider_account_ref (§1)
10. Phase 4 call: PDS filter RE-VERIFIES its own assertion signature (§2 steps 14–18)
then resolves value → account_link → account (§pds §8)8.2 The assertion JWS (PDS-signed)
| Part | Value |
|---|---|
header alg | EdDSA |
header kid | bqt-assertion-1 (§4) |
header typ | JWT |
iss | PDS_PROVIDER_ID (§6) — the provider's own id, = provider_id |
aud | PLATFORM_ISSUER (https://veritia.eu) |
sub | the provider_account_ref.value (pacr_bqt_…, §4) — opaque, pairwise |
iat | now |
exp | iat + 300 (§4) |
jti | fresh UUIDv4 — single-use (stub tracks used ones) |
No accounts[] claim (POC get_balance takes no account parameter — documented extension
point, liaison… §9/#6).
8.3 POST /account-link/assert — PDS endpoint (stub calls it)
req { "pds_customer_id": "cust-002" } header X-Poc-Dev-Auth: poc-dev-secret
200 { "assertion": "<compact JWS per §8.2>" }
400 { "error": "unknown_customer" }
401 { "error": "poc_dev_auth_required" } // the mocked-auth guard (§8.5)Resolution: pds_customer_id → account_link.findByCustomerId(...) → provider_account_ref
→ sign. Loud comment required: in production this is an OIDC authorization/token endpoint
(or a front-channel signed-request emitter) that vouches for the PDS's already-authenticated
customer session; here the customer id is passed in the clear and gated only by a shared demo
secret.
8.4 Stub verification of the assertion (in POST /account-link/initiate)
| # | Check | Fail (422 assertion_invalid, detail) |
|---|---|---|
| 1 | JWS parses; alg == EdDSA; signature verifies against PDS_ASSERTION_JWKS_URI (cached JWKS, by kid) | sig |
| 2 | iss == a registered provider's id | iss |
| 3 | aud == PLATFORM_ISSUER | aud |
| 4 | exp not passed, iat not in the future, ±60 s skew | exp |
| 5 | jti not in the used-assertion set → then insert it | jti_replay |
On success: link_session_id → { provider_id, value: sub, provider_jkt: thumbprint(the PDS JWKS key that verified it), asserted_at: iat, raw_assertion, expires_at: now + 600 } (§4). Used-assertion set + link sessions are in-memory, lost on restart
(harmless — re-run the espace-client step).
8.5 What is still mocked (say it on stage)
| Mocked | Real product |
|---|---|
| The PDS authenticating its own customer — a dropdown in a fake espace-client screen | An prompt=none OIDC round-trip against the PDS's live customer session (liaison… §4.1) |
Front-channel transport — the assertion is fetched stub→PDS (like /discover, dodges browser CORS) | The assertion rides the browser redirect (POST body / RFC 9101 request) |
Browser-binding of the assertion (cookie / PKCE challenge) — not implemented; only short TTL + single-use jti | A browser-bound challenge, or the back-channel code exchange of Variante 1 |
provider_jkt legal / key-rotation handling | liaison… §9/#8–#10 — still open |
The cryptographic chain is real: PDS signs → stub verifies against the PDS JWKS → PDS re-verifies its own signature in the token before resolving the account. That is the trust boundary being prototyped.
8.6 GET /mcp-audit/:jti — PDS endpoint, consumed directly by the SPA dashboard (Trace Prestataire)
Added 2026-10-09, found missing while actually rehearsing demo step 8 — mcp_call_audit
(§5.4 Trace Prestataire) existed since step 3/4 but nothing ever exposed it: no log line, no
endpoint, no console. This closes that gap.
200 { "jti":"…", "provider_trace":[ { "ts","decision","tool_name","deny_reason","agent_jkt",
"provider_account_ref","dpop_jti","request_htu" } ] }decision ∈ {ALLOW, DENY}; tool_name/deny_reason/dpop_jti/request_htu are nullable
(same columns as mcp_call_audit, pds/spec.md §5.4). Unknown jti or a mandate that was never
called ⇒ 200 with provider_trace: [], not 404 — same precedent as the stub's own
GET /audit/:jti (§5.7), so an unexpanded or tool-never-called row doesn't read as an error in
the UI.
permitAll + @CrossOrigin(origins: "*") — fetched directly by the browser, never relayed
through the platform stub (mirrors architecture.md's "the platform never sees the transaction
traffic" boundary for real, not just in prose). Same no-auth posture as GET /pds-jwks.json:
read-only, correlated by a jti the caller already has to know.
9. Contract H — One-time setup code, and one key per machine
Design decision 2026-09-18 (Raul), revised 2026-09-19 after two follow-up design passes.
The problem this section solves: getting AGENT_DELEGATION_TOKEN onto disk without ever
putting the raw token in a terminal command (shell history, ps visibility) or inside any AI
client's own config file — and doing that cleanly for a human who wants more than one AI
client talking to the same PDS.
Revision 1 (was: one keypair per client). The original design gave each AI client its own
agent.key, reasoning that separate keys contain a compromise to one client. That argument
doesn't survive scrutiny: outil-local runs as an ordinary subprocess with the human's full
account permissions — nothing OS-level stops one compromised instance from reading a
different client's directory regardless of whether it holds a different key. Real
containment would need OS-level sandboxing per client, which this design doesn't have.
Meanwhile the properties that actually matter — imputability (which client made which call)
and least privilege (independent scope per client) — live in the mandate (the token's
jti, its own allowed_tools, its own agent_label), not in the key. So: agent.key is
one per machine, written once by init. What's per-client is the mandate.
Revision 2 (was: a flat default config.json for the first client). Unnecessary special
case — nothing shipped depends on it (the setup subcommand that would write config.json
doesn't exist yet, so there's no backward-compatibility reason to keep one mandate un-named).
Every mandate gets a named folder, with no exception for "the first one." A folder's
existence is the mandate's existence on disk — ls ${NP_HOME} is a manifest of every client
currently wired up on this machine.
~/.veritia/ NP_HOME — one per machine
├── agent.key one keypair, written once by `init`
├── claude-desktop-sofie/
│ └── config.json one mandate = one client = one named folder
└── gemini-cli-sofie/
└── config.jsonThe folder name is the mandate's own agent_label, slugified (lowercase, non-alphanumeric →
-, repeats collapsed) — not a new thing the human types; it's already a mandate-form field
(platform §B5, default claude-desktop-<firstname>), so the generated setup command just
carries it through.
9.1 Sequence
1. Human submits the mandate form (unchanged, §5.3 / platform §B5). Before submit, the SPA
checks for a pre-existing active mandate with the same agent_label for this provider
(§9.4) — if found, offers to revoke it as part of minting the new one
2. Stub mints the mandate AND, atomically, a setup code bound to it — POST /mandates
response gains setup_code / setup_redeem_url / setup_code_expires_at (§5.3)
3. SPA shows a copy-paste command:
npx @veritia/mcp-server setup <setup_redeem_url>
— the raw ready_to_use_config JSON is still shown too, for hand-editing config.json
directly; the two paths are not mutually exclusive (platform §B5bis)
4. Human pastes the command in a terminal. outil-local `init` must already have run, once,
ever, on this machine — `setup` refuses to proceed without an existing agent.key
(mirrors runtime's O-2)
5. outil-local `setup` → POST <setup_redeem_url> (§5.9) → stub validates + burns the code
→ returns { AGENT_DELEGATION_TOKEN, PROVIDER_API_ENDPOINT, agent_label }
6. outil-local slugifies agent_label into a folder name and writes
${NP_HOME}/<slug>/config.json (mode 0600) — always overwrites that one folder's file;
config.json is the replaceable half of the pair, agent.key never moves
7. Human follows the per-client recipe (platform §B5bis accordion) to point their AI
client at outil-local, telling it which mandate folder to load (§9.5) — no secret
appears in this step, ever, because config.json already holds itThe human copies a full redeem URL, not a bare code — outil-local never needs to know the platform's base address in advance, which also matches a real deployment where different customers may point at different platform instances.
9.2 Code properties
| Property | Value |
|---|---|
| Entropy | ≥128 bits, cryptographically random |
| TTL | 600 s — matches LINK_SESSION_TTL_SECONDS (§4); long enough to paste into a terminal, short enough to be worthless if it ends up in shell history or a screen-share |
| Single-use | burned on first successful redeem |
| Storage | in-memory Map, same pattern as linkSessions (§5.8) — lost on stub restart, harmless (re-mint from the platform) |
| On re-redeem / unknown code | 404 unknown_code either way — don't distinguish "already used" from "never existed" for an attacker guessing codes |
9.3 What this deliberately does not protect against
| Not covered | Why the design is still an improvement |
|---|---|
A human who copies the raw ready_to_use_config JSON (with the live JWT inside) into a terminal command themselves | Can't be prevented by the platform — the manual/text-editor path is offered because some people would rather avoid a redeem step, not as a mandated shell command |
The redeemed token's own lifetime once it's in config.json | Same TTL/no-refresh limitations as always (architecture.md's deviations table) — the setup code protects the handoff only, not the token afterward |
9.4 Replacing an existing mandate — replace, not accumulate
outil-local never holds, or chooses between, more than one mandate for a given client
folder — by construction, not by convention. The alternative (let several coexist, have
outil-local pick whichever one's allowed_tools covers the requested call) was considered and
rejected: it would turn a "generic, dumb, tool-agnostic proxy" into a silent authorization
decision point, let a prompt-injected call get auto-upgraded to whichever coexisting mandate
happens to be more permissive, and weaken the mandate's evidentiary value (which grant a given
call happened under would no longer be a fact fixed at issuance, but something reconstructed
after the fact from matching logic). Precedent: OAuth doesn't have a "client holds N tokens,
something downstream picks the best match" pattern, and the universal API-key-rotation
practice is replace, not accumulate — mint the new one, migrate, deactivate the old one.
So the collision is caught before a second mandate is minted, entirely client-side in the SPA, using endpoints that already exist:
1. Human fills the mandate form, types/keeps an agent_label
2. SPA calls GET /mandates?itsme_sub=<sub> (§5.6, now returns agent_label per row)
3. SPA filters for: same agent_label (any provider), status == VALID, not expired
4. If found: "You already have an active mandate for <agent_label>, issued <iat>,
expires <exp>, for <provider name>. Replace it?" — human confirms or cancels
5. On confirm: SPA calls POST /mandates/:jti/revoke (§5.5, already exists) on the old
jti, THEN proceeds to step 1 of §9.1 for the new oneNo new backend endpoint — agent_label added to §5.6's response is the only shape change.
agent_label is unique per human across every provider, not just within one (decided
2026-09-19, closing a real bug found in the first pass of this design: setup's folder name
is just the slugified label, with no provider component, so two mandates sharing a label for
two different providers would have silently overwritten each other's config.json on disk
even though the mint-time check — back when it also matched on provider_id — would have
waved them through as "not a collision"). The two now agree: reusing a label anywhere always
means "supersede," never "this happens to be for a different bank." Consequence the mandate
form should account for: a human adding a second provider under an AI client they already use
needs a distinct label for it (e.g. claude-desktop-bank-b-sofie, not the same
claude-desktop-sofie again) — worth reflecting in whatever default label the form suggests,
not left to the human to realize on their own. provider_id stays in §5.6's response anyway
(useful for the dashboard to show which provider each row belongs to), it's just no longer
part of the matching key.
Enforcement is client-side only (SPA), not repeated server-side in the stub — a deliberate POC simplification consistent with how much of the review/discovery flow already trusts the frontend; a real product would also reject silently-conflicting mandates server-side.
9.5 Selecting a mandate at runtime
NP_HOME now only answers "where is agent.key" (machine-wide, effectively fixed). A second
variable, NP_MANDATE, answers "which folder's config.json" for a given outil-local launch:
NP_MANDATE | Folders under NP_HOME | Behaviour |
|---|---|---|
| unset | exactly one | use it — the common case costs nothing extra |
| unset | zero | refuse to start: "no mandate configured — run mcp-server setup <url> first" |
| unset | more than one | refuse to start: "multiple mandates configured — set NP_MANDATE to one of: <list>" |
set to <name> | — | use ${NP_HOME}/<name>/config.json, or refuse if that folder doesn't exist |
Full detail: outil-local §5.