Skip to content

Credentials and claims

Brandt Batteries wants its battery data service to give dismantling instructions to recyclers that dismantle batteries, and cell composition to recyclers that recover materials. Hansen Recycling holds a recycler credential that lists its activities. The service needs these activities at the moment Hansen calls. Brandt’s developers ask whether they now have to learn how to verify credentials. They do not.

Three facts are enough for most application code.

  • A counterparty is a DID. Use the DID as the key for what you store about a counterparty, such as partners, grants, and channels.
  • Credentials are verified before your code runs. The connector checks them when a counterparty asks for the catalog, requests a contract, and requests a transfer. Your application never receives a credential and never checks a signature of one.
  • You can receive the result. The platform can put a verified fact about the caller into the flow token as a claim.

When a transfer starts, the connector hands the verified claims of the counterparty to the data plane. The operator can configure a claim mapping for a transfer type: an expression that Siglet evaluates on these claims, and the name of the token claim that receives the result.

For battery data, the Bike Dataspace prescribes one mapping. This expression reads the activities from the recycler credential.

flow.claims.vc.withType('RecyclerCredential').claim('activities')

The result goes into the token claim activities. Hansen’s token for Brandt’s dismantling data then contains this, next to the claims from lecture 10.

{
"sub": "did:web:identity.danube-cloud.example:hansen-recycling",
"aud": "did:web:brandt-batteries.example",
"datasetId": "battery-data-v1-dismantling",
"activities": ["dismantling"]
}
Credential Service Hansen
Connector Brandt
Siglet Brandt
Battery data service Brandt
A verified claim travels from the credential into the token. The application reads the claim and never sees the credential.

The profile defines no other claim. Whether a caller signed a data sharing agreement is checked by the connector, where an offer requires it, and is not in the token.

Read the claim defensively. The mapping is optional, so a flow without a recycler credential, such as one for basic battery data, gets a token without it. Treat a missing claim, or one with an unexpected shape, as an empty list. An error must reduce what a caller gets, never increase it.

The claims in a token describe what was true when the transfer started. Siglet does not ask the Credential Service again while the transfer runs.

  • A credential improves. The association adds material-recovery to Hansen’s credential. Hansen’s running flow still carries the old list until Hansen’s application starts a new transfer.
  • A credential is lost. The association revokes Hansen’s recycler credential. New contract and transfer requests fail soon afterwards. A transfer that is already started keeps its token and its claims until someone ends it.

Two habits close the gap, one on each side. As consumer, replace a flow after your own credentials changed and when it is older than the limit. The Credential Service publishes an event when the issuer offers a new credential, and lecture 14 shows how to react to events. As provider, terminate started transfers that are older than the limit, so that the connector checks the counterparty’s credentials again.

The limit is a rule of the dataspace. In the Bike Dataspace no transfer runs longer than a day, in any use case. A changed credential then arrives within a day, and a revoked one stops working.

A request body that says "activities": ["dismantling"] proves nothing. Anyone can type it. The same holds for a company name, a DID, or a role in a header or a query parameter.

Identity and verified facts come from the flow token, which your platform issued after the connector checked the credentials. Design the use-case API so that it has no fields for them.

Your application presents no credentials itself, but its users want to know whether their own are in order. A status page can read them from the member’s Credential Service.

GET /api/identity/participants/costa-frames/credentials?type=MembershipCredential HTTP/1.1
Host: danube-cloud.example
Authorization: Bearer <access token>

The call needs the scope identity-api:credentials:read. Each entry has a state. At the time of writing the API reports it as a number.

StateMeaning
500Issued
600Revoked
700Suspended
800Expired

The Credential Service renews a credential before it expires, without any action of your application. Show the state, and alert the member when the membership credential is not issued. Counterparties ask for it with every request, so without it the member’s requests fail. It is also issued again when the member signs another data sharing agreement.

  • Application code identifies a counterparty by its DID and never handles a credential.
  • A claim mapping puts verified facts into the flow token, where the application reads them.
  • Token claims are a snapshot from the start of a transfer. Renew flows after credential changes and limit their age.
  • Facts about the caller come from the token and never from the request.