HolderAgent

class HolderAgent(validator: Validator = Validator.newDefaultInstance(), subjectCredentialStore: SubjectCredentialStore = InMemorySubjectCredentialStore(), jwsService: JwsService, coseService: CoseService, val identifier: String, verifiablePresentationFactory: VerifiablePresentationFactory = VerifiablePresentationFactory( jwsService = jwsService, coseService = coseService, identifier = identifier, ), difInputEvaluator: InputEvaluator = InputEvaluator(), val defaultPathAuthorizationValidator: (SubjectCredentialStore.StoreEntry, NormalizedJsonPath) -> Boolean = { _, _ -> true }) : Holder

An agent that only implements Holder, i.e. it can receive credentials form other agents and present credentials to other agents.

Constructors

Link copied to clipboard
constructor(validator: Validator = Validator.newDefaultInstance(), subjectCredentialStore: SubjectCredentialStore = InMemorySubjectCredentialStore(), jwsService: JwsService, coseService: CoseService, identifier: String, verifiablePresentationFactory: VerifiablePresentationFactory = VerifiablePresentationFactory( jwsService = jwsService, coseService = coseService, identifier = identifier, ), difInputEvaluator: InputEvaluator = InputEvaluator(), defaultPathAuthorizationValidator: (SubjectCredentialStore.StoreEntry, NormalizedJsonPath) -> Boolean = { _, _ -> true })

Types

Link copied to clipboard
data class CandidateInputMatchContainer(val credential: SubjectCredentialStore.StoreEntry, val fieldQueryResults: FieldQueryResults)
Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
open override val identifier: String

The identifier for this agent, typically the keyId from the cryptographic key, e.g. did:key:mAB... or urn:ietf:params:oauth:jwk-thumbprint:sha256:...

Functions

Link copied to clipboard
suspend fun createPresentation(challenge: String, audienceId: String, presentationDefinitionId: String?, inputDescriptorMatches: List<Pair<InputDescriptor, HolderAgent.CandidateInputMatchContainer>>): KmmResult<Holder.PresentationResponseParameters>

open suspend override fun createPresentation(challenge: String, audienceId: String, presentationDefinition: PresentationDefinition, fallbackFormatHolder: FormatHolder?, pathAuthorizationValidator: (SubjectCredentialStore.StoreEntry, NormalizedJsonPath) -> Boolean): KmmResult<Holder.PresentationResponseParameters>

Creates an array of VerifiablePresentation and a PresentationSubmission to match the presentationDefinition.

Link copied to clipboard
suspend fun createVcPresentation(validCredentials: List<String>, challenge: String, audienceId: String): Holder.CreatePresentationResult?
Link copied to clipboard
open suspend override fun getCredentials(): Collection<Holder.StoredCredential>?

Gets a list of all stored credentials, with a revocation status.

open suspend override fun matchInputDescriptorsAgainstCredentialStore(presentationDefinition: PresentationDefinition, fallbackFormatHolder: FormatHolder?, pathAuthorizationValidator: (SubjectCredentialStore.StoreEntry, NormalizedJsonPath) -> Boolean): KmmResult<Map<InputDescriptor, HolderAgent.CandidateInputMatchContainer?>>

Creates a mapping from the input descriptors of the presentation definition to matching credentials and the fields that would need to be disclosed.

Link copied to clipboard
open override fun setRevocationList(it: String): Boolean

Sets the revocation list ot use for further processing of Verifiable Credentials

Link copied to clipboard

Stores all verifiable credentials from credentialList that parse and validate, and returns them for future reference.