trust

suspend fun trust(block: suspend TrustBuilder.() -> Unit): TrustPath.NotConfigured?

Deprecated

Nullable NotConfigured return and propagating exceptions; use trustResult { }.

Replace with

trustResult(block)

Perform trust operations using the trust DSL.

Provides a fluent API for managing trust anchors and discovering trust paths. The registry must be configured in the TrustWeaveConfig.

Example:

val notConfigured = trustWeave.trust {
addAnchor("did:key:university") {
credentialTypes("EducationCredential")
description("Trusted university")
}

val isTrusted = isTrusted("did:key:university", "EducationCredential")
val path = findTrustPath(VerifierIdentity(Did("did:key:verifier")), IssuerIdentity(Did("did:key:issuer")))
}
if (notConfigured != null) {
println("Trust registry not configured: ${notConfigured.reason}")
}

Result contract: the only failure reported through the return value is a missing trust registry (TrustPath.NotConfigured); block is then not run. Anything block or the registry throws (for example an invalid anchor DID) propagates as an exception. null means block ran to completion — it is not a "trusted" verdict; use isTrusted / findTrustPath inside or outside the block for that.

Return

TrustPath.NotConfigured if the trust registry is not configured, null on success

Parameters

block

DSL block for trust operations