4.1.2. Architecture#
4.1.2.1. Components#
Taler exchange ── oauth2 KYC logic ─┐ ┌─ swiyu-verifier ............. swiyu
(/setup, /authorize, /token, /info) │ │
├──► KyCH ── adapters ────┼─ eudi-verifier ──┐
Beekeeper ── lookup worker ─────────┘ (OAuth 2.0, picker, │ waltid-verifier ├ one chosen eupid,
(beekeeper-kych) sessions, evidence, │ kych-oid4vp ────┘ eupid-mdoc
purge) │ └── kych-trust (lists of trusted entities)
├─ kych-eumw-bridge ── governikus-eumw ┐ one chosen npa
│ kych-eid ───────────────────────────┘
└─ kych-eumw-bridge ── eidas-node-connector ..... eidas
The person’s wallet, or AusweisApp, or the browser on its way through the eIDAS network, talks to the helper, never to KyCH. KyCH talks to each helper’s private management interface, and the reverse proxy publishes only the paths the outside world needs.
KyCH’s own components:
kych-oauth2-gatewayThe daemon. One PostgreSQL database (schema
oauth2gw): clients, sessions, authorization codes, access tokens. One adapter per helper type turns KyCH’s request into the helper’s and the helper’s outcome into KyCH’s claims and evidence. The daemon keeps no state outside the database, so it can be restarted at any time.kych-client-management,kych-dbinit,kych-dbconfigRegister clients from the configuration (
sync), run the sweeper once (purge), create and migrate the database.taler-exchange-kyc-kych-converterRun by the exchange: turns
/infointo GANA attributes.
Its helpers (Features and limitations lists them with their upstreams):
OpenID4VP verifiers for the EU PID:
eudi-verifier,waltid-verifier,kych-oid4vp; for the Swiss e-ID,swiyu-verifier.kych-trust, the one place where the lists of trusted entities are fetched, verified and kept, so that the three EU PID verifiers take the same trust decisions.
eID servers for the German card: the Governikus eIDAS Middleware behind
kych-eumw-bridge, orkych-eid.The eIDAS-Node Connector, behind
kych-eumw-bridgeagain.
Every program runs as a system user of its own, under systemd with
hardening options (no new privileges, a private /tmp, a read-only view
of the system; the helpers also restrict their address families), and keeps
its secrets in files readable only by itself and, where needed, by KyCH.
4.1.2.2. Trust boundaries#
Internet │ reverse proxy (TLS) │ host: local users only
──────────────────────────────────┼──────────────────────┼─────────────────────────────────────
person's browser ─── /authorize, /status, /finalize, /return ──► KyCH (kych-api socket)
client (exchange) ── /setup, /token, /info ────────────────────► KyCH
wallet ──────────── request object, response ───────────────► OID4VP helper (wallet paths only)
AusweisApp ──────── tcToken, PAOS ───────────────────────────► eID server (eID paths only)
foreign proxy svc ◄─ browser ─► Connector, bridge ───────────► eIDAS paths only
│ │ KyCH ──► helpers' management APIs
│ │ helpers ──► kych-trust
│ │ helpers ──► KyCH /notification (loopback)
PID providers' lists, status lists ◄──────────────────────── kych-trust, OID4VP helpers (outbound)
BerCA (TR-03129) ◄────────────────────────────────────────── eID server (outbound, mutual TLS)
Four boundaries matter:
The public interface. Everything a browser, a wallet, AusweisApp or a client reaches goes through the reverse proxy, which terminates TLS and forwards a fixed list of paths to Unix sockets. The proxy is the only process that listens on the network.
The management interfaces. The upstream helpers – the EUDI verifier, walt.id, swiyu-verifier, the middleware’s eID paths, the Connector’s Hazelcast – authenticate nobody. Each is held to a Unix socket or to loopback, and the proxy never publishes its management paths. KyCH’s own helpers (kych-oid4vp, kych-eid, kych-eumw-bridge) authenticate KyCH with a bearer secret on top of the socket.
The local host. Socket groups decide which local processes may connect to which socket (Sockets and groups). The eIDAS Connector’s Hazelcast caches have no authentication at all, so the host that runs them must have no untrusted local users.
Trust anchors. What a helper accepts depends on configuration only the administrator controls: the lists of trusted entities and their signers (kych-trust), the eID card’s master and block lists and the authorisation certificate (eID server), the foreign nodes’ metadata signers (Connector), the accepted issuer DIDs (swiyu). Threat model and security analysis analyses what crossing each boundary would give an attacker.
4.1.2.3. Sockets and groups#
KyCH and its helpers talk over Unix domain sockets, and a socket’s group
decides who may connect. KyCH’s own socket has a group of its own,
kych-api, so that the gateway’s clients are kept away from the helpers’
unauthenticated management APIs, which share the group www-data with the
reverse proxy.
Socket |
Owner:group, mode |
Who connects |
|---|---|---|
|
|
the reverse proxy ( |
|
group |
the proxy ( |
|
group |
the proxy (the two wallet paths), KyCH |
|
group |
KyCH (member of |
|
|
the proxy ( |
|
group |
KyCH (member of |
|
|
the proxy ( |
|
group |
KyCH, with the API secret |
|
group |
the proxy ( |
|
group |
KyCH and kych-oid4vp; with the EUDI verifier, kych-trust listens on
|
|
group |
the proxy ( |
|
Governikus middleware |
the proxy ( |
|
swiyu-verifier (default) |
KyCH; or its Unix socket, if configured |
|
the proxy’s loopback server |
helpers posting their notification to KyCH’s |
KyCH runs with kych-api as its primary group (so the socket it creates
gets it) and with kych (to read its configuration) and www-data (to
reach the helpers) as supplementary groups. A client of KyCH must never be
given www-data: it would reach the helpers’ management APIs directly. A
process gets a new group only when it starts, so the proxy needs a reload
and a worker a restart after adduser.
4.1.2.4. The session state machine#
Everything hangs off one row of oauth2gw.verification_sessions:
POST /setup GET /authorize outcome POST /token
─────────────► pending ───────────────► authorized ─────────────► verified ─────────────► completed
│ (picker first, │ (webhook, poll │ │
│ if no vocabulary │ or /return) │ │
│ is fixed) ├───────► failed │ │
│ │ (helper refused, │ │
│ │ person cancelled) │ │
└──────────┬───────────────┘ │ │
▼ 15 min after /setup ▼ code unused, ▼ token expires
expired 10 min (1 h); claims
purged earlier
POST /setup/CLIENT_IDcreates the session (pending) and answers a nonce; a body{"vocabulary": ..., "profile": ...}may fix either.GET /authorize/NONCErecordsscope,redirect_uriandstate, resolves the scope against the profile, and – once the vocabulary is fixed – starts a session at the vocabulary’s helper and pins the helper section on the KyCH session (authorized). Re-entry replays the helper’s stored answer instead of starting a second verification.POST /authorize/NONCEis the picker’s choice.The outcome arrives by one of three paths that share one completion statement, which changes only a session still
authorized: the helper’s webhook to/notification(swiyu, and walt.id, kych-oid4vp, kych-eid and the bridge when given aNOTIFY_URL); KyCH asking the helper while the browser polls/status(at most once a second per session, and every ten seconds as a fallback for walt.id and KyCH’s own helpers when they have a webhook; swiyu-verifier is never asked); or the browser coming back to/return/VERIFICATION_IDfrom a redirect helper. KyCH then fetches the claims and the evidence from the helper, keeps only the requested claims, and mints the authorization code (verified) – or records the reason (failed).GET /finalize/VERIFICATION_IDredirects to the client with the code, or, for a failed or expired session, witherror=access_denied.POST /tokenexchanges the code (single use) for an access token (completed);GET /info, with that bearer token [RFC6750], returns the claims,vocabulary,missingandevidence, and starts the purge grace.
Each multi-step change is one SQL statement, so that two requests racing (the webhook and a poll, two browser tabs) cannot both complete a session. KyCH OAuth2 Gateway RESTful API describes every endpoint.
4.1.2.5. Flows by helper kind#
4.1.2.5.1. OpenID4VP helpers (eupid, eupid-mdoc, swiyu)#
browser KyCH helper (verifier) wallet
│ /authorize │ │ │
│──────────────►│ start: DCQL query, │ │
│ │ trust, registration cert │ │
│ │─────────────────────────►│ │
│ │◄── request URI, deep link│ │
│◄── QR code, deep link │ │
│ ··· person scans or taps ···························► fetches │
│ │ │◄── signed request ──│
│ │ │ (once only) │
│ │ │◄── vp_token ────────│ (direct_post.jwt,
│ │ │ checks: signature, │ encrypted to the
│ │ │ trust (kych-trust),│ helper)
│ │ │ status list, holder│
│ │ │ binding │
│ │◄── webhook (or poll) ────│ │
│ /status ─────►│── outcome? ─────────────►│ │
│◄── verified │◄── claims + evidence ────│ │
│ /finalize ───►│ │ │
│◄── 302 redirect_uri?code=...&state=... │ │
A wallet on the same device as the browser returns the person to
/return/VERIFICATION_ID when the helper hands it KyCH’s BASE_URL
(the EUDI verifier and walt.id do, for an https base). The request object
is a signed JWT [RFC7519] (JAR, [RFC9101]), signed with the relying
party’s access certificate; its client id is the
certificate’s hash (HAIP’s x509_hash) or its DNS name, and it carries the
registration certificate of the intended use. The wallet’s answer is
encrypted to a key of the helper (direct_post.jwt, a JWE [RFC7516]).
4.1.2.5.2. eID server (npa)#
browser KyCH kych-eumw-bridge middleware AusweisApp + card
│/authorize │ │ │ │
│────────────►│ POST /sessions │ │ │
│ │───────────────►│ │ │
│◄── 302 to the bridge's start page │ │
│─────────────────────────────►│ signed SAML │ │
│◄── POST to the middleware ───│ AuthnRequest │ │
│────────────────────────────────────────────────►│ tcToken, PAOS, EAC ───►│ PIN
│ │ │◄── data groups ────────│
│◄── SAML response (signed, encrypted) ───────────│ │
│─────────────────────────────►│ decrypt, verify │ │
│ │◄── notification│ │ │
│◄── 302 /return/ID ───────────│ │ │
│────────────►│ outcome, claims, evidence │ │
│◄── 302 redirect_uri?code=... │ │
With kych-eid the middle two columns are one program and there is no
SAML: KyCH sends the browser to kych-eid’s start page, which starts
AusweisApp (http://127.0.0.1:24727/eID-Client?tcTokenURL=...);
AusweisApp fetches the tcToken and runs the PAOS dialogue with kych-eid,
which performs Terminal Authentication with the authorisation certificate,
Chip Authentication, Passive Authentication against the master list, the
block-list check and the reading of the data groups, then sends the browser
to /return. The result never travels through the browser.
4.1.2.5.3. eIDAS (eidas)#
browser KyCH kych-eumw-bridge Connector (DE) foreign proxy service
│/authorize │ │ │ │
│────────────►│ POST /sessions │ │
│◄── 302 to the bridge: choose the country │ │
│──────────────────────────►│ light request into │ │
│ │ Hazelcast, light token │
│◄── POST light token to the Connector ─────────────│ │
│──────────────────────────────────────────────────►│ signed SAML request │
│◄──────────────────────────────────────────────────│───────────────────────►│ person identifies
│◄── SAML response (signed, encrypted) ─────────────────────────────────────│ with home eID
│──────────────────────────────────────────────────►│ decrypt, verify │
│ │◄── light response ────│ (metadata trust) │
│◄── 302 /return/ID ────────│ check LoA, attributes │ │
│────────────►│ outcome, claims, evidence │ │
Every XML signature and decryption is the Connector’s; the bridge checks the level of assurance and the attributes and, with KyCH’s patch, receives the signed response and the decrypted assertion for the evidence.
4.1.2.6. The KyCH-native helper API#
KyCH’s own helpers – kych-oid4vp, kych-eid and kych-eumw-bridge – speak one HTTP API, designed so that other helpers could implement it later (KyCH-native Helper RESTful API):
GET /config– the protocol version, the kinds (oid4vp,eid-server,eidas-saml) and formats the helper serves, whether it is available (kych-eid saysunavailablewith an expired terminal certificate or a stale block list).POST /sessions–{kind, vocabulary, request, trust, registration_certificate, return_url, notify_url, expires, reference}, whererequestis a DCQL query or a list of attributes, each required or optional; the answer names awallet_urlanddeeplinkor abrowser_url.GET /sessions/ID[?wait=SECONDS]–pending,verified,failedorexpired, with the claims and the evidence in KyCH’s own shape, or an error{code, kind, hint}; it can long-poll.DELETE /sessions/ID, and the notificationPOST notify_url {"session_id"}, which carries no personal data: KyCH fetches the outcome itself.
Authentication is a bearer secret on top of a Unix socket or loopback; kych-oid4vp and kych-eid compare it in constant time.
4.1.2.7. How the exchange and Beekeeper use KyCH#
The exchange uses its oauth2 KYC logic: a [kyc-provider-*]
section with KyCH’s URLs, the #setup suffix that makes it call
/setup first, the scope kyc and the converter
taler-exchange-kyc-kych-converter, which turns /info into GANA
attributes – names, birth data, NATIONALITIES, the address, the
document data, IDENTIFICATION_METHOD,
IDENTIFICATION_LEVEL_OF_ASSURANCE, IDENTIFICATION_EVIDENCE and
IDENTIFICATION_PERSON_IDENTIFIER. A measure’s CONTEXT.setup_body
becomes the body of /setup and so can preselect a vocabulary. The AML
program taler-exchange-helper-measure-identification-check then decides
whether the identification is complete and of an accepted method and level,
and otherwise triggers a fallback measure (documents through Beekeeper). The
exchange does not fall back from one provider to another by itself.
Beekeeper has no HTTP client in its web server by design. An eid
question in a Beekeeper form makes its lookup worker run the helper
beekeeper-kych, which calls /setup and later /token and /info
over KyCH’s socket or public URL; the browser goes to KyCH and back to
Beekeeper’s return endpoint. The claims fill the question’s answer, the
evidence becomes its analysis result, and a mismatch with the names or dates
a company stated sends the case to a reviewer. This is how every natural
person of a KYB case – representatives, beneficial owners – identifies by
eID on their own device, with a documents fallback and a recorded reason
when that fails.
The exchange and Beekeeper gives the configuration of both.