Iso18013Presentment

suspend fun Iso18013Presentment(transport: MdocTransport, eDeviceKey: EcPrivateKey, deviceEngagement: DataItem, handover: DataItem, source: PresentmentSource, keyAgreementPossible: List<EcCurve>, timeout: Duration? = 10.seconds, timeoutSubsequentRequests: Duration? = 30.seconds, onWaitingForRequest: () -> Unit = {}, onWaitingForUserInput: () -> Unit = {}, onDocumentsInFocus: (documents: List<Document>) -> Unit = {}, onSendingResponse: () -> Unit = {})

Performs proximity presentment according to ISO/IEC 18013-5:2021.

This implementation allows handling multiple requests from the reader and expects the reader to close the connection.

Parameters

eDeviceKey

the ephemeral device key.

deviceEngagement

the device engagement.

handover

the handover.

source

the source of truth used for presentment.

keyAgreementPossible

the list of curves for which key agreement is possible.

timeout

the maximum time to wait for the first message from the remote reader or null to wait indefinitely.

timeoutSubsequentRequests

the maximum time to wait for subsequent messages or null to wait indefinitely.

onWaitingForRequest

called when waiting for a request from the remote reader.

onWaitingForUserInput

called when waiting for input from the user (consent or authentication)

onDocumentsInFocus

called with the documents currently selected for the user, including when first shown. If the user selects a different set of documents in the prompt, this will be called again.

onSendingResponse

called when sending a response to the remote reader.

Throws

if the reader didn't send a message without the given timeout.

if the user canceled in a consent prompt.