Original sources · POC — modules
Platform stub — README
Summarised in: POC components · Known inconsistencies
Platform stub (web-platform-stub)
The machine-facing half of "Notre Plateforme" for the POC — the handful of endpoints a real downstream process (the PDS) genuinely calls, plus the two the SPA needs to survive a reload. No database, no real itsme; in-memory state, localhost only.
- Design:
../../architecture.md§5–§7 - This module's spec:
../spec.mdPart A - Frozen wire formats:
../../contracts.md§1–§6 — the single source of truth for request/response bodies. This code implements them; it does not redefine them.
Endpoints
| Method + path | Contract | Consumer |
|---|---|---|
GET /jwks.json | §5.1 | PDS filter — verifies the mandate signature |
POST /discover | §5.2 | SPA registration — server-side initialize + tools/list, dodges browser CORS |
POST /providers | spec A4 | SPA registration finalize ("J'accepte") |
GET /providers/:id | spec B5 | SPA mandate form — provider lookup |
POST /account-link/initiate | §5.8 / §8 | SPA espace-client — fetch the PDS-signed account-link assertion, verify it, open a link session |
POST /mandates | §5.3 | SPA mandate form — signs the Agent Delegation Token (needs a link_session_id from /account-link/initiate) |
GET /introspect/:jti | §5.4 | PDS filter — every call, RFC 7662-style; deny on anything but active:true |
POST /mandates/:jti/revoke | §5.5 | SPA dashboard |
GET /mandates?itsme_sub= | §5.6 | SPA dashboard list |
GET /audit/:jti | §5.7 | SPA dashboard + demo step 8 (Trace Plateforme) |
POST /setup-codes/:code/redeem | §5.9 / §9 | mcp-server setup (Outil Local) — redeems the one-time setup code into the mandate's config.json (step 5b) |
GET /health | — | liveness |
POST /discover uses POST with a JSON body ({ "mcp_endpoint": "..." }) per
contracts §5.2 — not the GET /discover shown in the architecture mermaid.
Run
bash
npm install
# once — generates deploy/keys/platform-signing.jwk.json (git-ignored, stable across restarts)
../../deploy/gen-keys.sh
npm run dev # tsx watch, http://localhost:3000Build / CI:
bash
npm run typecheck
npm test # node:test via tsx — no network, spins the app on an ephemeral port
npm run build && npm startThe stub fails fast if the signing key is missing (it never auto-generates one — a fresh key would drift the JWKS the PDS caches; see deploy/spec.md D-2).
Hands-on manual testing (curl walkthrough, endpoint reference, troubleshooting):
TESTING.md.
Configuration (env — defaults from contracts §4/§6)
| Var | Default | Meaning |
|---|---|---|
PORT | 3000 | |
PLATFORM_ISSUER | https://veritia.eu | token iss |
PDS_MCP_URI | http://localhost:8081/mcp | token aud (canonical MCP URI, not the provider UUID) |
PDS_DISCOVERY_URI | http://localhost:8081/mcp | fallback target for POST /discover when the body omits mcp_endpoint |
SIGNING_KEY_PATH | ../../deploy/keys/platform-signing.jwk.json | RSA private JWK, kid platform-poc-1. In the container: /keys/platform-signing.jwk.json |
FIXED_PROVIDER_ID | 9b7c1e40-2f6a-4c11-9e2a-000000000bqt | constant provider_id for repeatable demos; set to empty to mint a random UUID per registration |
MANDATE_LINK_BASE | http://localhost:4200/mandate/new | SPA form URL; ?provider=<id> is appended |
PDS_ASSERT_URI | http://localhost:8081/account-link/assert | account-linking (§8): stub POSTs {pds_customer_id} here to get a signed assertion |
PDS_ASSERTION_JWKS_URI | http://localhost:8081/pds-jwks.json | PDS assertion key (kid bqt-assertion-1) — used to verify the assertion JWS |
PDS_ASSERT_DEV_SECRET | poc-dev-secret | X-Poc-Dev-Auth header for the mocked-auth PDS assert endpoint |
LINK_SESSION_TTL_SECONDS | 600 | how long a verified link session is usable before POST /mandates |
Layout
src/
server.ts entry — loadConfig -> loadSigner -> createApp -> listen
app.ts all routes (Express); createApp({config,signer,state}) is the testable seam
config.ts env -> Config, defaults from contracts §4/§6
signing.ts load RSA private JWK; sign() + public JWK for /jwks.json
mandate.ts mint the Agent Delegation Token — claim set frozen in contracts §1
mcp-discover.ts server-side MCP initialize/tools/list handshake (Streamable HTTP, JSON or SSE)
assertion.ts verify a PDS-signed account-link assertion (contracts §8.4) — JWKS fetch + jose
state.ts in-memory Maps: providers, mandates, audit, linkSessions, usedAssertionJti
seed.ts fake itsme identities (contracts §4)
test/
stub.test.ts scenario coverage (platform §A6 + contracts §7 rows)