verify

suspend fun verify(sessionTranscript: DataItem, eReaderKey: AsymmetricKey? = null, transactionDataList: List<List<TransactionData>> = emptyList(), atTime: Instant = Clock.System.now()): List<Map<String, Map<String, DataItem>>>

Verifies the integrity of the returned documents, according to ISO/IEC 18013-5.

The following checks are performed for each MdocDocument instance in documents.

  • For MdocDocument.issuerAuth the signature is checked against the leaf certificate in the associated X.509 chain.

  • The document type in the MSO matches the docType in the response.

  • The MSO is validity period includes the passed-in atTime.

  • The data returned in MdocDocument.issuerNamespaces is checked against digests in the MSO.

  • The device-authentication structures (ECDSA or MAC) are checked.

  • For each transaction data in the list, verifies that transaction hash is present in the response and matches the hash of the source transaction data

The following checks are expected to be done by the application:

Return

list of per-document transaction responses; each response is a map; a key in this map is a transaction identifier, and the value is a map with an entry for each item in the transaction response data, including "transaction_data_hash".

Parameters

sessionTranscript

the session transcript to use.

eReaderKey

the ephemeral reader key or null if not using session encryption.

transactionDataList

list of transactions for each document in this DeviceResponse

atTime

the point in time for validating the whether returned documents are valid.

Throws

if validation fails.