# Demo — run sheet (~6 minutes)

Formalises [architecture.md §8](../architecture.md). Two personas — **PDS integration admin**
(beats 1–2) and **human mandant** (beats 3–8). Switch out loud on stage.

Framing line up front: *"We demonstrate integration feasibility on a representative stack —
not a drop-in for any bank. Two things are mocked — itsme, and the bank's customer login (a
picker). Everything else is real: real MCP transport, real keypair on disk, real per-request
signatures, and a real bank-signed account-link assertion the bank re-verifies itself."*

---

## Pre-flight (before the audience is in the room)

| ✓ | Check |
|---|---|
| | `podman compose ps` → `pds`, `pds-keycloak`, `web-platform-stub` all healthy |
| | `ng serve` running, `http://localhost:4200` loads |
| | `curl -s http://localhost:3000/jwks.json` → one key, `kid: platform-poc-1` |
| | `curl -s http://localhost:8081/pds-jwks.json` → one key, `kid: bqt-assertion-1` |
| | `curl -s -o /dev/null -w '%{http_code}' -X POST http://localhost:8081/mcp -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"preflight","version":"0.0.1"}}}'` → `200` (**not** the inspector CLI — its Streamable HTTP client opens a `GET /mcp` stream that the isolated filter correctly rejects with no mandate, failing this check even though the route is fine; see `pds/TESTING.md` §7) |
| | Claude Desktop config points at the **Windows-native** `outil-local/dist/index.js` (`"command": "node"`, not `wsl.exe` — [architecture.md §12.0](../architecture.md)), **no** filesystem/shell MCP server configured |
| | `outil-local init` already run once **on the Windows-native install** (`C:\Users\<you>\.veritia\agent.key` exists); agent public-key JWK one-liner copied to clipboard / a scratch file |
| | Two terminals visible: **T1** (WSL2/bash) for the "stolen token" beat, **T3** (Windows PowerShell, native Node) for the `outil-local setup` command in beat 4. (A third, **T2**, tailing `podman compose logs -f pds web-platform-stub`, used to be listed here for beats 5/7/8 — removed 2026-10-09 once those were corrected to use the dashboard instead, which is both more accurate and keeps one fewer terminal window on screen for a non-technical audience.) |
| | Reset done (see last section) — no leftover mandates from rehearsal |

---

## Beats

### 1 — "The service already exists" · 30 s · persona: PDS admin
- **T1:** get a normal bank token and hit the existing endpoint:
  ```
  TOKEN=$(curl -s -X POST http://localhost:8080/realms/bqt/protocol/openid-connect/token \
    -d grant_type=password -d client_id=bqt-rest -d client_secret=bqt-secret \
    -d username=pieter -d password=demo | jq -r .access_token)
  curl -s -H "Authorization: Bearer $TOKEN" http://localhost:8081/accounts/me | jq
  ```
- **Expect:** `{ customer_id: "cust-001", iban: "BE68 …", balance: "4231.17", … }`
- **Say:** "Banque Test, its own Keycloak, its own REST API. We change none of this."

### 2 — PDS registration, live · 90 s · persona: PDS admin
- Browser → `http://localhost:4200/admin/login` → `admin@bqt.example` / `demo`.
- `/admin/register` step 1 **Identité du prestataire** — raison sociale, numéro d'entreprise
  BCE/KBO, contact technique (declarative, not registry-verified) → **Continuer**.
- Step 2 **Intégration technique** — MCP endpoint `http://pds:8081/mcp` (the field's default —
  discovery runs server-side, *inside* the `web-platform-stub` container, so it needs the
  compose-network address, not `localhost:8081`; found live 2026-10-09, see
  [contracts.md §6](../contracts.md)) → **Discover**.
- **Expect:** review screen — one tool `get_balance`, **read-only** badge, **no** amount/ceiling field.
- **Say:** "Deterministic parse, no AI in this pipeline. Read-only tool → no governance ceiling to set."
- Click **J'accepte** → screen shows `provider_id` and the link
  `http://localhost:4200/mandate/new?provider=<uuid>`. Copy it.

### 3 — Link the account, then issue the mandate · 80 s · persona: human mandant
- Open the copied link → lands on **"Banque Test — Espace client"** (`/pds-space`).
  - **Say:** "The customer starts inside their bank, already logged in — this screen is mocked."
  - Pick **Sofie Maes** → click **"Configurer un agent IA"**.
  - Behind it: stub → PDS `/account-link/assert` → the PDS **signs** an assertion (`sub =
    pacr_bqt_2c8d40`) → stub verifies it against `bqt-assertion-1` → link session created.
- `/itsme` → pick **Sofie Maes** (the sovereign identity, also mocked).
- Lands on `/mandate/new` **step 1 — "Installer l'outil local"** (new, real UI screen — not
  narration): explains the one-time, once-per-machine `npx @veritia/mcp-server init`
  install, shows the command with a copy button, and notes "already installed? skip ahead."
  - **Say:** "Before any of this works, the end user installs a small local tool on their own
    machine, once ever — that's what generated the public key you're about to see pasted in.
    We ran this for real already, during pre-flight, to save a minute on stage — this screen
    is shown to *every* human reaching this point, since the platform has no way to check
    what's already on their machine." Click **Continuer** (no need to actually retype the init
    command — Sofie's key already exists from pre-flight).
  - If you demo a second mandate right after (e.g. §9.4's collision prompt), you'll land on
    this same step 1 again — that's intentional, not a bug: say so if someone asks, rather
    than looking surprised by it. Going back from step 2 to step 1 is a click on the
    step-indicator's **"1"** tab above the card, not a separate button.
- Step 2 — the mandate form itself (unchanged):
  - the **linked-account line** shows "Lié à votre compte Banque Test (liaison signée)"
  - paste the agent public-key JWK one-liner
  - agent label defaults to `banque-test-sofie` (`<provider-name>-<firstname>`) · purpose
    `consultation de solde` · expiry 1 h
  - tick `get_balance`
- **Validate** → the platform signs the JWT (with the PDS assertion embedded in
  `provider_account_ref`) *and* mints a one-time setup code → the success screen shows two
  onboarding paths: a one-line `npx @veritia/mcp-server setup <url>` command (copy
  button), and the raw config block for hand-editing:
  ```
  AGENT_DELEGATION_TOKEN=eyJ…
  PROVIDER_API_ENDPOINT=http://localhost:8081/mcp
  ```
  — plus a client-recipes accordion (Claude Desktop / Claude Code / GitHub Copilot CLI).
- **Say:** "itsme `sub` for *who*, the bank's own signed assertion for *which of its customers*,
  the agent's public key sealed in `cnf`, one tool, one hour."

### 4 — Configure the agent · 30 s
- **Recommended beat (step 5b):** the success screen's one-line command is `npx
  @veritia/mcp-server setup <url>` — **don't actually type that one.**
  `@veritia/mcp-server` is a `private: true` package (confirmed against the real npm
  registry 2026-10-09 — 404, not published), so it's aspirational copy showing what the
  finished, installable product will look like, not something `npx` can resolve today. Copy
  **only the redeem URL** out of that line, and run the real equivalent instead, in **T3**
  (Windows PowerShell — this must be the **native Windows** `outil-local` install, same one
  Claude Desktop launches, so it writes to the Windows-side `NP_HOME`; running it in T1/WSL2 by
  mistake writes to the wrong filesystem and Claude Desktop won't see it —
  [architecture.md §12.0](../architecture.md)):
  ```powershell
  node C:\Users\<you>\outil-local\dist\index.js setup <paste the redeem URL here>
  ```
  — `outil-local` redeems the code and writes
  `C:\Users\<you>\.veritia\banque-test-sofie\config.json` on disk. No token ever
  touched a terminal command or a client config file.
  - **Say:** "The raw token never appears in a shell command or in Claude Desktop's own config —
    it lands straight into a file this local proxy controls." (Skip narrating the `node
    C:\...\dist\index.js` detail itself out loud — that's a packaging implementation detail,
    not part of the point being made.)
  - Claude Desktop's `env` block only needs `NP_MANDATE=banque-test-sofie` (no secret) —
    already set from rehearsal, or set it now and restart Claude Desktop.
- **Fallback (manual path, still supported):** paste the raw config block's two values into
  that same file by hand instead; same result.
- **Expect:** Claude Desktop lists a `banque-test` tool `get_balance` (discovered live).

### 5 — The agent acts · 60 s
- In Claude Desktop: *"What's my Banque Test balance?"*
- **Expect:** answer ≈ **€ 12 802,50** (Sofie → `pacr_bqt_2c8d40` → `cust-002`).
  (Corrected 2026-10-09 — this beat used to point at a **T2** terminal log line here;
  neither the PDS nor the stub ever actually logged that to stdout, found live while
  rehearsing. The real proof now lives in beat 8's dashboard panels — no terminal needed for
  this beat at all.)
- **Say:** "The platform never saw this call. The bank verified our JWT against our JWKS, the
  DPoP proof against the sealed key, checked revocation, **re-verified its own account-link
  assertion inside the token**, then applied its own rules."

### 6 — Stolen token is useless · 45 s
- **T1:** copy the `AGENT_DELEGATION_TOKEN` value alone into a raw request without the agent
  private key (a prepared `curl` / small script that posts to `/mcp` with a bogus or absent
  `DPoP` proof):
  ```
  ./replay-no-key.sh "$AGENT_DELEGATION_TOKEN"
  ```
  **Written and live-verified 2026-10-02** (`poc-code/demo/replay-no-key.sh` +
  `replay-no-key.mjs`, `npm install` on first run) — forges a syntactically valid DPoP proof
  signed with an attacker's own throwaway Ed25519 key per
  [`../../explanations/stolen-token-gap.md`](../../explanations/stolen-token-gap.md), so the
  demo fails at the thumbprint check (step 8), not just a missing header. Confirmed against a
  real minted mandate + a real running PDS, not just reasoned about.
- **Expect:** `403 pop_key_mismatch` (or `401 bad_dpop`).
- **Say:** "The token alone can't be replayed — no matching private key, no valid proof."

### 7 — Revoke · 30 s · persona: human mandant
- Browser → `/dashboard` (as Sofie) → the mandate row → **Revoke**.
- Back in Claude Desktop: ask the balance again.
- **Expect:** error surfaced as `revoked_or_unknown`.
- Back in the browser, re-expand the same row — **Trace Plateforme** now has a new
  `MANDATE_REVOKED` entry, then an `INTROSPECT_CALLED reason=revoked` from the call you just
  made. (Corrected 2026-10-09 — this used to point at a **T2** terminal; the stub never
  actually logged this to stdout, only the dashboard ever showed it.)

### 8 — Two audit trails · 15 s
- SPA dashboard → expand the mandate row → **both panels render side by side in the same
  browser tab**: **Trace Plateforme** (`MANDATE_ISSUED` / `INTROSPECT_CALLED` ×N /
  `MANDATE_REVOKED`) and **Trace Prestataire** (`ALLOW get_balance` / the `DENY
  pop_key_mismatch` from beat 6, if still expanded from then). No terminal, no second screen —
  added 2026-10-09 (step 9b, [contracts §8.6](../contracts.md)) specifically so this beat stays
  entirely on the one webpage the audience has been watching the whole time.
- **Say:** "Same `jti`, two owners, same screen. We prove *who was authorised*; the bank proves
  *what happened*. Neither trail alone is the whole story — by design."

---

## Fallbacks

| If… | Then |
|---|---|
| Discovery in beat 2 fails | the stub logs the error; retry once; worst case switch to a pre-registered `provider_id` (keep one from pre-flight) |
| `/account-link/initiate` fails in beat 3 (`502`/`422`) | check `pds` is up and `PDS_ASSERT_DEV_SECRET` matches on both sides; retry the "Configurer un agent IA" click |
| Claude Desktop won't pick up the tool (beat 4) | run the same `tools/call` through `@modelcontextprotocol/inspector` against the Outil Local's stdio — the DPoP path is identical |
| `outil-local setup`/`init` fails on the native Windows install (beat 4) — untested path as of 2026-09-25 | switch Claude Desktop's config to the `wsl.exe` alternative ([outil-local §4.5](../outil-local/spec.md)) and re-run `init`/`setup` inside WSL2 instead; same commands, different terminal (T1, not T3) |
| Stub was restarted | prior `jti` now `404` → beats 5–8 fail; re-run beats 2–3 |

---

## Reset between runs

```
podman compose restart web-platform-stub      # clears mandates / providers / audit (in-memory)
# H2 (customer/account/account_link) persists — no reset needed
# re-run beat 2 (registration) and beat 3 (mandate) for the next rehearsal
```
Full wipe: `podman compose down -v && rm -rf ../deploy/data` then `compose up` + `gen-keys.sh`
if keys were removed.

`C:\Users\<you>\.veritia\banque-test-sofie\config.json` (written by beat 4's `setup`
command, run from **T3**, the Windows-native `outil-local` — see beat 4) needs **no manual
reset** between rehearsals — re-running `setup` for the next mandate always overwrites that
one folder (contracts §9.2); `agent.key` never moves, so `outil-local init` never needs
re-running either.
