KeyRotationBuilder

class KeyRotationBuilder(didContext: DidDslContext, kms: KeyManagementService, kmsService: KmsService, ioDispatcher: CoroutineDispatcher = Dispatchers.IO)

Key Rotation Builder DSL.

Provides a fluent API for rotating keys in DID documents. Automatically generates new keys and updates DID documents.

This is in the trust module because it requires both DID and KMS operations.

Example Usage:

val trustWeave: TrustWeave = ...
val updatedDoc = trustWeave.rotateKey {
did("did:key:issuer")
algorithm("Ed25519")
removeOldKey("key-1")
}

Constructors

Link copied to clipboard
constructor(didContext: DidDslContext, kms: KeyManagementService, kmsService: KmsService, ioDispatcher: CoroutineDispatcher = Dispatchers.IO)

Functions

Link copied to clipboard
fun algorithm(algorithm: String)

Set key algorithm for new key by string name.

Set key algorithm using type-safe enum.

Link copied to clipboard
fun did(did: String)

Set DID to rotate keys for.

Link copied to clipboard
fun method(method: String)

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

Link copied to clipboard
fun removeOldKey(keyId: String)

Remove old key after rotation.

Link copied to clipboard
suspend fun rotate(): DidDocument

Rotate the key.