Skip to main content

StatusListCheck

Struct StatusListCheck 

Source
pub struct StatusListCheck<C, R, V = DefaultVerifier> { /* private fields */ }
Available on crate features did-web and status-list only.
Expand description

A StatusCheck for the Token Status List: for the status claim of an SD-JWT credential or of a JWT credential (CredentialStatus::StatusClaim), fetches the status list token from the referenced URI with an HttpClient, verifies it was signed by the key its header names (KeyReference::from_jws with the token’s iss), resolved for KeyRole::Issuer, and reads the status at the referenced index (Token Status List §8).

When the token has an iss, the key must belong to it (KeyReference::binds_to); without one, only a key named by a DID URL is accepted, since a key by value or a key set could be anybody’s. Beyond that the check trusts the key the reference resolves to; whether that key may speak for the list is the application’s policy to enforce around it, by restricting the resolver, say.

§Fetching

Every request asks for application/statuslist+jwt (StatusListToken::MEDIA_TYPE) through HttpClient::get_accepting. ReqwestClient (feature reqwest) also negotiates gzip, which the draft recommends Status Providers use.

A 301, 302, 303, 307 or 308 response is followed, as the draft recommends: its location is resolved against the URL that returned it and fetched with a new request through the same client, so that every hop passes the client’s checks. The check refuses a target that is not https, a URL already visited (a loop), a redirect without a Location, and more than MAX_REDIRECTS redirects.

The status list URI comes from the credential, and a redirect target from whoever serves it, so the client fetches whatever an issuer names: client must enforce the protections ReqwestClient does (HTTPS only, no redirects of its own, no non-public addresses after name resolution, a body limit and a timeout), or the status check becomes a request forgery primitive.

Implementations§

Source§

impl<C, R, V> StatusListCheck<C, R, V>

Source

pub const MAX_REDIRECTS: usize = 3

The most redirects one status list fetch follows.

Source§

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

Source

pub fn new(client: C, resolver: R, verifier: V) -> Self

A check fetching with client, resolving the status issuer’s key with resolver and verifying with verifier.

Trait Implementations§

Source§

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

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<C: HttpClient, R: KeyResolver, V: JwsVerifier> StatusCheck for StatusListCheck<C, R, V>

Source§

fn check<'life0, 'life1, 'async_trait>( &'life0 self, status: CredentialStatus<'life1>, now: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<(), StatusError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Available on crate feature vc only.

Checks the Token Status List reference of a status claim; a credentialStatus entry, or a status claim without one, is StatusError::Unsupported.

Auto Trait Implementations§

§

impl<C, R, V> Freeze for StatusListCheck<C, R, V>
where C: Freeze, R: Freeze, V: Freeze,

§

impl<C, R, V> RefUnwindSafe for StatusListCheck<C, R, V>

§

impl<C, R, V> Send for StatusListCheck<C, R, V>
where C: Send, R: Send, V: Send,

§

impl<C, R, V> Sync for StatusListCheck<C, R, V>
where C: Sync, R: Sync, V: Sync,

§

impl<C, R, V> Unpin for StatusListCheck<C, R, V>
where C: Unpin, R: Unpin, V: Unpin,

§

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

§

impl<C, R, V> UnwindSafe for StatusListCheck<C, R, V>
where C: UnwindSafe, R: UnwindSafe, V: UnwindSafe,

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