Skip to content

About

Gateway between EUDIPLO's attribute provider API and authentic sources: per-attribute sources, freshness, signed responses, evidence

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

EUDIPLO Attribute Gateway

A service between EUDIPLO's attribute provider API and the sources that hold the data of a credential: registers, case systems, other authentic sources.

EUDIPLO calls the gateway when a wallet requests a credential. For each claim of the credential, the gateway tries only the sources permitted for it, in order, until one supplies a value that is recent enough. It records which source answered, when and with what digest, then answers EUDIPLO with the claims, a deferral or an error.

Status: early. The contract with EUDIPLO, the source map, freshness rules, deferral, evidence records, the mock and http connectors and the etsi-119478 client for authentic sources work. Not built yet: checking a signature or seal on verification results, mTLS client authentication, and the ISO 15000 binding of TS 119 478. See #1.

Run it

pnpm install
cp config/gateway.example.json config/gateway.json
GATEWAY_API_KEY=change-me pnpm build && pnpm start

Or as a container:

docker build -t attribute-gateway .
docker run -p 8080:8080 -e GATEWAY_API_KEY=change-me \
  -v $PWD/config/gateway.json:/config/gateway.json:ro \
  -v gateway-evidence:/data attribute-gateway

Register it in EUDIPLO as an attribute provider with apiKey authentication and the same key:

{
    "id": "gateway",
    "name": "Attribute gateway",
    "url": "https://gateway.example.com/claims",
    "auth": { "type": "apiKey", "config": { "headerName": "x-api-key", "value": "change-me" } }
}

Then set "attributeProviderId": "gateway" on each credential configuration the gateway serves.

Variable Default Purpose
GATEWAY_CONFIG config/gateway.json (/config/gateway.json in the image) Source map, see below.
GATEWAY_API_KEY none Key EUDIPLO must send. Required unless GATEWAY_ALLOW_NO_AUTH=true.
GATEWAY_API_KEY_HEADER x-api-key Header the key is read from.
GATEWAY_ALLOW_NO_AUTH false Accept requests without a key. Local development only.
GATEWAY_PUBLIC_URL http://localhost:$PORT Public URL of the gateway, used for authorization links and the OAuth callback (<url>/callback).
GATEWAY_EVIDENCE_FILE evidence.jsonl (/data/evidence.jsonl in the image) Where evidence records are appended.
PORT 8080 Listening port.

Configure sources and claims

config/gateway.example.json is a complete example. The file has two parts.

sources: every source the gateway may call.

Field Meaning
connector mock or http, or a connector you add.
subject How the source finds the person: { "from": "identity.sub" }, or { "from": "credential", "credentialId": "pid", "claims": [["family_name"], ["given_name"], ["birthdate"]] } to use claims of a credential the wallet presented. A source the subject cannot be derived for counts as unavailable.
options Connector options.

credentials: per EUDIPLO credential configuration ID, the claims and their rules.

Field Meaning
claims[].path Claim path, as in the credential configuration's fields[].path.
claims[].sources Permitted sources, tried in order.
claims[].maxAgeSeconds A value older than this, measured from the source's retrieval time, is not used.
claims[].verify Check the value at an authentic source before issuing it; see Authentic sources.
claims[].onMissing fail (default): EUDIPLO fails the credential request. defer: EUDIPLO answers the wallet with a deferred transaction. omit: issue without the claim.
deferInterval Polling interval in seconds suggested to the wallet when deferred.

Each source is called at most once per request, with every claim it is permitted for. A source that errors or times out counts as unavailable, and the next permitted source is tried.

A deferred answer only tells EUDIPLO to wait. Completing the transaction later, with POST /api/issuer/deferred/{transactionId}/complete, is up to your case handling; see Deferred issuance.

Connectors

  • mock: records in the configuration, keyed by the subject's values joined with |. ageSeconds makes the data look older, to try freshness rules.

  • http: a generic JSON source. The gateway sends POST url with { "session", "subject", "claims": [[...path]] } and expects { "found": true, "retrieved_at": "<RFC 3339>", "values": [{ "path": [...], "value": ... }] }. Options: url (HTTPS unless allowHttp), headers (a value env:NAME is read from the environment), timeoutMs (default 10 s). Redirects are refused and answers are capped at 1 MiB.

  • etsi-119478: an authentic source; see the next section.

A connector implements one method, query({ subject, claims, session }), and returns the values, whether the subject was found, when the data was retrieved and the raw answer. See src/connectors/connector.ts. National or organisation-specific connectors are expected to live in their operators' code and be registered next to the built-in ones.

Authentic sources (ETSI TS 119 478)

CIR (EU) 2025/1569, as amended by CIR (EU) 2026/1735, has qualified attestation providers verify attributes against authentic sources through the mechanism of its Annex IV, which refers to ETSI TS 119 478 V1.1.1. The etsi-119478 connector implements its HTTP / OAuth binding (clause 6.1):

  • I2 Verify (POST /verify): checks a value the gateway got from another source. Add verify to a claim rule.
  • I3 Retrieve (POST /retrieve): fetches a value from the authentic source. List the source in the claim's sources and map the claim to its attribute identifier.
{
    "sources": {
        "register": {
            "connector": "etsi-119478",
            "options": {
                "issuer": "https://as.register.example",
                "authorizationEndpoint": "https://as.register.example/authorize",
                "tokenEndpoint": "https://as.register.example/token",
                "pushedAuthorizationRequestEndpoint": "https://as.register.example/par",
                "jwksUri": "https://as.register.example/jwks",
                "verifyEndpoint": "https://register.example/authsrc-api/verify",
                "retrieveEndpoint": "https://register.example/authsrc-api/retrieve",
                "clientId": "<from registration>",
                "clientKeyFile": "/config/client.jwk",
                "certificateChainFile": "/config/access-certificate.pem",
                "returnToOrigins": ["https://issuer.example"],
                "holderBinding": {
                    "credentialId": "pid",
                    "claims": [
                        { "token": ["family_name"], "presented": ["family_name"] },
                        { "token": ["given_name"], "presented": ["given_name"] },
                        { "token": ["birthdate"], "presented": ["birthdate"] }
                    ]
                },
                "attributes": [
                    { "path": ["place_of_birth"], "attributeIdentifier": "<attribute URI from the catalogue>" }
                ]
            }
        }
    },
    "credentials": {
        "residence": {
            "claims": [
                {
                    "path": ["address"],
                    "sources": ["case-system"],
                    "verify": { "source": "register", "attributeIdentifier": "<attribute URI>", "onUnverified": "defer" }
                },
                { "path": ["place_of_birth"], "sources": ["register"] }
            ]
        }
    }
}

The person authorises each request. TS 119 478 uses the OAuth authorization code flow: the person signs in at the authentic source's authorization server, for example with their EUDI Wallet, and the access token carries their identification data. The gateway therefore hosts that step:

  1. Your backend asks for a one-time link, with the gateway's API key: POST /authorizations with { "session": "<EUDIPLO session>", "source": "register", "returnTo": "https://issuer.example/…" }. The answer is { "url": "<gateway>/authorize/…" }, valid for 10 minutes and usable once. returnTo must be on one of the source's returnToOrigins.
  2. Send the person to that URL, for example from the page of EUDIPLO's redirect_to_web interactive authorization step. The gateway redirects to the authorization server with PKCE (S256).
  3. The link sets a cookie in the person's browser, and the callback only completes in that browser, so a code obtained elsewhere cannot be attached to this session. After the authorization, the gateway exchanges the code (private_key_jwt client authentication, DPoP-bound token) and sends the person to returnTo with authorization=done or authorization=failed. Then complete the web step in EUDIPLO.
  4. When the wallet requests the credential, EUDIPLO calls /claims with the same session, and the gateway calls Verify or Retrieve with that token.

The person who signs in must be the wallet holder. Otherwise a forwarded link would put someone else's register data into the credential. holderBinding is required:

  • By default ("from": "id_token") the gateway adds openid to the scope and a nonce to the request. It verifies the ID token from the token response against jwksUri, checking issuer, audience, expiry and nonce. Before each Verify or Retrieve, the listed ID token claims must equal the listed claims of the credential the wallet presented, ignoring case, outer spaces and Unicode normalisation form. TS 119 478 does not require the authorization server to support OpenID Connect; check that yours does.
  • "from": "access_token" reads the access token instead, for servers without OpenID Connect. RFC 9068 clause 6 tells clients not to inspect access tokens, and this fails with encrypted tokens.
  • "none" turns the check off. Use it only if your returnTo page authenticates the person and the link is never shown where it can be forwarded.

Other options: issuer is required and is the aud of the client assertion (FAPI 2.0); set "assertionAudience": "token_endpoint" for servers that expect the token endpoint. With pushedAuthorizationRequestEndpoint the request goes through PAR (RFC 9126). An iss parameter in the callback must equal issuer (RFC 9207); "requireIssParameter": true also refuses callbacks without it.

Without an authorization for the session, Verify and Retrieve count as unavailable. Tokens are kept in memory only, until they expire or the gateway restarts.

Results. Match and MatchWithVariation count as verified. On MatchWithVariation the authentic source's value is issued, unless the rule sets "useAuthenticSourceValue": false. NoMatch, Unknown, a missing result or an error fail the request, or defer it with "onUnverified": "defer". The value must be a JSON object that follows the attribute's schema in the catalogue of attributes.

Register the gateway once per authorization server (clause 6.1.3.2). The software statement is sealed with your certificate, for example your wallet-relying party access certificate, and names your entry in the national register:

pnpm build && pnpm register-client \
  --registration-endpoint https://as.register.example/register \
  --redirect-uri https://gateway.example/callback \
  --registry-uri https://register.example/rp/123 \
  --issuer https://issuer.example \
  --sealing-key seal.jwk --sealing-chain seal-chain.pem \
  --client-key client.jwk

--issuer becomes the software statement's iss: the party that seals it. It prints the client_id. The client key is the one the gateway uses for private_key_jwt; only its public part is sent.

Not covered yet:

  • A signature or seal on verification results. TS 119 478 clause 6.1 defines none. CIR (EU) 2026/1735, which amends Article 9 of CIR (EU) 2025/1569, adds requirements for signing or sealing them; checking those will be added once the required format is confirmed against its text. Until then, the evidence holds the digest of each raw answer.
  • Authorization servers that accept only mTLS client authentication or mTLS-bound tokens: the gateway uses private_key_jwt and DPoP, one of the two options the specification allows for each.
  • The (I1) Discover interface: endpoints and attribute identifiers are configured by hand.
  • Fragment verification (attributeFragments) and mandates.

Evidence

Each source call appends one JSON line: evidence ID, session, your offer reference, credential configuration, source, retrieval time, whether the subject was found, the claim paths the source supplied, and the SHA-256 digest of the source's raw answer. Verify calls add operation: "verify", the result URI per claim, and the provider and authentic source the answer names; a failed call records the error. Claim values are not written. Keeping the raw answers, if your policy requires it, is left to the connector.

EUDIPLO validates the claims it receives against the credential configuration, so the evidence reference cannot travel in the answer today. Match evidence to an issuance by session or reference.

Develop

pnpm test        # unit and HTTP tests
pnpm lint        # Biome
pnpm typecheck

Contributions follow the EUDIPLO contribution rules.

License

Apache-2.0

About

Gateway between EUDIPLO's attribute provider API and authentic sources: per-attribute sources, freshness, signed responses, evidence

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages