PresentmentSource

abstract class PresentmentSource(val documentStore: DocumentStore, val documentTypeRepository: DocumentTypeRepository, val zkSystemRepository: ZkSystemRepository? = null, val eventLogger: EventLogger? = null, val requesterHistory: RequesterHistory? = null)

The source of truth used for credential presentment.

This is used whenever an application wishes to present credentials including the DocumentStore which holds credentials that can be presented and a DocumentTypeRepository which contains descriptions of well-known document types which may be shown in a consent prompt.

It's also used for more dynamic data such as determining whether the requester is trusted (via resolveTrust) and if so what branding to show, whether user consent should be obtained or if preconsent exists (via showConsentPrompt), and even what kind of user authentication to perform to present the credential, if any (by picking a Credential from an appropriate domain in selectCredential).

See also

for one concrete implementation tailored for ISO mdoc and IETF SD-JWT VC credentials.

Inheritors

Constructors

Link copied to clipboard
constructor(documentStore: DocumentStore, documentTypeRepository: DocumentTypeRepository, zkSystemRepository: ZkSystemRepository? = null, eventLogger: EventLogger? = null, requesterHistory: RequesterHistory? = null)

Properties

Link copied to clipboard

the DocumentStore which holds credentials that can be presented.

Link copied to clipboard

a DocumentTypeRepository which holds metadata for document types.

Link copied to clipboard

an EventLogger for logging events or null.

Link copied to clipboard

a RequesterHistory for tracking relying party interactions or null.

Link copied to clipboard

a ZkSystemRepository with ZKP systems or null.

Functions

Link copied to clipboard
abstract suspend fun getBadges(document: Document): List<DocumentBadge>

Gets a list of badges for a document.

Link copied to clipboard

Gets the FaceMatcher to use for face matching during presentment, or null if face matching is not available.

Link copied to clipboard
open suspend fun getFaceMatchingMode(credential: Credential, requesterIdentities: List<RequesterIdentity>): FaceMatchingMode

Determines whether and when to perform face matching for a credential presentation.

Link copied to clipboard
abstract suspend fun resolveTrust(requester: Requester): TrustedRequesterIdentity?

Determines if a request comes from a trusted requestor and returns the information about the requestor.

Link copied to clipboard
abstract suspend fun selectCredential(document: Document, requestedClaims: List<RequestedClaim>, keyAgreementPossible: List<EcCurve>, credential: Credential? = null, keyBindingRequired: Boolean = true): Credential?

Chooses a credential from a document.

Link copied to clipboard
abstract suspend fun showConsentPrompt(requester: Requester, trustedRequesterIdentity: TrustedRequesterIdentity?, presentmentData: PresentmentData, preselectedDocuments: List<Document>, onDocumentsInFocus: (documents: List<Document>) -> Unit): PresentmentSelection?

A function to show a consent prompt.

Link copied to clipboard

Returns a PresentmentSource that delegates all operations to this instance except showConsentPrompt, which is handled by showConsentPromptFn.