DirectAccessCredential

An mdoc credential, according to ISO/IEC 18013-5:2021, which can be stored in the DirectAccess applet. This credential makes use of the DirectAccess class to integrate with the applet.

Creation of a DirectAccessCredential is very similar to any other Credential with the following exceptions:

First, a slot must be reserved in the Direct Access applet for the Document this credential is associated with. This can be done using DirectAccess.allocateDocumentSlot. Once allocated, the slot must be passed into the DirectAccessCredential constructor when creating new credentials.

Secondly, certifying the credential requires the following format for issuerProvidedAuthenticationData:

The |issuerProvidedAuthenticationData| parameter must be CBOR conforming to the following CDDL:

issuerProvidedAuthenticationData = {
"issuerNameSpaces": IssuerNameSpaces,
"issuerAuth" : IssuerAuth,
"readerAccess" : ReaderAccess // TODO: update applet for name change to "authorizedReaderRoots"
}

IssuerNameSpaces = {
NameSpace => [ + IssuerSignedItemBytes ]
}

ReaderAccess = [ * COSE_Key ]

This data will be stored on the Secure Area and used for MDOC presentations using NFC data transfer in low-power mode.

The readerAccess field contains a list of keys used for implementing reader authentication. If this list is empty, reader authentication is not required. Otherwise the request must be be signed and the request is authenticated if, and only if, a public key from the X.509 certificate chain for the key signing the request exists in the readerAccess list.

If reader authentication fails, the returned DeviceResponse shall return error code 10 for the requested docType in the "documentErrors" field.

Lastly, in order to use the credential, it must be set as the active credential in the Direct Access applet using setAsActiveCredential once the credential is certified.

Constructors

Link copied to clipboard
constructor(document: Document)

Constructs a Credential from serialized data.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The attestation for the key associated with this credential.

Link copied to clipboard
open override val credentialType: String
Link copied to clipboard
lateinit var docType: String

The docType of the credential as defined in ISO/IEC 18013-5:2021.

Link copied to clipboard
Link copied to clipboard
lateinit var domain: String
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val validFrom: Instant
Link copied to clipboard
val validUntil: Instant

Functions

Link copied to clipboard
open override fun addSerializedData(builder: MapBuilder<CborBuilder>)
Link copied to clipboard
suspend fun addToDocument()
Link copied to clipboard
open suspend override fun certify(issuerProvidedAuthenticationData: ByteArray, validFrom: Instant, validUntil: Instant)
Link copied to clipboard
open suspend override fun deserialize(dataItem: DataItem)

Constructs a Credential from serialized data, ie. the inverse of addSerializedData.

Link copied to clipboard
open override fun getClaims(documentTypeRepository: DocumentTypeRepository?): List<Claim>
Link copied to clipboard
suspend fun increaseUsageCount()
Link copied to clipboard
open suspend fun isInvalidated(): Boolean
Link copied to clipboard
suspend fun replacementForDeleted()
Link copied to clipboard

Sets the credential as the active credential in the direct access applet (ie. this credential would be the one used during presentation).