TrustRegistry
Trust registry for managing trust anchors and discovering trust paths.
A trust registry maintains a graph of trusted DIDs (trust anchors) and allows verification of whether an issuer is trusted, either directly or through a trust path.
Example Usage:
val registry: TrustRegistry = InMemoryTrustRegistry()
// Add a trust anchor
registry.addTrustAnchor(
anchorDid = "did:key:trusted-issuer",
metadata = TrustAnchorMetadata(
credentialTypes = listOf("EducationCredential"),
description = "Trusted university",
addedAt = Clock.System.now()
)
)
// Check if issuer is trusted
val isTrusted = registry.isTrustedIssuer("did:key:trusted-issuer", "EducationCredential")
// Find trust path
val path = registry.findTrustPath(
VerifierIdentity(Did("did:key:verifier")),
IssuerIdentity(Did("did:key:issuer"))
)Functions
Adds a trust anchor to the registry.
Finds a trust path between two identities (first-class type).
Gets all trusted issuers for a specific credential type.
Gets all trusted issuers for a specific credential type (type-safe overload).
CredentialTrustPolicy without a credential type: trusted only if the anchor is trusted for every type (isTrustedForAllTypes). Verification uses the typed overload when it knows the credential's types.
Checks trust for a credential with the given type entries. Every type other than the base VerifiableCredential must be permitted by the anchor; with no specific type, the base type must be. An empty list is a typeless question and is answered by isTrusted (fail closed for a type-restricted anchor).
Whether issuerDid is a trust anchor trusted for every credential type, i.e. one with no type restriction.
Checks if an issuer DID is trusted for a specific credential type.
Checks if an issuer is trusted for a specific credential type (type-safe overload).
Removes a trust anchor from the registry.