HolderAgent

class HolderAgent(validator: Validator = Validator.newDefaultInstance(), subjectCredentialStore: SubjectCredentialStore = InMemorySubjectCredentialStore(), jwsService: JwsService, coseService: CoseService, val keyPair: KeyPairAdapter, verifiablePresentationFactory: VerifiablePresentationFactory = VerifiablePresentationFactory( jwsService = jwsService, coseService = coseService, identifier = keyPair.identifier, ), difInputEvaluator: InputEvaluator = InputEvaluator()) : 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(keyPairAdapter: KeyPairAdapter, subjectCredentialStore: SubjectCredentialStore = InMemorySubjectCredentialStore())
constructor(validator: Validator = Validator.newDefaultInstance(), subjectCredentialStore: SubjectCredentialStore = InMemorySubjectCredentialStore(), jwsService: JwsService, coseService: CoseService, keyPair: KeyPairAdapter, verifiablePresentationFactory: VerifiablePresentationFactory = VerifiablePresentationFactory( jwsService = jwsService, coseService = coseService, identifier = keyPair.identifier, ), difInputEvaluator: InputEvaluator = InputEvaluator())

Properties

Link copied to clipboard
open override val keyPair: KeyPairAdapter

The public key for this agent, i.e. the "holder key" that the credentials get bound to.

Functions

Link copied to clipboard
open suspend override fun createPresentation(challenge: String, audienceId: String, presentationDefinitionId: String?, presentationSubmissionSelection: Map<String, CredentialSubmission>): KmmResult<Holder.PresentationResponseParameters>

Creates an array of VerifiablePresentation and a PresentationSubmission from already preselected presentationSubmissionSelection.

open suspend override fun createPresentation(challenge: String, audienceId: String, presentationDefinition: PresentationDefinition, fallbackFormatHolder: FormatHolder?, pathAuthorizationValidator: PathAuthorizationValidator?): 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): KmmResult<Holder.CreatePresentationResult>
Link copied to clipboard
open override fun evaluateInputDescriptorAgainstCredential(inputDescriptor: InputDescriptor, credential: SubjectCredentialStore.StoreEntry, fallbackFormatHolder: FormatHolder?, pathAuthorizationValidator: (NormalizedJsonPath) -> Boolean): KmmResult<Map<ConstraintField, NodeList>>

Evaluates a given input descriptor against a store enctry.

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(inputDescriptors: Collection<InputDescriptor>, fallbackFormatHolder: FormatHolder?, pathAuthorizationValidator: PathAuthorizationValidator?): KmmResult<Map<String, Map<SubjectCredentialStore.StoreEntry, Map<ConstraintField, NodeList>>>>

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
open suspend override fun storeCredential(credential: Holder.StoreCredentialInput): KmmResult<Holder.StoredCredential>

Stores the verifiable credential in credential if it parses and validates, and returns it for future reference.