UniversalResolver

Interface for Universal Resolver implementations.

Universal Resolver is a standard HTTP API specification (W3C DID Resolution) that provides a unified interface for resolving DIDs across multiple methods.

Different Universal Resolver providers may use different endpoint patterns:

  • Standard: GET /1.0/identifiers/{did} (used by dev.uniresolver.io)

  • GoDiddy: GET /1.0.0/universal-resolver/identifiers/{did}

  • Custom: Provider-specific patterns

The DefaultUniversalResolver implementation uses a pluggable protocol adapter pattern (UniversalResolverProtocolAdapter) to support different providers without code changes.

Multiple providers can implement this interface:

  • GoDiddy (commercial hosted service) - see GodiddyResolver in did:plugins:godiddy

  • dev.uniresolver.io (public instance) - use DefaultUniversalResolver with StandardUniversalResolverAdapter

  • Self-hosted Universal Resolver instances - use DefaultUniversalResolver with appropriate adapter

Example Usage:

// Using GoDiddy (Ktor-based)
val resolver: UniversalResolver = GodiddyResolver(client)

// Using public dev.uniresolver.io (Java HttpClient with standard adapter)
val resolver: UniversalResolver = DefaultUniversalResolver("https://dev.uniresolver.io")

// Using GoDiddy with Java HttpClient (alternative to Ktor)
val resolver: UniversalResolver = DefaultUniversalResolver(
baseUrl = "https://api.godiddy.com",
protocolAdapter = GodiddyProtocolAdapter(),
apiKey = "your-key"
)

// Using self-hosted instance with standard adapter
val resolver: UniversalResolver = DefaultUniversalResolver(
baseUrl = "https://resolver.example.com",
protocolAdapter = StandardUniversalResolverAdapter()
)

val result = resolver.resolveDid("did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK")

Inheritors

Properties

Link copied to clipboard
abstract val baseUrl: String

Gets the base URL of the Universal Resolver instance.

Functions

Link copied to clipboard

Adapts a UniversalResolver (string-based, exception-throwing HTTP client interface) to the DidResolver contract (typed, always returns a DidResolutionResult).

Link copied to clipboard
abstract suspend fun getSupportedMethods(): List<String>?

Gets the list of supported DID methods (if available).

Link copied to clipboard
abstract suspend fun resolveDid(did: String): DidResolutionResult

Resolves a DID using Universal Resolver standard API.