AbstractDidMethod
Abstract base class for DID method implementations.
Provides common functionality shared across DID method adapters:
In-memory document storage for testing
Common updateDid and deactivateDid implementations
Document metadata helpers
Error handling patterns
Subclasses should implement:
createDid: Create a new DID and return its initial DID Document
resolveDid: Resolve a DID to its DID Document
Pattern: Similar to AbstractBlockchainAnchorClient (~40% code reduction).
Example Usage:
class MyDidMethod(
kms: KeyManagementService
) : AbstractDidMethod("mymethod", kms) {
override suspend fun createDid(options: DidCreationOptions): DidDocument {
// Implement method-specific creation logic
}
override suspend fun resolveDid(did: Did): DidResolutionResult {
// Implement method-specific resolution logic
}
}Content copied to clipboard