Repository Public
1# demo-marketplace — "Brocante"23A second-hand marketplace where **publishing a listing requires a verified identity**. Node 18+, `node:http`4only, TypeScript SDK through a file dependency (`"@maclustr/identity": "file:../../sdk/typescript"`).56```bash7./setup.sh # builds the SDK if needed, npm install, provisions application + key + webhook, writes .env.local8npm start # http://localhost:88819```1011| Where | What |12|---|---|13| `server.mjs` → `publishGate()` | the server-side gate (local record + live check, fail closed) |14| `server.mjs` → `POST /api/identity/session` | session creation with the secret key; only `url` is returned |15| `server.mjs` → `POST /webhooks/identity` | raw body, `constructEvent`, deduplication on `event.id` |16| `server.mjs` → `sessionEnded()` | `verification.cancelled` / `.expired`: the pending session is forgotten, a record still under review for it is closed, the user can start again |17| `server.mjs` → `storeVerification()` | the four stored fields, protection against late or replayed events |18| `public/app.js` | `openVerification({ mode: "modal" })` from the browser SDK; no key |19| `public/index.html` | the badge and what it does and does not certify |2021Environment: `PORT`, `MLID_BASE_URL`, `MLID_SECRET_KEY`, `MLID_WEBHOOK_SECRET`, `DEMO_STATE_FILE`22(default `data/state.json`), `MLID_TIMEOUT_MS`, `MLID_MAX_RETRIES`.2324Demo shortcuts that must not be copied: the login is an unsigned cookie, the database is a JSON file, and25`/api/debug/events` exposes the webhook log for the end-to-end script.26