This guide covers the walt.id integration for TrustWeave. The walt.id plugin provides walt.id-based KMS and DID methods with SPI-based discovery, supporting did:key and did:web methods.
Overview
The kms/plugins/waltid module provides integration with walt.id libraries for key management and DID operations. This integration enables you to:
Use walt.id KMS for secure key generation and signing
Support did:key and did:web DID methods via walt.id
Leverage SPI-based auto-discovery of walt.id providers
Integrate walt.id libraries seamlessly into TrustWeave workflows
The walt.id integration supports automatic discovery via SPI:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
importcom.trustweave.waltid.WaltIdIntegrationimportcom.trustweave.did.*importcom.trustweave.kms.*importkotlinx.coroutines.runBlockingrunBlocking{// Auto-discover and register walt.id providersvalresult=WaltIdIntegration.discoverAndRegister()// Access registered componentsvalkms=result.kmsvalregistry=result.registryvalregisteredMethods=result.registeredDidMethodsprintln("Registered DID methods: $registeredMethods")}
Manual Setup
You can also manually configure walt.id components:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
importcom.trustweave.waltid.*importcom.trustweave.did.*importcom.trustweave.kms.*// Create walt.id KMSvalkms=WaltIdKeyManagementService()// Create DID methodsvalkeyMethod=WaltIdDidKeyMethod(kms)valwebMethod=WaltIdDidWebMethod(kms)// Register methodsvalregistry=DidMethodRegistry()registry.register("key",keyMethod)registry.register("web",webMethod)
Usage Examples
KMS Operations
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
importcom.trustweave.waltid.*importcom.trustweave.kms.*valkms=WaltIdKeyManagementService()// Generate keyvalkey=kms.generateKey(Algorithm.Ed25519)println("Generated key: ${key.id}")// Sign data (key.id is already a KeyId value class)valdata="Hello, TrustWeave!".toByteArray()valsignature=kms.sign(key.id,data)println("Signature: ${signature.toHexString()}")// Get public key (key.id is already a KeyId value class)valpublicKey=kms.getPublicKey(key.id)println("Public key: ${publicKey.toHexString()}")