pub trait StatusCheck: Send + Sync {
// Required method
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;
}vc only.Expand description
Checks the status of a credential: fetches the status list, bitmap or registry an entry points to and reports whether the credential is still good.
One check serves both credential formats: the validators hand it every credentialStatus
entry of a VCDM credential as CredentialStatus::Vcdm and the status claim of a JWT
or SD-JWT credential as CredentialStatus::StatusClaim (feature status-list), so an
application implements status checking once. A check that does not understand an entry
reports StatusError::Unsupported, which the StatusPolicy decides about.
StatusListCheck of status_list (features status-list and did-web) checks the Token
Status List and reports every VCDM entry as unsupported.
§Examples
A check that knows only the Token Status List, and only the list it was given:
use chrono::{DateTime, Utc};
use identity_kit::vc::validation::{CredentialStatus, StatusCheck, StatusError};
struct Revoked;
#[async_trait::async_trait]
impl StatusCheck for Revoked {
async fn check(&self, status: CredentialStatus<'_>, _: DateTime<Utc>) -> Result<(), StatusError> {
match status {
#[cfg(feature = "status-list")]
CredentialStatus::StatusClaim(status) if status.status_list.is_some() => {
Err(StatusError::Invalid("revoked".to_owned()))
}
other => Err(StatusError::Unsupported(other.mechanism())),
}
}
}Required Methods§
Sourcefn 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,
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,
Checks status at the validation time now, against which a check judges what it
fetched (the expiry of a status list token, for instance).
§Errors
A StatusError: Unsupported for an entry or mechanism
the check does not know, Unavailable and the other
variants when the status could not be obtained or trusted,
Invalid when the credential is revoked
or suspended.
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: StatusCheck + ?Sized> StatusCheck for &T
impl<T: StatusCheck + ?Sized> StatusCheck for &T
Source§impl<T: StatusCheck + ?Sized> StatusCheck for Arc<T>
impl<T: StatusCheck + ?Sized> StatusCheck for Arc<T>
Source§impl<T: StatusCheck + ?Sized> StatusCheck for Box<T>
impl<T: StatusCheck + ?Sized> StatusCheck for Box<T>
Implementors§
impl<C: HttpClient, R: KeyResolver, V: JwsVerifier> StatusCheck for StatusListCheck<C, R, V>
status-list only.