FallbackDidResolver
Composite resolver that delegates to fallback when the primary resolver does not support the DID's method.
Fallback trigger — DidResolutionResult.Failure.MethodNotRegistered only. This is the one failure that means "the primary resolver cannot answer for this method at all", e.g. a local RegistryBasedResolver without a driver for did:ion.
Failures that deliberately do NOT trigger fallback:
DidResolutionResult.Failure.NotFound: the method IS registered locally and that method authoritatively reported the DID as absent. Silently consulting another source could resurrect deleted/never-existing DIDs and produce trust decisions that diverge from the authoritative method driver.
DidResolutionResult.Failure.InvalidFormat: a malformed DID is malformed for every resolver; retrying elsewhere only wastes a network round-trip.
DidResolutionResult.Failure.ResolutionError: the method is registered but errored (network/driver failure). Falling back would mask operational problems and may return a different view of the DID than the configured driver. If you want try-everything redundancy semantics, use ResolutionFallbackStrategy instead.
Example Usage:
val registry: DidResolver = RegistryBasedResolver(didMethodRegistry) // local methods
val universal: DidResolver = DefaultUniversalResolver("https://dev.uniresolver.io")
.asDidResolver() // remote fallback
// Locally registered methods are authoritative; anything else goes to the
// universal resolver. Wrap in a cache for production use:
val resolver = CachingDidResolver(FallbackDidResolver(registry, universal))
val local = resolver.resolve(Did("did:key:z6Mk...")) // resolved by the registry
val remote = resolver.resolve(Did("did:ion:EiD...")) // not registered → universalParameters
The authoritative resolver tried first (e.g. local registry/methods)
The resolver consulted only when primary does not know the method