DidDocumentBuilder

DID Document Builder DSL.

Provides a fluent API for updating DID documents (adding/removing keys, services, etc.).

Example Usage:

val updatedDoc = trustWeave.updateDid {
did("did:key:issuer")
method("key")

addKey {
type("Ed25519VerificationKey2020")
publicKeyJwk(newKeyHandle.publicKeyJwk)
}

removeKey("did:key:issuer#key-1")

addService {
id("did:key:issuer#service-1")
type("LinkedDomains")
endpoint("https://example.com")
}
}

Constructors

Link copied to clipboard
constructor(didContext: DidDslContext)

Types

Link copied to clipboard
inner class ServiceBuilder

Service builder.

Link copied to clipboard
inner class VerificationMethodBuilder(controllerDid: String)

Verification method builder.

Functions

Link copied to clipboard

Add a verification method reference to capability delegation.

Link copied to clipboard

Add a verification method reference to capability invocation.

Link copied to clipboard

Add a new verification method (key).

Link copied to clipboard

Add a new service endpoint.

Link copied to clipboard
fun context(vararg contexts: String)

Set JSON-LD context values for the DID document.

Link copied to clipboard
fun did(did: String)

Set DID to update.

Link copied to clipboard
fun method(method: String)

Set DID method (auto-detected from DID if not provided).

Link copied to clipboard

Remove a verification method reference from capability delegation.

Link copied to clipboard

Remove a verification method reference from capability invocation.

Link copied to clipboard
fun removeKey(keyId: String)

Remove a verification method by ID.

Link copied to clipboard
fun removeService(serviceId: String)

Remove a service by ID.

Link copied to clipboard
suspend fun update(): DidDocument

Update the DID document.