26.48. kych.conf(5)#
26.48.1. Name#
kych.conf - configuration file of the KyCH OAuth 2.0 gateway
26.48.2. Description#
kych-oauth2-gateway(1) and kych-client-management(1) read their configuration
from a file in the GNU Taler configuration format, the same one every other
GNU Taler component reads. It holds one [kych-oauth2-gateway] section with
the settings of the service itself, and five families of sections that refer
to each other by name:
[vocabulary-NAME]A source of identity – the Swiss e-ID, the EU PID in either encoding, the German eID card, another member state’s eID – and the claims it delivers, under their native names.
[helper-NAME]A helper program that does the protocol and cryptographic work for a vocabulary, such as swiyu-verifier, and how KyCH reaches it.
[trust-NAME]Which issuers a vocabulary accepts.
[profile-NAME]The claims one purpose needs, per vocabulary, each required or optional. A client asks for a profile by putting its name into the OAuth 2.0 scope.
[client_NAME]An OAuth 2.0 client and the vocabularies and profiles it may use.
The whole configuration is checked when it is loaded, references between sections included, so that a configuration that cannot work stops the daemon at start. An error about an option that is set names the file and the line it was set at, as well as the section and the option.
Both tools take the file from the -c option. Without it, they read the first of
$XDG_CONFIG_HOME/kych.conf$HOME/.config/kych.conf/etc/kych.conf/etc/kych/kych.conf
that exists; the Debian package installs the last of these. Before any of
them, every file in $PREFIX/share/kych/config.d/ is read, so that
package-supplied defaults can be overridden rather than edited. Later
settings win over earlier ones.
The file contains the database credentials and the client secrets, and should not be world-readable.
Nothing is re-read at run time; restart the service after editing.
26.48.2.1. Syntax#
Comments are introduced by # or % and must stand on a line of their
own; ; is not a comment character. The parser has no notion of a
trailing comment, and the two places where one might be written fail
differently:
after a value, as in
PORT = 8080 # the port, the#and everything after it become part of the value, which then fails to parse as a number;after a section header, as in
[client_x] # the exchange, the line is no longer recognised as a section header at all and the file is rejected withExpected section header, option assignment or directive.
Section names are case-insensitive, and so are option names. Values are trimmed of surrounding whitespace; a value wrapped in double quotes keeps whatever whitespace is inside them, with the quotes removed.
Several options take a list. The braces are conventional but optional, and
items are separated by commas, by whitespace, or by both, so {ES256, ES384},
ES256, ES384 and ES256 ES384 are the same list. An option that is
present but names no item at all is an error. In the claim lines of a
[profile-*] section, and only there, an item may end in ? to mark the
claim optional: {family_name, address?}.
Options that name another section (HELPER, TRUST, VOCABULARIES,
PROFILES) give its name without the prefix: HELPER = swiyu refers to
[helper-swiyu]. Section names are case-insensitive, so these references
are too.
Options that name a path - UNIXPATH, SQL_DIR and LOTE_SIGNER - expand $VAR and
${VAR} from the [paths] section and from the environment, and
${VAR:-default} supplies a fallback. $PREFIX, $BINDIR,
$LIBEXECDIR, $DOCDIR, $ICONDIR, $LOCALEDIR, $LIBDIR and
$DATADIR are predefined, derived from where kych-oauth2-gateway was
found on $PATH.
26.48.2.2. Including other files#
A directive on a line of its own pulls in another file, relative to the directory of the file the directive appears in. A directive ends the current section, so an option written after one needs its section header repeated.
- @inline@ FILE
Include the whole of
FILEat this point.- @inline-matching@ GLOB
Include every file matching
GLOB, in glob order.- @inline-secret@ SECTION FILE
Include only
[SECTION]fromFILE, and merge it into the section of that name. This is how the database password and the client secrets are kept out of the main configuration file: the main file stays readable to whoever needs to inspect it, and only the small included file has to be restricted. A missing file is a warning rather than an error, on the theory that a component which does not need the secret should still start.
For example, in /etc/kych/kych.conf:
@inline-secret@ kych-oauth2-gateway secrets/database.conf
with /etc/kych/secrets/database.conf holding:
[kych-oauth2-gateway]
DATABASE = postgres://kych:SECRET@db.example.com/kych
26.48.2.3. GLOBAL OPTIONS#
The following options are from the [kych-oauth2-gateway] section.
26.48.2.3.1. Server Binding#
- SERVE
How the server obtains its listening socket. Required. One of:
unixBind a Unix domain socket at
UNIXPATH.tcpBind a TCP socket at
BIND_TOandPORT.systemdTake an already-bound socket from the service manager, as passed in
$LISTEN_FDS. Either kind of socket is accepted, and nothing else in this section is read. Starting the daemon this way without an activated socket fails withMissing systemd activated socket.
In every case the server speaks plain HTTP and does not terminate TLS; put a reverse proxy in front of it.
- BIND_TO
IP address to bind the TCP server to, e.g.
127.0.0.1or::. Required whenSERVE = tcp. Do not bind an address reachable from outside the host.- PORT
TCP port number to listen on, e.g.
8080. Required whenSERVE = tcp.- UNIXPATH
Path to the Unix domain socket file, e.g.
/run/kych/kych.sock. Required whenSERVE = unix. The server creates the socket itself and unlinks a leftover socket of a previous run at startup. The directory must already exist.- UNIXPATH_MODE
File permissions for the Unix domain socket, in octal. Required when
SERVE = unix. The socket’s group is the group the server runs as, so660plus a group of its own is the usual way to restrict it to the reverse proxy: the Debian package runs the server with groupkych-api, whose members are the proxy (www-data) and KyCH’s local clients such as Beekeeper’s lookup worker. Do not use the group of a helper’s socket for it (www-datafor the EUDI and walt.id verifiers): their management APIs authenticate nobody, so a client of KyCH must not be able to open them.
26.48.2.3.2. Database#
- DATABASE
PostgreSQL connection string for the database. Required.
Both the URI form,
postgres://user:secret@localhost/kych, and a URI naming a Unix socket directory,postgres:///kych?host=/var/run/postgresql, are understood. Anything the string leaves out is taken from the usualPGHOST,PGPORT,PGUSER,PGPASSWORD,PGDATABASEandPGSSLMODEenvironment variables, or, for the user name, from the account the process runs as - which is what makes peer authentication work without a password in the file. The~/.pgpassfile is not consulted for a connection string in URI form.Two details of that syntax are worth knowing, because getting them wrong produces a connection to somewhere else rather than an error:
A
host=parameter whose value begins with/selects a Unix socket directory, not a host name. Written as the authority instead it has to be percent-encoded:postgres://%2Fvar%2Frun%2Fpostgresql/kych.The port is read from the authority part only;
?port=is ignored. A server on another port is thereforepostgres://localhost:5433/kych?host=/var/run/postgresql– thelocalhostthere is a placeholder that the socket parameter overrides.
With neither given, the socket directory is found by looking for
.s.PGSQL.5432in/var/run/postgresqland then/tmp, falling back to a TCP connection tolocalhost.The schema is created by kych-dbconfig(1) and kept up to date by kych-dbinit(1); see those pages. The daemon itself never creates or migrates it.
- SQL_DIR
Directory holding
versioning.sqland theoauth2gw-000N.sqlpatch files. Read by kych-dbinit(1) only; the daemon ignores it. Optional, and defaults to$DATADIR/sql, which resolves to/usr/share/kych/sqlfor an installation under/usr. In a source tree the patches are inoauth2_gatewaydb/, which kych-dbinit’s--sql-dircan also name directly.
26.48.2.3.3. Cryptographic Parameters#
All three sizes are counts of random bytes, before base64url encoding. The recommended value is 32 in each case, and lowering it directly weakens the unguessability that the corresponding secret relies on.
- NONCE_BYTES
Number of random bytes to generate for the nonce created by
/setup, which forms the secret part of the authorization URL given to the user. Required. Recommended value:32.- TOKEN_BYTES
Number of random bytes to generate for the OAuth 2.0 access token issued by
/token. Required. Recommended value:32.- AUTH_CODE_BYTES
Number of random bytes to generate for the OAuth 2.0 authorization code. Required. Recommended value:
32.- AUTH_CODE_TTL_MINUTES
Validity period for authorization codes in minutes. Default:
10. The code is single-use in any case.
26.48.2.3.4. Vocabularies#
- VOCABULARIES
The vocabularies this installation offers, each the name of a
[vocabulary-*]section. Required, and must not be empty. A client may use only vocabularies listed here, and every vocabulary listed here must name a helper that this version of KyCH can talk to; a vocabulary that is defined but not listed is checked for errors and otherwise ignored. Example:{swiyu}.- PURGE_GRACE
How long the claims and the evidence of a verification – the raw presentation included – are kept after the client first fetched them from
/info, so that it can retry. A duration such as1 h,30 minorPT90S. Optional, and defaults to1 h. After that,/infoanswers410 Gonewithclaims_purged. They are deleted when the client’s access token expires in any case, an hour after/token, whichever comes first; and a session that never got as far as a token is deleted with everything in it once it has expired.- PURGE_INTERVAL
How often the gateway deletes what
PURGE_GRACEand the expiry of sessions, codes and tokens allow. A duration, optional, defaulting to5 min; the first sweep runs when the gateway starts.0 sswitches the gateway’s own sweeper off, for a cron job that runs kych-client-management purge instead (kych-client-management(1)). Either way, a deletion happens at the first sweep after it is due, so data is kept up to one interval longer than the rules say.- BASE_URL
The gateway’s public base URL, as browsers and clients reach it through the reverse proxy, ending in
/, e.g.https://kych.example.com/. Optional. KyCH gives helpers absolute URLs made from it: aneudi-verifierorwaltid-verifier2helper hands a wallet on the same deviceBASE_URLreturn/VERIFICATION_IDto send the browser back to once it has presented (only for anhttpsbase: the EUDI verifier allows no other redirect), and the browser-redirect helpers of later versions need it to return the person at all. Without it, a same-device wallet just says it is done, and the page in the browser notices by polling/status. A query or fragment is an error; plainhttpis accepted with a warning unless the host is a loopback one.- KYCH_TRUST_URL
Where kych-trust(1) answers, as a base URL, e.g.
http://127.0.0.1:18090(the shipped default). The adapter of aneudi-verifierhelper asks it, after a verification, which listed certificate the issuer’s chain ends at and on which snapshot of which list – the decision the verifier was given as well – and puts that into the evidence (evidence.trust). The adapter of awaltid-verifier2helper withTRUST = kych-trustalso asks it, before every verification, for the anchors it hands walt.id. Required when an enabled vocabulary is served by aneudi-verifierhelper or by awaltid-verifier2helper withTRUST = kych-trust; read by nothing else.- KYCH_TRUST_UNIXPATH
Instead of
KYCH_TRUST_URL: kych-trust’s Unix domain socket, e.g./run/kych-trust/kych-trust.sock. Exactly one of the two may be set; to replace the shipped URL, setKYCH_TRUST_URL =to nothing. Note that the EUDI verifier itself can only reach kych-trust over TCP.
The options VC_TYPE, VC_FORMAT, VC_ALGORITHMS and VC_CLAIMS
of earlier versions are no longer read; the credential is described by a
[vocabulary-*] section instead (VCT, FORMAT, ALGORITHMS and
CLAIMS). Any of them left in this section is an error.
26.48.2.3.5. Scope Restrictions#
- ALLOWED_SCOPES
Optional policy restriction on which claims clients may request by their native names. If set, a scope that names a claim directly must name only claims listed here, even if the vocabulary defines more. It does not apply to profiles, which are the operator’s own definitions anyway. Example:
{family_name, age_over_18}.This is the operator’s lever for data minimisation where clients name claims, and it is worth setting: without it, a client is trusted to ask only for what it needs.
26.48.2.4. VOCABULARY SECTIONS#
A [vocabulary-NAME] section describes one source of identity. The
vocabularies the package defines are listed under SHIPPED VOCABULARIES.
- KIND
How the person identifies. Required. One of:
oid4vpA wallet presents a credential over OpenID for Verifiable Presentations.
eid-serverThe German eID card’s online function, through an eID server.
eidas-samlAnother member state’s notified eID, through the eIDAS-node network.
- FORMAT
For
KIND = oid4vponly, and required there: the credential format,dc+sd-jwt(SD-JWT VC, the current name),vc+sd-jwt(its older name) ormso_mdoc(ISO/IEC 18013-5 mdoc).- VCT
For an SD-JWT VC format, and required there: the accepted values of the credential’s
vctclaim, as a list. The first is what/configreports asvc_type.- DOCTYPE
For
FORMAT = mso_mdoc, and required there: the mdoc document type.- NAMESPACE
For
FORMAT = mso_mdoc: the namespace of the data elements. Optional, and defaults toDOCTYPE.- ALGORITHMS
Signature algorithms, advertised on
/config. Optional. DCQL has no place for them, so they are not sent to any helper.- WALLET_SCHEMES
For
KIND = oid4vponly: the URL schemes, besideshttps, that the QR code and the wallet deep link a helper hands out may use. KyCH shows the person no other, so that a confused or compromised helper cannot have it render ajavascript:link. A list of scheme names, with or without the trailing://. Optional, and defaults to every scheme the known wallets and verifiers use:openid4vp(OpenID4VP’s own),eudi-openid4vp,mdoc-openid4vp,haip-vp(the EUDI reference wallets;haip-vpis the EUDI verifier’s default),haip(walt.id) andswiyu-verify(swiyu-verifier’sDEEPLINK_SCHEMA). Schemes that are never a wallet’s, such ashttp,javascript,dataorfile, are refused.- CLAIMS
Every claim the credential can carry, under its native name. Required. A client may request only claims from this list. How a name is read depends on the format:
For SD-JWT VC it is a path into the credential: components separated by
., and a trailing[]on a component selecting every element of an array.address.localityasks for one member of theaddressobject,nationalities[]for every element of thenationalitiesarray. Ask for members and elements rather than for the object or array that holds them: wallets differ in what a parent path discloses, and some send only the parent itself, so thataddressarrives as{}andnationalitiesas[].For mdoc it is a data element identifier in the namespace. A path into an element cannot be asked for, so
.,[and]are not allowed.For the other kinds it is the attribute name as the eID server or the eIDAS node uses it, taken as it is. eIDAS attribute names are URIs, dots and all.
In
/infoa claim appears under its first path component, without[], holding the value as the credential nests it. The namesvocabulary,evidenceandmissingare reserved for KyCH’s own use there, so no vocabulary may define a claim that would appear under one of them. A trailing?is not allowed here; whether a claim is optional is a profile’s decision.- HELPER
The
[helper-*]section that serves this vocabulary. Required for every vocabulary inVOCABULARIES. Changing it applies to new sessions only: a session finishes on the helper section it started on.- TRUST
The
[trust-*]section saying which issuers this vocabulary accepts. Required when the helper needs one, which aswiyuhelper does.
26.48.2.5. HELPER SECTIONS#
A [helper-NAME] section describes a helper program and how KyCH reaches
its private (management) API. That API must not be reachable by anyone else:
none of the upstream helpers authenticates its caller, and KyCH’s own
(kych-native) do so with a secret on top of the socket. KyCH warns at
start about a helper reached over the network.
- TYPE
Which kind of helper it is, and so which adapter KyCH uses. Required. One of
swiyu(swiyu-verifier),eudi-verifier(the EUDI reference verifier),waltid-verifier2(walt.id verifier-api2),kych-native(KyCH’s own helpers),eumw-saml(the Governikus eIDAS Middleware) oreidas-saml(an eIDAS connector).swiyu,eudi-verifier,waltid-verifier2andkych-nativeare implemented in this version; the middleware and the eIDAS connector are reached through kych-eumw-bridge, akych-nativehelper. A section of another type is accepted, so that a configuration can be written ahead, but enabling a vocabulary that uses it fails with... is not implemented yet.The helper type must suit the vocabulary:
swiyu,eudi-verifierandwaltid-verifier2serveoid4vpvocabularies,eumw-samlserveseid-server,eidas-samlserveseidas-saml, andkych-nativeserves all three – each helper’s/configsays which of them it actually does, and a session of another kind is refused at/authorize.- UNIXPATH
The Unix domain socket the helper listens on, e.g.
/run/swiyu-verifier/http.sock. The user KyCH runs as must be allowed to open it.- URL
A base URL instead, normally on the loopback interface, e.g.
http://127.0.0.1:8080. Exactly one ofUNIXPATHandURLmust be set; to replace aURLfrom the shipped defaults with a socket, setURLto nothing (URL =) next toUNIXPATH.- MANAGEMENT_API_PATH
For
TYPE = swiyu: the path of the verifier’s management API below the base. Default:/management/api/verifications.
For TYPE = eudi-verifier (the package eudi-verifier, eudi-verifier(1)):
- CLIENT_ID_PREFIX
The verifier’s own
VERIFIER_CLIENTIDPREFIX:x509_hash(the default) orx509_san_dns. Withx509_hashKyCH asks for the HAIP profile, which the verifier enforces as encrypted responses (direct_post.jwt) and the request object by reference; withx509_san_dns, for plain OpenID4VP.- RESPONSE_MODE
direct_post.jwt(the default: the wallet encrypts its response to a key of the transaction) ordirect_post.x509_hashtakesdirect_post.jwtonly.- REQUEST_URI_METHOD
How the wallet fetches the request object:
get(the default) orpost(OpenID4VP 1.0, section 5.10).- REGISTRATION_CERTIFICATE
A file holding the relying party’s registration certificate (a compact JWS,
rc-wrp+jwt), sent with every transaction whose profile names none of its own (seeREGISTRATION_CERTIFICATEunder PROFILE SECTIONS). The verifier refuses a transaction without one. Read at start.- INTENDED_USE_ID
Instead of
REGISTRATION_CERTIFICATE: the id of one of the verifier’s ownverifier.intendedUses, whose certificate it then uses.
A vocabulary served by an eudi-verifier helper must be dc+sd-jwt or
mso_mdoc, and must name a [trust-*] section with a list of trusted
entities: the verifier trusts every issuer unless its Trust Validator,
kych-trust, says otherwise, so KyCH refuses to start without one, and
without KYCH_TRUST_URL or KYCH_TRUST_UNIXPATH. Each profile covering
the vocabulary needs a registration certificate, its own or the helper’s.
The verifier itself must point its VERIFIER_TRUSTVALIDATOR_SERVICEURL at
the same kych-trust; KyCH cannot check that.
The EUDI verifier has no webhook: KyCH asks it on every /status poll,
and fails the session when the verifier refused what the wallet posted,
when the transaction expired there, or when the verifier does not know it
(it keeps transactions in memory only, so after a restart). Two vocabularies
of one eudi-verifier helper – the EU PID as an SD-JWT VC and as an mdoc
– are one choice on the picker: one request offers the wallet both through
DCQL credential_sets, and /info names the vocabulary of what it sent.
For TYPE = waltid-verifier2 (walt.id verifier-api2, the package
waltid-verifier, waltid-verifier(1)):
- TRUST
Where the trust policy KyCH sends with every session gets its trust anchors. walt.id’s
signaturepolicy checks a signature, not who made it, so KyCH always sends one of two (kych-trust(1) explains the choice):kych-trustThe default.
x509-trustwith the anchors kych-trust’s current snapshot has for the vocabulary’s verification context (the trust section’sCLASS,PIDif none), and the anchors of its status context (PIDStatus) for the signer of the status list. The same decision as the EUDI verifier’s, by construction;evidence.trustnames kych-trust’s anchor and snapshot. NeedsKYCH_TRUST_URLorKYCH_TRUST_UNIXPATH.selfetsi-trust-listwith the trust section’s list –LOTE_URL, which walt.id then fetches itself, or the content ofLOTE_FILE– and itsLOTE_SIGNERcertificate, read at every session, so that walt.id checks the list’s signature and decides itself; for an installation without kych-trust.evidence.trusthas walt.id’s own match on the list instead of kych-trust’s record, and names no snapshot. The signer certificate must be readable by KyCH.
- RESPONSE_MODE
direct_post.jwt(the default: the wallet encrypts its response to a key of the session) ordirect_post.- NOTIFY_URL
Where walt.id posts its webhook, e.g.
http://localhost:18444/notification: a location of the reverse proxy on the loopback interface that leads to KyCH’s/notification, since walt.id cannot call a Unix domain socket, and that walt.id’snetwork-fetch-guard.conflets it reach (waltid-verifier(1)). Optional; without it KyCH asks walt.id on every/statuspoll instead. With it, KyCH still asks every ten seconds while the browser polls, since no webhook comes when walt.id let the session expire or lost it in a restart.- MAX_AGE
How long walt.id accepts the wallet’s answer, a duration. Optional, and defaults to
15 min, the lifetime of KyCH’s own session.
The service’s own identity – its access certificate, hence its client id
(x509_hash or x509_san_dns), and its public URL – is configured in
walt.id, not here. KyCH asks for a signed request object, fetched by
reference (request_uri_method=post), one attempt per session (a refused
presentation fails the session), and checks of validity (expiration,
not-before) and status (credential-status) besides the trust
policy. A vocabulary served by a waltid-verifier2 helper must be
dc+sd-jwt or mso_mdoc and name a [trust-*] section with a list of
trusted entities; KyCH refuses to start otherwise. Two vocabularies of one
such helper are one choice on the picker, as for eudi-verifier. walt.id
keeps sessions in memory: after a restart it knows none, and KyCH fails the
sessions in flight.
For TYPE = kych-native (KyCH’s own helpers, which speak the
KyCH-native helper API: kych-oid4vp of the package kych-oid4vp,
kych-oid4vp(1), for oid4vp; kych-eumw-bridge of the package of that
name, kych-eumw-bridge(1), for eid-server, in front of the Governikus
eIDAS Middleware, and for eidas-saml, as the member-state-specific part
of the EU eIDAS-Node Connector of the package eidas-node-connector,
eidas-node-connector(1); kych-eid of the package of that name, kych-eid(1),
KyCH’s own eID server, for eid-server too):
- API_SECRET
The bearer secret the helper authenticates KyCH by: the same value as the helper’s own
API_SECRET(kych-oid4vp.conf(5)). Required as soon as an enabled vocabulary uses the helper. Keep it out of kych.conf, in a file holding just the section and the option, pulled in with@inline-secret@ helper-NAME FILE. The package kych-oid4vp generates one that KyCH may read,/etc/kych-oid4vp/secrets/api.secret.conf, with the section[helper-kych-oid4vp]beside its own; the package kych-eumw-bridge/etc/kych-eumw-bridge/secrets/api.secret.conf, with[helper-eumw]; the package kych-eid/etc/kych-eid/secrets/api.secret.conf, with[helper-kych-eid].- NOTIFY_URL
Where the helper posts
{"session_id": ...}when a session ends, which KyCH hands it with every session: KyCH’s/notification. Either a loopback location of the reverse proxy that leads to it, e.g.http://localhost:18444/notification(the example nginx sites have one), or KyCH’s own socket, percent-encoded as the host of anhttp+unixURL, e.g.http+unix://%2Frun%2Fkych%2Fkych.sock/notification, which the helper’s user must then be allowed to open (adduser kych-oid4vp kych-api: the socket’s group in the Debian package). Optional; without it KyCH asks the helper on every/statuspoll, at most once a second; with it, every ten seconds as well, for a notification that was lost.- MAX_AGE
How long the helper accepts the wallet’s answer, a duration: the expiry KyCH asks for. Optional, and defaults to
15 min, the lifetime of KyCH’s own session. The helper may shorten it (its ownMAX_AGE).- REGISTRATION_CERTIFICATE
A file holding the relying party’s registration certificate (a compact JWS), which the helper hands the wallet with a request whose profile names none of its own. Optional: kych-oid4vp sends one when it has one, and needs none.
For an oid4vp vocabulary, KyCH sends the helper the same DCQL query as
to the other EU PID helpers, and per credential query the trust section’s
CLASS (PID if it names none) and LEVEL_OF_ASSURANCE: the helper
asks kych-trust whether the issuer’s chain ends at a provider of that class,
and whether a status list’s signer is one of its revocation services. Such
a vocabulary must therefore be dc+sd-jwt or mso_mdoc and name a
[trust-*] section with a list of trusted entities; KyCH refuses to
start otherwise. The helper’s answer carries the evidence in KyCH’s own
shape, which KyCH checks and passes on. Two vocabularies of one
kych-native helper are one choice on the picker, as for
eudi-verifier. kych-oid4vp keeps its sessions in its own database: a
session survives a restart of the helper.
For an eid-server vocabulary, KyCH sends the helper the attributes the
profile or scope asks for, each with whether it is required, and the URL of
/return; the helper’s answer names the browser URL KyCH redirects to.
kych-eumw-bridge refuses a session that requires an attribute its route
cannot deliver; an optional one is reported in missing. It keeps its
sessions in memory: after a restart KyCH fails the sessions in flight.
How KyCH learns of a helper session’s outcome depends on the type. A
swiyu helper calls KyCH’s /notification webhook, so that the verifier
has to be configured with KyCH’s URL; so does a waltid-verifier2 or
kych-native helper with a NOTIFY_URL, which KyCH hands it with every
session. A helper without a webhook – the EUDI
verifier, walt.id and KyCH’s own without NOTIFY_URL, and the eID-card and eIDAS helpers – is asked by KyCH itself
whenever the browser polls /status, or comes back to /return, at most
once a second per session. Either way, KyCH then fetches the result from
the helper; the webhook only says when to look.
Which of them the person deals with follows from the vocabulary: for
KIND = oid4vp the browser shows a QR code and a deep link for the wallet,
for eid-server and eidas-saml it is sent to the helper, which sends it
back to /return/VERIFICATION_ID on the KyCH host. That path, like
/authorize, must be reachable from the person’s browser.
A swiyu helper verifies SD-JWT VCs only, needs a [trust-*] section
with ACCEPTED_ISSUER_DIDS, and cannot be asked for optional claims:
swiyu-verifier 5.0.1 rejects the DCQL claim_sets that optional claims
are requested with. A profile with an optional claim for a vocabulary served
by such a helper is an error. A swiyu helper also takes no
credential_sets, so its vocabularies are always separate choices.
26.48.2.6. TRUST SECTIONS#
A [trust-NAME] section says which issuers a vocabulary accepts. It holds
exactly one of ACCEPTED_ISSUER_DIDS and a list of trusted entities
(LOTE_URL or LOTE_FILE):
- ACCEPTED_ISSUER_DIDS
The DIDs of the accepted issuers, as a list, sent with every verification to a
swiyuhelper. Example:{did:tdw:Qm...:identifier-reg.trust-infra.swiyu-int.admin.ch:api:v1:did:...}.- LOTE_URL
The URL of a signed list of trusted entities (ETSI TS 119 602), such as the Commission’s list of PID providers. Requires
LOTE_SIGNER. The gateway only checks that the section is complete: kych-trust(1) fetches, verifies and serves the list, and the helpers that use it ask kych-trust.- LOTE_FILE
Instead of
LOTE_URL: a local copy of the list, kept up to date by other means.- LOTE_SIGNER
With
LOTE_URLorLOTE_FILE: the PEM file holding the scheme operator’s certificate the list must be signed with, or chain to. An unverified trust list is no trust list, so it is required.- LEVEL_OF_ASSURANCE
With a list: the eIDAS level of assurance a credential reaches whose issuer is on this list and whose holder binding the helper verified, e.g.
highfor the Commission’s list of PID providers (a PID presented with a verified key binding is LoA high). Optional, and deliberately without a default:evidence.level_of_assuranceis reported only where this says so – never for a simulated list, and never assumed from the vocabulary.
The same sections configure kych-trust(1). Keep them in a file of their own
and pull it into both kych.conf and kych-trust.conf with
@inline@. Of the options only kych-trust uses, the gateway reads
CLASS: the verification context (PID, PubEAA, …) it asks
kych-trust about for the evidence, PID if absent. It leaves alone
USE_CASE, LOTE_TYPE, ISSUANCE_SERVICE_TYPE and
REVOCATION_SERVICE_TYPE, which kych-trust.conf(5) describes; kych-trust
in turn ignores LEVEL_OF_ASSURANCE.
26.48.2.7. PROFILE SECTIONS#
A [profile-NAME] section lists the claims one purpose needs. A client
allowed the profile asks for it with scope=NAME, and gets the profile’s
claims of whichever vocabulary its session uses. The name must not also be a
claim name of any vocabulary, since a scope naming it would be ambiguous.
- VOCABULARY
One option per vocabulary the profile covers, named like the vocabulary (
EUPID,EUPID-MDOC,SWIYU, …), listing claims from that vocabulary’sCLAIMS. A claim ending in?is optional: requested, but a credential without it is still accepted, and/infowill report it as missing. Each line needs at least one required claim. At least one such option is required.Optional claims are sent to OID4VP helpers as DCQL
claim_sets: every combination of the optional claims, most complete first, so that the wallet discloses all of them that the credential has. The number of combinations doubles with each optional claim and is cut off at 64, so keep optional claims to a handful per line. Six always fit; beyond that, the combinations sent are those that keep the optional claims listed earlier, so list them most-likely-present first. A credential matching none of the combinations sent is still accepted with its required claims alone.- RETAIN
YESif the client keeps what it receives, as a KYC client under AML law does. Sent to mdoc wallets asintent_to_retain. Default:NO.- REGISTRATION_CERTIFICATE
A file holding the registration certificate (a compact JWS,
rc-wrp+jwt) of the intended use this profile is registered as. Sent with every request for the profile by the helpers that take one (the EUDI verifier requires one); without it, the helper’s own default applies. Read at start.
Each profile should match an intended use registered for the relying party, since a wallet compares the request against that registration.
26.48.2.8. CLIENT SECTIONS#
Each OAuth2 client is configured in a separate section with a name starting
with client_, for example [client_merchant] or [client_exchange];
the rest of the name is arbitrary.
Note
These sections are not read by the running gateway, which resolves clients from the database. They are the input to
$ kych-client-management -c /etc/kych/kych.conf sync
which creates or updates the corresponding database rows; see kych-client-management(1). Until that command has been run, a newly described client does not exist, and requests on its behalf are rejected as unauthorized. The gateway does check them at start, though.
- CLIENT_ID
Unique identifier for this OAuth2 client, used at
/setupand at/token. Required.- CLIENT_SECRET
Secret key for client authentication, stored bcrypt-hashed in the database. Required.
It is read only when the client is first created. Changing it here and running sync again does not rotate the stored secret; delete the client and synchronize again for that.
- REDIRECT_URI
OAuth2 callback URL where the authorization response will be sent. Required, and must not be empty. Must match the redirect URI registered with the client application. Several may be given as one comma-separated value; the redirect_uri of an authorization request must match one of them exactly, and the same value must be repeated on the token request. Example:
https://merchant.example.com/kyc/callback.- VOCABULARIES
The vocabularies this client may use, each of them enabled in
[kych-oauth2-gateway] VOCABULARIES. Required. A client with exactly one may name its claims directly in the scope, as clients always could. Example:{swiyu}.- PROFILES
The profiles this client may name in its scope. Optional; without it the client can only name claims directly. Each profile must have a line for at least one of the client’s vocabularies. Example:
{kyc}.
The options VERIFIER_URL, VERIFIER_MANAGEMENT_API_PATH and
ACCEPTED_ISSUER_DIDS of earlier versions are no longer read: the verifier
is a [helper-*] section now (URL or UNIXPATH,
MANAGEMENT_API_PATH), and the issuer DIDs are in the [trust-*]
section the vocabulary names. Any of them left in a client section is an
error that names the option, so that an old configuration fails at start
instead of silently losing its verifier and its issuer trust. After
rewriting the configuration, run kych-client-management sync.
26.48.2.9. SCOPES#
The OAuth 2.0 scope of an authorization request is either
the name of one profile the client may use, which asks for that profile’s claims of the session’s vocabulary, or
a list of native claim names of the session’s vocabulary, all of them required, as before profiles existed. This needs the vocabulary to be fixed: the client may use only one.
A scope mixing a profile with claim names, or naming two profiles, is
refused with invalid_scope.
26.48.2.10. SHIPPED VOCABULARIES#
The defaults in $DATADIR/config.d/00-kych-defaults.conf define the
vocabularies below and enable swiyu, which still needs its
[trust-swiyu] section from the operator. eupid and eupid-mdoc
are served by [helper-eudi-ref], the EUDI verifier of the package
eudi-verifier on /run/eudi-verifier/http.sock (x509_hash,
direct_post.jwt), and need their TRUST and a registration
certificate from the operator before they can be enabled. The defaults also
define [helper-waltid], walt.id verifier-api2 of the package
waltid-verifier on /run/waltid-verifier/http.sock with TRUST =
kych-trust; switching the EU PID to it is HELPER = waltid in both
vocabularies, which applies to sessions started after the restart – a
session already started finishes at the helper it started on, which must
therefore keep running until those sessions are done. The same holds for
[helper-kych-oid4vp], kych-oid4vp of the package kych-oid4vp on
/run/kych-oid4vp/api.sock (HELPER = kych-oid4vp), which needs its
API_SECRET from the operator. npa is served by [helper-eumw],
kych-eumw-bridge of the package of that name on
/run/kych-eumw-bridge/api.sock, which needs its API_SECRET from the
operator (@inline-secret@ helper-eumw
/etc/kych-eumw-bridge/secrets/api.secret.conf) and the Governikus eIDAS
Middleware behind it; or, with HELPER = kych-eid, by
[helper-kych-eid], kych-eid of the package of that name on
/run/kych-eid/api.sock, which needs its API_SECRET likewise
(@inline-secret@ helper-kych-eid /etc/kych-eid/secrets/api.secret.conf)
and delivers every npa claim but the two verifications. eidas is
served by [helper-eumw] as well: the same kych-eumw-bridge, with its
eidas route configured, in front of the EU eIDAS-Node Connector.
swiyuThe Swiss e-ID beta credential (SD-JWT VC,
vctbetaid-sdjwt), served by[helper-swiyu], swiyu-verifier onhttp://127.0.0.1:8080. ItsWALLET_SCHEMESisswiyu-verifyalone.eupidThe EU PID as an SD-JWT VC, with the claim names of the PID Rulebook (ARF Annex 3.01) 1.7, chapter 4:
family_name,given_name,birthdate,place_of_birth.{country,region,locality},nationalities[],address.{formatted,street_address,house_number, postal_code,locality,region,country},document_number,issuing_authority,issuing_country,date_of_expiryand the rest.VCTholds the base typeurn:eudi:pid:1and the domestic typesurn:eudi:pid:<country>:1of the 27 member states.WALLET_SCHEMESisopenid4vp,eudi-openid4vp,haip-vpandhaip.eupid-mdocThe EU PID as an mdoc, doctype and namespace
eu.europa.ec.eudi.pid.1(PID Rulebook, chapter 3): flat data elements such asbirth_date,resident_streetandresident_city, exceptplace_of_birth(a map) andnationality(an array).WALLET_SCHEMESaddsmdoc-openid4vpto those ofeupid.npaThe German eID card’s online function, with the attribute names of the eID server interface of BSI TR-03130:
FamilyNames,GivenNames,DateOfBirth,PlaceOfBirth,Nationality,PlaceOfResidence,RestrictedIDand the rest. Through kych-eumw-bridge,DateOfBirthis{"DateString", "DateValue"},PlaceOfBirth{"FreetextPlace"},PlaceOfResidence{"StructuredPlace": {"Street", "City", "State", "Country", "ZipCode"}},Nationalityan ISO 3166-1 alpha-2 code andRestrictedID{"ID"}; kych-eumw-bridge(1) lists what that route cannot deliver.eidasAnother member state’s eID through the eIDAS network, with the natural-person attribute URIs of the eIDAS SAML Attribute Profile 1.4, such as
http://eidas.europa.eu/attributes/naturalperson/CurrentFamilyName. Only the minimum data set (CurrentFamilyName,CurrentGivenName,DateOfBirth,PersonIdentifier) is guaranteed; the other attributes –Nationality(one value),PlaceOfBirth,CurrentAddressand the rest – come only where the sending member state provides them and the person consents. Through kych-eumw-bridge, values are as the eIDAS-Node hands them on:DateOfBirthYYYY-MM-DD,CurrentAddressbase64 of the eIDAS address elements,PersonIdentifierXX/YY/....
They come with one profile, kyc: the identification of a natural person
for a financial institution – names, date and place of birth, all
nationalities, the address where the source has one, and what anti-money
laundering law records about the means of identification – with
RETAIN = YES. Its SWIYU line requires every claim, since
swiyu-verifier cannot be asked for optional ones. Its NPA line requires
everything but PlaceOfResidence – a card whose holder lives abroad says
“no place” – and its RestrictedID takes the place of the document
number the card never transmits. Its EIDAS line requires the minimum
data set and asks for place of birth, nationality and address as optional:
an identification through another member state’s eID may well lack them,
and the client (the exchange’s AML program) completes what missing
lists.
26.48.3. EXAMPLE CONFIGURATION#
For the EU PID in an EUDI wallet, through the eudi-verifier and kych-trust
packages, what /etc/kych/kych.conf needs is the list the PIDs’ issuers
must be on (shared with kych-trust), the registration certificate, and the
public URL:
[kych-oauth2-gateway]
VOCABULARIES = {eupid, eupid-mdoc}
BASE_URL = https://kych.example.com/
@inline@ /etc/kych-trust/trust.conf
[vocabulary-eupid]
TRUST = pid-providers
[vocabulary-eupid-mdoc]
TRUST = pid-providers
[profile-kyc]
REGISTRATION_CERTIFICATE = /etc/kych/registration/kyc.jwt
@inline-secret@ client_exchange secrets/exchange.conf
[client_exchange]
CLIENT_ID = exchange
REDIRECT_URI = https://exchange.example.com/kyc-proof/kych
VOCABULARIES = {eupid, eupid-mdoc}
PROFILES = {kyc}
What it needs on top of the shipped defaults for a Swiss e-ID installation, with the client’s secret kept in a file of its own:
[kych-oauth2-gateway]
# Optional scope restriction
ALLOWED_SCOPES = {family_name, given_name, birth_date, age_over_18}
[trust-swiyu]
ACCEPTED_ISSUER_DIDS = {did:tdw:trusted_issuer}
# Clients may ask for "scope=adult" instead of naming claims.
[profile-adult]
SWIYU = {age_over_18}
@inline-secret@ client_merchant secrets/merchant.conf
[client_merchant]
CLIENT_ID = merchant_prod_01
REDIRECT_URI = https://merchant.example.com/kyc/callback
VOCABULARIES = {swiyu}
PROFILES = {adult}
The same, written out in full without the defaults:
[kych-oauth2-gateway]
SERVE = unix
UNIXPATH = /run/kych/kych.sock
UNIXPATH_MODE = 660
DATABASE = postgres:///kych?host=/var/run/postgresql
NONCE_BYTES = 32
TOKEN_BYTES = 32
AUTH_CODE_BYTES = 32
VOCABULARIES = {swiyu}
[vocabulary-swiyu]
KIND = oid4vp
FORMAT = dc+sd-jwt
VCT = {betaid-sdjwt}
ALGORITHMS = {ES256}
CLAIMS = {family_name, given_name, birth_date, nationality, age_over_18}
HELPER = swiyu
TRUST = swiyu
[helper-swiyu]
TYPE = swiyu
UNIXPATH = /run/swiyu-verifier/http.sock
[trust-swiyu]
ACCEPTED_ISSUER_DIDS = {did:tdw:trusted_issuer}
26.48.4. SEE ALSO#
kych-oauth2-gateway(1), kych-client-management(1), kych-trust(1), kych-trust.conf(5), eudi-verifier(1), waltid-verifier(1), kych-oid4vp(1), kych-oid4vp.conf(5), kych-eumw-bridge(1), governikus-eumw(1).
26.48.5. BUGS#
Report bugs by using https://bugs.taler.net/ or by sending electronic mail to <taler@gnu.org>.