Skip to main content

DidResolver

Trait DidResolver 

Source
pub trait DidResolver: Send + Sync {
    // Required methods
    fn method(&self) -> &'static str;
    fn resolve<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        did: &'life1 Did,
        options: &'life2 ResolutionOptions,
    ) -> Pin<Box<dyn Future<Output = Result<ResolutionResult, ResolutionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Resolves the DIDs of one method (DID Resolution “DID Resolution Algorithm”).

A resolver is registered with a Resolver under method and receives only DIDs of that method. It is Send + Sync and resolution is async because most methods fetch the document over the network or from a registry.

A failed resolution may be reported either as Err, or as an Ok result whose resolution metadata carries the error, which is the shape a method that builds a full ResolutionResult (a client of a remote resolver, say) produces anyway. The Resolver normalizes both to Err.

Required Methods§

Source

fn method(&self) -> &'static str

The method name this resolver handles: web for did:web.

Source

fn resolve<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, did: &'life1 Did, options: &'life2 ResolutionOptions, ) -> Pin<Box<dyn Future<Output = Result<ResolutionResult, ResolutionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Resolves did, whose method is method, with options.

On success the result holds the document with id equal to did (or to the canonicalId of the document metadata) and whatever metadata the method knows. A deactivated DID resolves to a result without a document whose document metadata has deactivated: true.

§Errors

A ResolutionError whose kind is NotFound for a DID that does not exist, RepresentationNotSupported for an accept the method cannot produce, or InternalError for an unexpected failure such as a network error. Attach what caused it with ResolutionError::with_source and ResolutionError::with_detail, so callers can tell one failure from another.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: DidResolver + ?Sized> DidResolver for &T

Source§

fn method(&self) -> &'static str

Source§

fn resolve<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, did: &'life1 Did, options: &'life2 ResolutionOptions, ) -> Pin<Box<dyn Future<Output = Result<ResolutionResult, ResolutionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

impl<T: DidResolver + ?Sized> DidResolver for Arc<T>

Source§

fn method(&self) -> &'static str

Source§

fn resolve<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, did: &'life1 Did, options: &'life2 ResolutionOptions, ) -> Pin<Box<dyn Future<Output = Result<ResolutionResult, ResolutionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

impl<T: DidResolver + ?Sized> DidResolver for Box<T>

Source§

fn method(&self) -> &'static str

Source§

fn resolve<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, did: &'life1 Did, options: &'life2 ResolutionOptions, ) -> Pin<Box<dyn Future<Output = Result<ResolutionResult, ResolutionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Implementors§

Source§

impl DidResolver for DidJwk

Available on crate feature did-jwk and (crate features did-jwk or did-key or did-web) only.
Source§

impl DidResolver for DidKey

Available on crate feature did-key and (crate features did-jwk or did-key or did-web) only.
Source§

impl<C: HttpClient> DidResolver for DidWeb<C>

Available on crate feature did-web and (crate features did-jwk or did-key or did-web) only.