KeyDidMethod

Native implementation of did:key method.

did:key is the simplest DID method - no external registry required:

  • Format: did:key:{multibase-encoded-public-key}

  • Public key is encoded using multibase (base58btc with 'z' prefix)

  • Document is derived from the public key itself

  • No external resolution needed

Example Usage:

val kms = InMemoryKeyManagementService()
val method = KeyDidMethod(kms)

// Create DID
val options = didCreationOptions {
algorithm = KeyAlgorithm.ED25519
}
val document = method.createDid(options)

// Resolve DID (derived from public key)
val result = method.resolveDid(document.id)

Constructors

Link copied to clipboard
constructor(kms: KeyManagementService)

Properties

Link copied to clipboard
Link copied to clipboard
open override val method: String

Functions

Link copied to clipboard
open suspend override fun createDid(options: DidCreationOptions): DidDocument
Link copied to clipboard
open suspend override fun deactivateDid(did: Did): Boolean
Link copied to clipboard
open suspend fun resolveDid(did: Did, options: ResolutionOptions): DidResolutionResult
open suspend override fun resolveDid(did: Did): DidResolutionResult
Link copied to clipboard
open suspend override fun updateDid(did: Did, updater: (DidDocument) -> DidDocument): DidDocument