AbstractWebDidMethod

abstract class AbstractWebDidMethod(method: String, kms: KeyManagementService, httpClient: OkHttpClient, ownsHttpClient: Boolean = false) : AbstractDidMethod, AutoCloseable

Abstract base class for HTTP-based DID method implementations (e.g., did:web).

Provides common functionality for DID methods that host documents over HTTP/HTTPS:

  • HTTP client for document retrieval and publishing

  • Document hosting abstraction

  • HTTPS validation

  • Common HTTP error handling

Subclasses should implement:

Pattern: HTTP client abstraction for web-based DID methods.

Example Usage:

class WebDidMethod(
kms: KeyManagementService,
private val httpClient: OkHttpClient,
private val documentHost: DocumentHost
) : AbstractWebDidMethod("web", kms, httpClient) {

override fun getDocumentUrl(did: String): String {
val (_, domain, path) = parseWebDid(did)
return if (path != null) {
"https://$domain/.well-known/did.json"
} else {
"https://$domain/.well-known/did.json"
}
}

override suspend fun publishDocument(url: String, document: DidDocument): Boolean {
return documentHost.publish(url, document)
}
}

Constructors

Link copied to clipboard
constructor(method: String, kms: KeyManagementService, httpClient: OkHttpClient, ownsHttpClient: Boolean = false)

Properties

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

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
abstract suspend fun createDid(options: DidCreationOptions): DidDocument
Link copied to clipboard
open suspend override fun deactivateDid(did: Did): Boolean

Default implementation of deactivateDid using in-memory storage.

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

Default implementation of updateDid using in-memory storage.