Skip to main content

DomainLinkageClient

Struct DomainLinkageClient 

Source
pub struct DomainLinkageClient<C, R, V = DefaultVerifier> { /* private fields */ }
Available on crate feature domain-linkage only.
Expand description

Fetches DID configuration resources with an HttpClient and validates them with a DomainLinkageValidator: for an origin, for one DID at an origin, or for every origin a DID document lists.

Origins come from callers and from DID documents, so the client fetches whatever a DID controller names, and validating a whole configuration resolves every DID it names: http, and the did:web client of the resolver, must enforce the protections ReqwestClient (feature reqwest) does (HTTPS only, no redirects, no non-public addresses after name resolution, a body limit and a timeout), or fetching becomes a request forgery primitive. A DID document can also list any number of origins, so validate_document fetches at most max_origins of them.

Implementations§

Source§

impl<C, R, V> DomainLinkageClient<C, R, V>

Source

pub const DEFAULT_MAX_ORIGINS: usize = 32

The most origins new fetches for one DID document: 32.

Source§

impl<C: HttpClient, R: KeyResolver, V: JwsVerifier> DomainLinkageClient<C, R, V>

Source

pub fn new(http: C, validator: DomainLinkageValidator<R, V>) -> Self

A client fetching with http and validating with validator, fetching at most DEFAULT_MAX_ORIGINS origins of a DID document.

Source

pub fn with_max_origins(self, max_origins: usize) -> Self

This client fetching at most max_origins origins of a DID document.

Source

pub fn max_origins(&self) -> usize

The most origins validate_document fetches for one document.

Source

pub fn http(&self) -> &C

The HTTP client.

Source

pub fn validator(&self) -> &DomainLinkageValidator<R, V>

The validator.

Source

pub async fn fetch_configuration( &self, origin: &Url, ) -> Result<DomainLinkageConfiguration, DomainLinkageError>

The DID configuration resource of origin, unvalidated.

§Errors

As fetch_configuration.

Source

pub async fn validate_origin( &self, origin: &Url, options: &CredentialValidationOptions, ) -> Result<DomainLinkageReport, DomainLinkageError>

Fetches the configuration of origin and validates every JWT entry, as DomainLinkageValidator::validate_configuration.

§Errors

As fetch_configuration and validate_configuration.

Source

pub async fn validate_linkage( &self, did: &Did, origin: &Url, options: &CredentialValidationOptions, ) -> Result<DecodedCredential, DomainLinkageError>

Fetches the configuration of origin and validates the credential linking did, as DomainLinkageValidator::validate_linkage. Only did is resolved.

§Errors

As fetch_configuration and validate_linkage.

Source

pub async fn validate_document( &self, document: &DidDocument, options: &CredentialValidationOptions, ) -> Vec<LinkedDomainReport>

Validates the linkage of the DID of document to every origin of its LinkedDomains services: one report per origin in document order, and one for each invalid service entry. Origins past the first max_origins are not fetched and report DomainLinkageError::TooManyOrigins.

Source§

impl<C: HttpClient, V: JwsVerifier> DomainLinkageClient<C, Resolver, V>

Source

pub async fn validate_did( &self, did: &Did, options: &CredentialValidationOptions, ) -> Result<Vec<LinkedDomainReport>, DomainLinkageError>

Resolves did with the validator’s resolver, then validates its linkage to every origin its document lists, as validate_document.

§Errors

DomainLinkageError::Resolution when did does not resolve to a document.

Trait Implementations§

Source§

impl<C: Debug, R: Debug, V: Debug> Debug for DomainLinkageClient<C, R, V>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<C, R, V = DefaultVerifier> !RefUnwindSafe for DomainLinkageClient<C, R, V>

§

impl<C, R, V = DefaultVerifier> !UnwindSafe for DomainLinkageClient<C, R, V>

§

impl<C, R, V> Freeze for DomainLinkageClient<C, R, V>

§

impl<C, R, V> Send for DomainLinkageClient<C, R, V>
where C: Send, DomainLinkageValidator<R, V>: Send,

§

impl<C, R, V> Sync for DomainLinkageClient<C, R, V>
where C: Sync, DomainLinkageValidator<R, V>: Sync,

§

impl<C, R, V> Unpin for DomainLinkageClient<C, R, V>

§

impl<C, R, V> UnsafeUnpin for DomainLinkageClient<C, R, V>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more