Package-level declarations

Types

Link copied to clipboard
@Serializable
data class DidDocument(val id: Did, val context: List<String> = listOf("https://www.w3.org/ns/did/v1"), val alsoKnownAs: List<DidOrUrl> = emptyList(), val controller: List<Did> = emptyList(), val verificationMethod: List<VerificationMethod> = emptyList(), val authentication: List<VerificationMethodId> = emptyList(), val assertionMethod: List<VerificationMethodId> = emptyList(), val keyAgreement: List<VerificationMethodId> = emptyList(), val capabilityInvocation: List<VerificationMethodId> = emptyList(), val capabilityDelegation: List<VerificationMethodId> = emptyList(), val service: List<DidService> = emptyList())

Represents a DID Document following W3C DID Core structure.

Link copied to clipboard
@Serializable
data class DidDocumentMetadata(val created: Instant? = null, val updated: Instant? = null, val deactivated: Boolean = false, val versionId: String? = null, val nextUpdate: Instant? = null, val nextVersionId: String? = null, val canonicalId: Did? = null, val equivalentId: List<Did> = emptyList(), val proof: List<JsonObject> = emptyList())

DID document metadata per DID Resolution 1.0 §4.3 — metadata about the DID document.

Link copied to clipboard
@Serializable(with = DidOrUrlSerializer::class)
sealed class DidOrUrl

An entry for DidDocument.alsoKnownAs per W3C DID / Controlled Identifiers: each value is either a DID (did:…) or a non-DID URL (absolute URI, e.g. https://…).

Link copied to clipboard
object DidOrUrlSerializer : KSerializer<DidOrUrl>
Link copied to clipboard
@Serializable
data class DidService(val id: String, val type: List<String>, val serviceEndpoint: ServiceEndpoint)

Represents a service endpoint in a DID Document.

Link copied to clipboard
@Serializable
data class MethodCapabilities(val method: String = "", val create: Boolean = false, val resolve: Boolean = true, val update: Boolean = false, val deactivate: Boolean = false, val keyTypes: List<String> = emptyList(), val features: List<String> = emptyList())

Capabilities supported by a DID method implementation.

Link copied to clipboard
@Serializable(with = ServiceEndpointSerializer::class)
sealed class ServiceEndpoint

Type-safe model for DidService.serviceEndpoint.

Link copied to clipboard

KSerializer for ServiceEndpoint that preserves the exact W3C DID Core wire format:

Link copied to clipboard
@Serializable
data class VerificationMethod(val id: VerificationMethodId, val type: String, val controller: Did, val publicKeyJwk: Map<String, Any?>? = null, val publicKeyMultibase: String? = null)

Represents a verification method in a DID Document.

Functions

Link copied to clipboard

Expands relative DID URLs in this document to absolute DID URLs, per the expandRelativeUrls resolution option (DID Resolution 1.0 §4.1, §4.4).

Link copied to clipboard
fun parseServiceTypesFromJson(el: JsonElement?): List<String>?

Parse service type from JSON (string or array of strings) per DID 1.1 §5.4.

Link copied to clipboard

Re-expresses a document that was produced for from as a document for to, consistently.

Link copied to clipboard

Gets the service endpoint as an array, if it's an array.

Link copied to clipboard

Gets the service endpoint as an object (map), if it's an object.

Link copied to clipboard

Gets the service endpoint as a URL string, if it's a simple URL.

Link copied to clipboard
fun serviceEndpointFromJsonElement(element: JsonElement?): ServiceEndpoint?

Parses a JsonElement into a ServiceEndpoint, or returns null for null/unsupported shapes. Object values are decoded into native Kotlin values (String/Long/Double/Boolean/Map/List) so the representation matches what the previous untyped parser produced.

Link copied to clipboard
fun serviceEndpointToJsonElement(endpoint: ServiceEndpoint): JsonElement

Converts a ServiceEndpoint to a JsonElement using the canonical DID document wire rules. Numbers are emitted as their original JSON token where possible; primitives recovered from ServiceEndpoint.ObjectEndpoint/ServiceEndpoint.ArrayEndpoint follow the same rules as the shared DID document producer.

Link copied to clipboard

Returns the typed ServiceEndpoint for this service.

Link copied to clipboard

Converts a ServiceEndpoint back to a raw value (String, Map, or List).

Link copied to clipboard

Serialize service type (DID 1.1: string or set of strings) to JSON. Single type → string; multiple → array.