VerificationBuilder

class VerificationBuilder(credentialService: CredentialService, ioDispatcher: CoroutineDispatcher = Dispatchers.IO)

Verification Builder DSL.

Provides a fluent API for verifying credentials. Focused only on credential-specific verification operations.

Example Usage:

val result = verifier.verify {
credential(credential)
checkRevocation()
checkExpiration()
validateSchema("https://example.edu/schemas/degree.json")
}

Constructors

Link copied to clipboard
constructor(credentialService: CredentialService, ioDispatcher: CoroutineDispatcher = Dispatchers.IO)

Functions

Link copied to clipboard
fun additionalOption(key: String, value: Any?)

Inject an engine-specific verification option into VerificationOptions.additionalOptions.

Link copied to clipboard

Allow untrusted issuers (no trust checking). This is the default behavior.

Link copied to clipboard
suspend fun build(): VerificationResult

Build and perform verification.

Link copied to clipboard
fun challenge(challenge: String)

Require the presentation to include the given challenge value. Sets verifyChallenge=true and stores the expected value.

Link copied to clipboard

Enable expiration checking.

Link copied to clipboard

Enable revocation checking.

Link copied to clipboard

Set the credential to verify.

Link copied to clipboard
fun domain(domain: String)

Require the presentation to include the given domain value. Sets verifyDomain=true and stores the expected value.

Link copied to clipboard

Enable or disable holder binding enforcement. When enabled, each credential's credentialSubject.id must match the presentation holder.

Link copied to clipboard

Reject SD-JWT VC credentials that carry no issuer-signed cnf holder binding (opt-in, default off). Without this, a cnf-less SD-JWT credential is accepted as a bearer credential.

Link copied to clipboard
fun VerificationBuilder.requireJadesProfile(profile: JadesProfile, trustAnchorResolver: TrustAnchorResolver, acceptedAlgorithms: Set<String>? = null)

Require the credential's proof to be a JAdES proof matching profile, and supply the trust-anchor resolver the engine consults for signer-cert qualification.

Link copied to clipboard

Require issuer to be a trusted anchor in the trust registry.

Link copied to clipboard
fun requireTrustPath(registry: TrustRegistry, maxPathLength: Int = 3)

Despite its name this does not search for a trust path and ignores maxPathLength: it is exactly requireTrust, i.e. the issuer must be a trust anchor of registry (for the credential's types). A path search needs a verifier identity, which this builder does not have, so the depth limit cannot be honoured; use requireTrust, or call TrustRegistry.findTrustPath yourself and enforce your own limit.

Link copied to clipboard

Disable expiration checking.

Link copied to clipboard

Disable revocation checking.

Link copied to clipboard

Disable schema validation.

Link copied to clipboard

Enable proof purpose validation.

Link copied to clipboard
fun validateSchema(schemaId: String)

Enable schema validation.

Link copied to clipboard

Enable or disable presentation proof verification.

Link copied to clipboard
fun VerificationBuilder.withJadesTrustAnchorResolver(resolver: TrustAnchorResolver)

Supply the trust-anchor resolver without imposing a profile floor. Useful when the caller trusts whatever profile the credential was issued with (typical for B-T credentials inspected by a B-B-tolerant verifier).

Link copied to clipboard
fun withTrustPolicy(policy: TrustEvaluator)

Use a custom trust policy.