PresentmentModel

A model used for credential presentment.

This model implements the entire UX/UI flow related to presentment, including

  • Allowing the user to cancel at any time, including when the connection is being established.

  • Querying the user for which document to present, if multiple credentials can satisfy the request.

  • Showing a consent dialog.

  • Generating the response and sending it to the verifier, via the selected mechanism.

  • Support for multiple requests if both sides keep the connection open

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data class ConsentData(val document: Document, val request: Request, val trustPoint: TrustPoint?)

Data to include in the consent prompt.

Link copied to clipboard

Three different ways the close/dismiss button can be triggered.

Link copied to clipboard

Possible states that the model can be in.

Properties

Link copied to clipboard

The list of available documents to pick from.

Link copied to clipboard

The data to show in the consent dialog.

Link copied to clipboard
val dismissable: StateFlow<Boolean>

Returns whether the presentment can be dismissed/canceled.

Link copied to clipboard

If presentment fails, this will be set with a Throwable with more information about the failure.

Link copied to clipboard

The mechanism being used to communicate with the credential reader.

Link copied to clipboard
val numRequestsServed: StateFlow<Int>

Number of requests served.

Link copied to clipboard
val presentmentScope: CoroutineScope

A CoroutineScope for the presentment process.

Link copied to clipboard

The source which provides data to present.

Link copied to clipboard

The current state.

Functions

Link copied to clipboard
fun consentReviewed(consentObtained: Boolean)

The UI layer should call this when a user has reviewed the consent data.

Link copied to clipboard

Should be called by the UI layer if the user hits the dismiss button.

Link copied to clipboard
fun documentSelected(document: Document?)

The UI layer should call this when a user has selected a document.

Link copied to clipboard
fun reset()

Resets the model to State.IDLE.

Link copied to clipboard
fun setCompleted(error: Throwable? = null)

Sets the model to State.COMPLETED

Link copied to clipboard

Sets the model to State.CONNECTING.

Link copied to clipboard
Link copied to clipboard
fun setPromptModel(promptModel: PromptModel)

Provides PromptModel, required if presentment involves popping up any prompts, such as biometrics or passphrase.

Link copied to clipboard

Sets the PresentmentSource to use as the source of truth for presentment.