DecentralizedResolutionStrategy

class DecentralizedResolutionStrategy(localResolver: DidResolver, universalResolver: DidResolver, methodSpecificResolvers: Map<String, DidResolver> = emptyMap(), maxCacheAge: Duration = 1.hours) : DidResolver

Decentralized Resolution Strategy.

Implements multi-source resolution with fallback to maintain decentralization principles. Tries multiple resolution sources in order:

  1. Local storage (fastest, but may be stale)

  2. Method-specific resolver (most authoritative)

  3. Universal Resolver (decentralized fallback)

Decentralization Benefits:

  • No single point of failure

  • Multiple resolution sources

  • Freshness checking for cached results

  • Graceful degradation

Example Usage:

val strategy = DecentralizedResolutionStrategy(
localResolver = RegistryBasedResolver(registry),
universalResolver = DefaultUniversalResolver("https://dev.uniresolver.io"),
methodSpecificResolvers = mapOf(
"web" to WebDidResolver(),
"key" to KeyDidResolver()
)
)

val result = strategy.resolve(Did("did:web:example.com"))

Constructors

Link copied to clipboard
constructor(localResolver: DidResolver, universalResolver: DidResolver, methodSpecificResolvers: Map<String, DidResolver> = emptyMap(), maxCacheAge: Duration = 1.hours)

Functions

Link copied to clipboard
open suspend override fun resolve(did: Did): DidResolutionResult

Resolves a DID to a DID resolution result.

open suspend override fun resolve(did: Did, options: ResolutionOptions): DidResolutionResult

Resolves with DID Resolution 1.0 §4.1 options, forwarded unchanged to whichever of localResolver, methodSpecificResolvers or universalResolver ends up answering — same three-stage precedence as the single-argument resolve. Each stage is itself a DidResolver and independently responsible for judging support for the options it receives (e.g. reporting FEATURE_NOT_SUPPORTED for a versionId it cannot honour); this strategy does not interpret options itself beyond forwarding them.

Link copied to clipboard

Resolves a DID and returns the document, or null if it could not be resolved.

Link copied to clipboard

Resolves a DID and returns the document, or throws if not found.