Skip to main content
Version: 0.8 (next)

ISO mdoc

ISO/IEC 18013-5 defines the mdoc, the credential format of the mobile driving licence (mDL), together with a protocol to present it in person. ISO/IEC TS 18013-7 adds presentation over the internet, and its Annex C defines org-iso-mdoc for the W3C Digital Credentials API. These protocols carry only mdocs. This page explains how an mdoc presentation works, how it differs from OpenID4VP, and what Credo does for each. For the format, see mdoc. To issue mdocs, or to present them over OpenID4VP, see mdoc with OpenID4VC.

How a presentation works​

The wallet holds the mdoc, and the verifier is called the mdoc reader. A presentation has these parts:

PartWhat it is
Device engagementOnly in proximity. The wallet shows a QR code, or answers an NFC tap, with an ephemeral key and the transports it supports. The reader answers with its own ephemeral key, and both derive session keys that encrypt the rest of the exchange.
Device requestPer document type, the data elements the reader wants and whether it keeps them (intent to retain). The reader can sign each document request with its certificate (reader authentication), so the wallet can show who is asking.
Device responseThe disclosed data elements as the issuer signed them, and a signature over the session transcript made with the device key the mdoc is bound to.
Session transcriptNever sent. Both sides derive it from the session: from the engagement in proximity, from the website's origin and the encryption parameters with the Digital Credentials API. The device signature covers it, so a response is only valid in the session it was made for.

Proximity and the Digital Credentials API​

Credo supports two ways to present an mdoc with these protocols:

ProximityDigital Credentials API
StandardISO/IEC 18013-5ISO/IEC TS 18013-7 Annex C
UseIn person, for example at a counter or a gateA website, through the browser and the operating system
Started byThe reader scanning a QR code, or an NFC tapThe page calling navigator.credentials.get() with protocol org-iso-mdoc
TransportBLE, NFC or Wi-Fi AwareThe browser and the operating system
EncryptionSession keys from the engagementThe response is encrypted to the verifier with HPKE

The Digital Credentials API also carries OpenID4VP requests. Digital Credentials API covers both protocols, with a guide for the verifier and one for the wallet.

Which to use depends on where the presentation happens. In person, use proximity. On a website, use the Digital Credentials API, and pass an OpenID4VP and an org-iso-mdoc request in one call, as iOS only accepts org-iso-mdoc. Where the browser doesn't support the API, fall back to OpenID4VP with a QR code or a link, see mdoc with OpenID4VC.

How it differs from OpenID4VP​

OpenID4VP can present the same mdoc, and the device response inside it has the same structure. ISO/IEC TS 18013-7 also describes mdoc presentation over OpenID4VP. Everything around the device response differs:

ISO 18013-5 and 18013-7 Annex COpenID4VP
EncodingCBORJSON and JWT
RequestA device request with document types and data element identifiersAn authorization request with a DCQL query
Credential formatsmdocSD-JWT VC, mdoc and W3C VCs
AlternativesCan't be expressed. Several document requests can mean all of them or any one.DCQL credential sets and claim sets
Verifier identityReader certificate, optionalClient identifier, usually with a signed request
Credo APIagent.mdoc and MdocDeviceResponse in @credo-ts/coreagent.openid4vc in @credo-ts/openid4vc

What Credo does​

StepProximityDigital Credentials API
Engagement and transportA native module, such as expo-mdoc-data-transfer in a React Native walletThe browser and the operating system. In the wallet, a native module such as @animo-id/expo-digital-credentials-api
EncryptionThe native moduleCredo
Create the device requestNot supportedagent.mdoc.createDcApiVerificationSession
Read the request in the walletDecode it with @owf/mdocagent.mdoc.resolveDcApiRequest, which also finds matching mdocs
Reader authenticationNot checkedCreated and verified
Create the device responseMdocDeviceResponse.createDeviceResponseagent.mdoc.createDcApiResponse
Verify the device responseMdocDeviceResponse.verifyagent.mdoc.verifyDcApiResponse, which also checks the response against the request

Credo signs device responses with the device key (device signature). It doesn't support device MAC authentication, so it can't verify a response authenticated with a MAC either.

Neither standard covers issuance. Wallets usually receive mdocs over OpenID4VCI, see mdoc with OpenID4VC.