Struct identity_iota::client::Resolver
source · [−]Expand description
A Resolver
supports resolving DID Documents across different Tangle networks using
multiple Clients
.
Also provides convenience functions for resolving DID Documents associated with
verifiable Credentials
and Presentations
.
Implementations
sourceimpl<C> Resolver<C> where
C: SharedPtr<Client>,
impl<C> Resolver<C> where
C: SharedPtr<Client>,
sourcepub async fn new() -> Result<Resolver<C>, Error>
pub async fn new() -> Result<Resolver<C>, Error>
Constructs a new Resolver
with a default Client
for
the Mainnet
.
See also Resolver::builder
.
sourcepub fn builder() -> ResolverBuilder<Arc<Client>>
pub fn builder() -> ResolverBuilder<Arc<Client>>
Returns a new ResolverBuilder
with no configured Clients
.
sourcepub fn get_client(&self, network_name: &NetworkName) -> Option<&C>
pub fn get_client(&self, network_name: &NetworkName) -> Option<&C>
Returns the Client
corresponding to the given NetworkName
if one exists.
sourcepub async fn resolve(
&self,
did: &IotaDID
) -> Result<ResolvedIotaDocument, Error>
pub async fn resolve(
&self,
did: &IotaDID
) -> Result<ResolvedIotaDocument, Error>
Fetches the ResolvedIotaDocument
of the given IotaDID
.
sourcepub async fn resolve_history(
&self,
did: &IotaDID
) -> Result<DocumentHistory, Error>
pub async fn resolve_history(
&self,
did: &IotaDID
) -> Result<DocumentHistory, Error>
Fetches the DocumentHistory
of the given IotaDID
.
sourcepub async fn resolve_diff_history(
&self,
document: &ResolvedIotaDocument
) -> Result<ChainHistory<DiffMessage>, Error>
👎 Deprecated since 0.5.0: diff chain features are slated for removal
pub async fn resolve_diff_history(
&self,
document: &ResolvedIotaDocument
) -> Result<ChainHistory<DiffMessage>, Error>
diff chain features are slated for removal
Fetches the ChainHistory
of a diff chain starting from a ResolvedIotaDocument
on the
integration chain.
NOTE: the document must have been published to the Tangle and have a valid message id.
sourcepub async fn resolve_credential_issuer<U>(
&self,
credential: &Credential<U>
) -> Result<ResolvedIotaDocument, Error> where
U: Serialize,
pub async fn resolve_credential_issuer<U>(
&self,
credential: &Credential<U>
) -> Result<ResolvedIotaDocument, Error> where
U: Serialize,
Fetches the DID Document of the issuer on a Credential
.
Errors
Errors if the issuer URL is not a valid IotaDID
or DID resolution fails.
sourcepub async fn resolve_presentation_issuers<U, V>(
&self,
presentation: &Presentation<U, V>
) -> Result<Vec<ResolvedIotaDocument, Global>, Error> where
V: Serialize,
pub async fn resolve_presentation_issuers<U, V>(
&self,
presentation: &Presentation<U, V>
) -> Result<Vec<ResolvedIotaDocument, Global>, Error> where
V: Serialize,
Fetches all DID Documents of Credential
issuers contained in a Presentation
.
Issuer documents are returned in arbitrary order.
Errors
Errors if any issuer URL is not a valid IotaDID
or DID resolution fails.
sourcepub async fn resolve_presentation_holder<U, V>(
&self,
presentation: &Presentation<U, V>
) -> Result<ResolvedIotaDocument, Error>
pub async fn resolve_presentation_holder<U, V>(
&self,
presentation: &Presentation<U, V>
) -> Result<ResolvedIotaDocument, Error>
Fetches the DID Document of the holder of a Presentation
.
Errors
Errors if the holder URL is missing, is not a valid IotaDID
, or DID resolution fails.
sourcepub async fn verify_presentation<U, V>(
&self,
presentation: &Presentation<U, V>,
options: &PresentationValidationOptions,
fail_fast: FailFast,
holder: Option<&ResolvedIotaDocument>,
issuers: Option<&[ResolvedIotaDocument]>
) -> Result<(), Error> where
U: Serialize,
V: Serialize,
pub async fn verify_presentation<U, V>(
&self,
presentation: &Presentation<U, V>,
options: &PresentationValidationOptions,
fail_fast: FailFast,
holder: Option<&ResolvedIotaDocument>,
issuers: Option<&[ResolvedIotaDocument]>
) -> Result<(), Error> where
U: Serialize,
V: Serialize,
Verifies a Presentation
.
Important
See PresentationValidator::validate
for information about which properties
get validated and what is expected of the optional arguments holder
and issuer
.
Resolution
The DID Documents for the holder
and issuers
are optionally resolved if not given.
If you already have up-to-date versions of these DID Documents, you may want
to use PresentationValidator::validate
.
See also Resolver::resolve_presentation_issuers
and Resolver::resolve_presentation_holder
.
Errors
Errors from resolving the holder and issuer DID Documents, if not provided, will be returned immediately.
Otherwise, errors from validating the presentation and its credentials will be returned
according to the fail_fast
parameter.
Trait Implementations
sourceimpl TangleResolve for Resolver<Arc<Client>>
impl TangleResolve for Resolver<Arc<Client>>
Auto Trait Implementations
impl<C> RefUnwindSafe for Resolver<C> where
C: RefUnwindSafe,
impl<C> Send for Resolver<C> where
C: Send,
impl<C> Sync for Resolver<C> where
C: Sync,
impl<C> Unpin for Resolver<C> where
C: Unpin,
impl<C> UnwindSafe for Resolver<C> where
C: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more