TrustBuilder

class TrustBuilder(registry: TrustRegistry)

Trust Registry DSL.

Provides a fluent API for managing trust anchors and discovering trust paths.

Example Usage:

val trustWeave = trustWeave {
trust {
provider("inMemory")
}
}

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

val isTrusted = isTrusted("did:key:university", "EducationCredential")
val path = findTrustPath(Did("did:key:verifier"), Did("did:key:issuer"))
}

Constructors

Link copied to clipboard
constructor(registry: TrustRegistry)

Functions

Link copied to clipboard
suspend fun addAnchor(did: String, block: TrustAnchorMetadataBuilder.() -> Unit = {}): Boolean

Add a trust anchor with metadata.

suspend fun addAnchor(did: Did, config: TrustAnchorConfig): Boolean

Add trust anchor using infix syntax with explicit DID.

Link copied to clipboard

Find a trust path between two identities (first-class type).

Link copied to clipboard
suspend fun TrustBuilder.findTrustPath(from: Did, to: Did): TrustPath

Extension function to find trust path within TrustBuilder context.

Link copied to clipboard
suspend fun getTrustedIssuers(credentialType: String? = null): List<String>

Get all trusted issuers for a credential type.

Link copied to clipboard
suspend fun isTrusted(issuerDid: String, credentialType: String? = null): Boolean

Check if an issuer is trusted.

Link copied to clipboard
suspend fun removeAnchor(did: String): Boolean

Remove a trust anchor.

Link copied to clipboard
suspend fun resolve(pathFinder: TrustPathFinder): TrustPath

Resolve trust path using infix syntax.