DefaultUniversalResolver
Default implementation of UniversalResolver using Java's built-in HTTP client.
This implementation works with any Universal Resolver instance through a pluggable protocol adapter pattern. Different providers can use different endpoint patterns, authentication mechanisms, and response formats.
Example Usage:
// Use public dev.uniresolver.io instance with standard adapter (default)
val resolver = DefaultUniversalResolver("https://dev.uniresolver.io")
// Use self-hosted instance with standard adapter
val resolver = DefaultUniversalResolver(
baseUrl = "https://resolver.example.com",
protocolAdapter = StandardUniversalResolverAdapter()
)
// Use GoDiddy with custom adapter
val resolver = DefaultUniversalResolver(
baseUrl = "https://api.godiddy.com",
protocolAdapter = GodiddyProtocolAdapter()
)
val result = resolver.resolveDid("did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK")Parameters
Base URL of the Universal Resolver instance (e.g., "https://dev.uniresolver.io")
Request timeout in seconds (default: 30). Ignored when httpClient is provided.
Optional API key for authentication (if required by the resolver)
Protocol adapter for the specific Universal Resolver implementation (defaults to StandardUniversalResolverAdapter)
Optional pre-configured HttpClient to use for HTTP requests. When null a default client with timeout-based connect timeout is created. Inject a shared client in production to allow connection-pool reuse and easier testing.
Constructors
Functions
Adapts a UniversalResolver (string-based, exception-throwing HTTP client interface) to the DidResolver contract (typed, always returns a DidResolutionResult).
Gets the list of supported DID methods (if available).
Resolves a DID using Universal Resolver standard API.