4.1.7. The exchange and Beekeeper#

KyCH has two kinds of clients: a GNU Taler exchange, which sends a customer to KyCH as one of its KYC measures, and Beekeeper, which sends each natural person of a case there from an eid question in one of its forms. Both are ordinary OAuth 2.0 clients of KyCH, each with a [client_*] section (Configuration).

4.1.7.1. A GNU Taler exchange#

The exchange’s source tree has a complete example, contrib/kyc-kych-example.conf: the person identifies by eID first – choosing at KyCH among the EU wallet, the German card and eIDAS, or with the German card preselected – or else with an identity document through Beekeeper. What follows are its essential parts; the exchange’s KYC manual explains the sections themselves.

4.1.7.1.1. The provider#

/etc/taler-exchange/conf.d/kyc-kych.conf#
[kyc-provider-kych]
LOGIC = oauth2
KYC_OAUTH2_VALIDITY = 365 d
KYC_OAUTH2_AUTHORIZE_URL = "https://kych.example.com/authorize#setup"
KYC_OAUTH2_TOKEN_URL = https://kych.example.com/token
KYC_OAUTH2_INFO_URL = https://kych.example.com/info
KYC_OAUTH2_CLIENT_ID = exchange
KYC_OAUTH2_CLIENT_SECRET = KYCH_SECRET
KYC_OAUTH2_SCOPE = kyc
KYC_OAUTH2_POST_URL = https://exchange.example.com/kyc-done
KYC_OAUTH2_CONVERTER_HELPER = taler-exchange-kyc-kych-converter

  • #setup (quoted, since # otherwise starts a comment) makes the exchange POST to https://kych.example.com/setup/exchange with its client secret first, and send the person to https://kych.example.com/authorize/NONCE.

  • The client at KyCH has REDIRECT_URI the exchange’s BASE_URL, kyc-proof/ and the provider section’s name without kyc-provider-: https://exchange.example.com/kyc-proof/kych.

  • KYC_OAUTH2_SCOPE = kyc is KyCH’s profile with the data of BaFin’s O.1.

  • KYC_OAUTH2_POST_URL is where the exchange sends the browser after a successful identification: a page of the operator’s, served by the reverse proxy, telling the person to return to the wallet. Not the KYC web app’s kyc-spa/, which needs the account’s access token in its path and answers the bare path with 403.

  • taler-exchange-kyc-kych-converter (package kych; it needs jq) turns /info into GANA attributes:

    GANA attribute

    From

    FULL_NAME, DATE_OF_BIRTH

    the names and the date of birth of any vocabulary

    PLACE_OF_BIRTH, COUNTRY_OF_BIRTH

    the place of birth (town and region; the country separately)

    NATIONALITY, NATIONALITIES

    the first and all nationalities, as ISO 3166-1 alpha-2 (the German card’s ICAO 9303 [ICAO9303] codes D, FRA converted)

    ADDRESS_LINES, ADDRESS_COUNTRY

    the address, where the credential had one

    PERSONAL_IDENTIFICATION_DOCUMENT_*

    type, number, issuer, country and expiry, where given

    IDENTIFICATION_METHOD

    the vocabulary

    IDENTIFICATION_LEVEL_OF_ASSURANCE

    the evidence’s level, only where KyCH reported one

    IDENTIFICATION_EVIDENCE

    KyCH’s evidence object, raw presentation included

    IDENTIFICATION_PERSON_IDENTIFIER

    RestrictedID (npa) or PersonIdentifier (eidas)

    taler-exchange-kyc-kych-converter(1) has the mapping per vocabulary.

4.1.7.1.2. Preselecting a vocabulary#

A measure’s CONTEXT.setup_body is sent as the body of KyCH’s /setup, deflate-compressed, and its vocabulary fixes how the person identifies, so that KyCH shows no choice:

[kyc-measure-eid-npa]
CHECK_NAME = eid-npa
PROGRAM = identification-check
CONTEXT = {"setup_body": {"vocabulary": "npa"}, "lift_rules": ["withdraw-identification"], "accepted_methods": ["npa"], "accepted_levels": ["high"], "fallback_measure": "documents-beekeeper"}

Each such measure needs a check of its own (kyc-check-eid-npa), even with the same provider: the KYC web app shows the measures of a rule by their checks’ descriptions. An exchange without setup_body preselects through a second provider section whose client KyCH allows a single vocabulary (VOCABULARIES = {npa}).

4.1.7.1.3. Deciding whether an identification suffices#

The exchange does not fall back from one provider to another by itself, and it stores what the converter gives whether or not that is enough. The AML program taler-exchange-helper-measure-identification-check decides, from the measure’s context:

[aml-program-identification-check]
DESCRIPTION = "Lifts the identification rule once a person is identified completely; otherwise asks for another way of identification"
COMMAND = taler-exchange-helper-measure-identification-check
FALLBACK = manual-freeze

[kyc-measure-eid-kych]
CHECK_NAME = eid-kych
PROGRAM = identification-check
CONTEXT = {"lift_rules": ["withdraw-identification"], "accepted_methods": ["eupid", "eupid-mdoc", "npa", "eidas"], "accepted_levels": ["substantial", "high"], "fallback_measure": "documents-beekeeper"}

[kyc-rule-withdraw-identification]
OPERATION_TYPE = WITHDRAW
THRESHOLD = EUR:1000
TIMEFRAME = 30 d
NEXT_MEASURES = eid-kych eid-npa documents-beekeeper
IS_AND_COMBINATOR = NO

  • An identification with an accepted method, an accepted level and every required attribute lifts the rule.

  • One that succeeded but lacks something – a Swiss e-ID (not accepted), an EU PID without a level of assurance (a simulated list), an eIDAS identification without the nationality – triggers the fallback_measure, the identification with documents through Beekeeper.

  • A failed or cancelled one comes back from KyCH as error=access_denied; the exchange records the KYC process as failed, and the rule’s other measures stay on offer, so the person can choose the documents.

These paths were run through a real exchange, bank and wallet (testing/system/RESULTS.md, testing/eidas/RESULTS.md): the rule lifted and the withdrawal completed for EU PIDs in both encodings, the German card and eIDAS; an unlisted issuer failed and left the documents on offer; an eID without a level and an eIDAS identification with the minimum data set led to the documents alone.

GANA’s new identification attributes are on GANA’s eid-eudiw branch, and the exchange’s KYC web app and AML interface show attributes they do not know generically until the forms are regenerated from GANA (Guide for AML officers and support staff).

4.1.7.2. Beekeeper#

Beekeeper’s web server has no HTTP client. An eid question in a form makes its lookup worker run beekeeper-kych, the helper of the beekeeper-kych package, which is KyCH’s client:

{"id": "eid", "type": "eid", "profile": "kyc", "required": false,
 "label": "Identify yourself electronically"}

vocabulary (npa, eupid, eupid-mdoc, eidas, swiyu) fixes the means at /setup; without it the person chooses at KyCH. The person presses a button, the worker asks KyCH for a session (eid_start), the browser goes to KyCH and comes back to Beekeeper’s /eid/return, and the worker exchanges the code and fetches /info (eid_result). The claims fill the question’s answer (method, derived: names, birth data, nationalities, address, document data, person identifier, level of assurance; missing), and the evidence becomes the question’s analysis result, which Beekeeper’s OAuth 2.0 interface hands on to the exchange.

KyCH’s side, a client for Beekeeper:

/etc/kych/kych.conf#
[client_beekeeper]
CLIENT_ID = beekeeper
REDIRECT_URI = https://forms.example.com/eid/return
VOCABULARIES = {eupid, eupid-mdoc, npa, eidas}
PROFILES = {kyc}

Beekeeper’s side:

/etc/beekeeper-kych/beekeeper-kych.conf#
[beekeeper-kych]
URL = https://kych.example.com/
UNIXPATH = /run/kych/kych.sock
CLIENT_ID = beekeeper
REDIRECT_URI = https://forms.example.com/eid/return
PROFILES = {kyc}

@inline-secret@ beekeeper-kych /etc/beekeeper-kych/secret.conf

/etc/beekeeper/beekeeper.conf#
[lookup-kych]
COMMAND = beekeeper-kych -c /etc/beekeeper-kych/beekeeper-kych.conf
TIMEOUT = 90 s

UNIXPATH is for KyCH on the same host: the worker then speaks plain HTTP to KyCH’s socket and needs its group, kych-api (adduser beekeeper-lookup kych-api, then restart the worker; KyCH’s package does both when beekeeper-kych is already configured for the socket). Never give the worker www-data: that is the group of the helpers’ unauthenticated sockets. Without UNIXPATH the worker reaches KyCH at its public URL, which the packaged worker unit’s network restrictions allow for a public address only.

eID first, documents second. A form offers the eID first and the documents when it does not work, with the reason recorded:

[
  {"id": "eid", "type": "eid", "profile": "kyc", "required": false,
   "label": "Identify yourself electronically"},
  {"id": "identification_no_eid_reason", "type": "choice", "required": true,
   "visible_if": {"!": {"verified": "eid"}},
   "label": "If you cannot identify yourself electronically: why not?",
   "options": [{"value": "NO_EID", "label": "I have no eID"},
               {"value": "PIN_UNKNOWN", "label": "I do not know the PIN"},
               {"value": "EID_FAILED", "label": "I tried, and it did not work"},
               {"value": "OTHER", "label": "Another reason"}]}
]

The pages with the identity document and the liveness video then have "visible_if": {"!": {"verified": "eid"}}. The reason becomes GANA’s IDENTIFICATION_NO_EID_REASON at the exchange, and the converter records IDENTIFICATION_METHOD document for the fallback.

KYB persons. In a company’s case, each representative and beneficial owner gets a person form of their own, spawned from the company’s list, so that each identifies by eID on their own device. An eid question can be the reference of the names and dates the company stated about that person: any difference sends the case to a reviewer (review reason eid_deviation).

Beekeeper’s manual (form definitions, eid; lookup helpers; REST API, electronic identification) and beekeeper-kych(1) describe this side in full. The flow was run end to end with Beekeeper’s TOPS forms: the establisher, representative and beneficial owner of a company each identified by eID in their person forms, and a deliberately different name went to a reviewer (testing/system/RESULTS.md, S4; with eidas, testing/eidas/RESULTS.md).