pub struct DomainLinkageClient<C, R, V = DefaultVerifier> { /* private fields */ }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>
impl<C, R, V> DomainLinkageClient<C, R, V>
Sourcepub const DEFAULT_MAX_ORIGINS: usize = 32
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>
impl<C: HttpClient, R: KeyResolver, V: JwsVerifier> DomainLinkageClient<C, R, V>
Sourcepub fn new(http: C, validator: DomainLinkageValidator<R, V>) -> Self
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.
Sourcepub fn with_max_origins(self, max_origins: usize) -> Self
pub fn with_max_origins(self, max_origins: usize) -> Self
This client fetching at most max_origins origins of a DID document.
Sourcepub fn max_origins(&self) -> usize
pub fn max_origins(&self) -> usize
The most origins validate_document fetches for one
document.
Sourcepub fn validator(&self) -> &DomainLinkageValidator<R, V>
pub fn validator(&self) -> &DomainLinkageValidator<R, V>
The validator.
Sourcepub async fn fetch_configuration(
&self,
origin: &Url,
) -> Result<DomainLinkageConfiguration, DomainLinkageError>
pub async fn fetch_configuration( &self, origin: &Url, ) -> Result<DomainLinkageConfiguration, DomainLinkageError>
Sourcepub async fn validate_origin(
&self,
origin: &Url,
options: &CredentialValidationOptions,
) -> Result<DomainLinkageReport, DomainLinkageError>
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
Sourcepub async fn validate_linkage(
&self,
did: &Did,
origin: &Url,
options: &CredentialValidationOptions,
) -> Result<DecodedCredential, DomainLinkageError>
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.
Sourcepub async fn validate_document(
&self,
document: &DidDocument,
options: &CredentialValidationOptions,
) -> Vec<LinkedDomainReport>
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>
impl<C: HttpClient, V: JwsVerifier> DomainLinkageClient<C, Resolver, V>
Sourcepub async fn validate_did(
&self,
did: &Did,
options: &CredentialValidationOptions,
) -> Result<Vec<LinkedDomainReport>, DomainLinkageError>
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.