demo-wallet — "Northbank Wallet"
A wallet where raising the transfer limit requires a verified identity. Python 3.10+, FastAPI,
server-rendered pages, Python SDK (async client) installed from sdk/python.
bash
./setup.sh # uv venv, installs the SDK from the repository, provisions application + key + webhook
.venv/bin/python app.py # http://localhost:8882| Where | What |
|---|---|
app.py → limit_gate() |
the server-side gate (local record + live check, fail closed) |
app.py → raise_limit() |
the gated action; the request is saved before verification |
app.py → start_verification() + POST /verify/start |
session creation with return_url, then a 303 redirect to the hosted page |
app.py → GET /verify/return |
return page: the server looks the result up, nothing in the URL is trusted |
app.py → POST /webhooks/identity |
raw body, Webhook.construct_event, deduplication on event.id |
app.py → session_ended() |
verification.cancelled / .expired: the pending session is forgotten, a record still under review for it is closed, the user can start again |
app.py → GET /u/{handle} |
public badge and what it does and does not certify |
Environment: PORT, PUBLIC_URL, MLID_BASE_URL, MLID_SECRET_KEY, MLID_WEBHOOK_SECRET,
DEMO_STATE_FILE (default data/state.json), MLID_TIMEOUT, MLID_MAX_RETRIES.
Demo shortcuts that must not be copied: the login is an unsigned cookie, the database is a JSON file, and
/api/debug/events exposes the webhook log for the end-to-end script.