pub struct StatusListToken<S>(/* private fields */);Expand description
The cryptographically signed Status List in the JWT format.
More can be read here.
Implementations§
Source§impl StatusListToken<Signed>
impl StatusListToken<Signed>
Sourcepub fn new(
claims: StatusListTokenClaims,
kid: String,
key: &impl JwtSigner,
) -> Result<Self>
pub fn new( claims: StatusListTokenClaims, kid: String, key: &impl JwtSigner, ) -> Result<Self>
Creates a new SIGNED StatusListToken.
The arguments are as follows:
claims: claims of the Status List Token,kid: an ID of the private key used to sign the token,key: an implementation of the algorithm used to sign the token with the specific private key.
§Errors
If the signature fails to compute, the Error::TokenSigningFailed
will be returned.
Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Returns the StatusListToken token as a &str.
Source§impl StatusListToken<Verified>
impl StatusListToken<Verified>
Sourcepub fn verify(
token: &str,
verifier: &(impl JwtVerifier + ?Sized),
public_key: &JwkPublic,
current_time: u64,
iss: &Uri,
sub: &Uri,
) -> Result<Self>
pub fn verify( token: &str, verifier: &(impl JwtVerifier + ?Sized), public_key: &JwkPublic, current_time: u64, iss: &Uri, sub: &Uri, ) -> Result<Self>
Verifies a signed Status List Token.
It verifies the signature of the JWT token and also its claims.
The arguments are as follows:
token: the String representation of the JWT token,verifier: the verifier of the token signature,current_time: the current time in seconds, elapsed since the UNIX epoch,iss: theissclaim from the Verifiable Credential itself,sub: theuriclaim from thestatusclaim of the Verifiable Credential.
§Errors
The function can result in the following errors:
Error::TokenParsingFailedif it is unable to parse the JWT token,Error::TokenSignatureVerificationFailedif the signature of the JWT token is invalid,Error::InvalidTokenHeaderTypif thetypclaim in the header is not set tostatuslist+jwt,Error::InvalidTokenIssif theissclaim is not equal to the providedissvalue,Error::InvalidTokenSubif thesubclaim is not equal to the providedsubvalue,Error::TokenExpiredif the token is expired based on theexpclaim.
Sourcepub fn header(&self) -> &StatusListTokenHeader
pub fn header(&self) -> &StatusListTokenHeader
Returns the token header.
Sourcepub fn claims(&self) -> &StatusListTokenClaims
pub fn claims(&self) -> &StatusListTokenClaims
Returns the token claims.
Trait Implementations§
Source§impl Display for StatusListToken<Signed>
impl Display for StatusListToken<Signed>
Source§impl From<StatusListToken<Verified>> for (StatusListTokenHeader, StatusListTokenClaims)
impl From<StatusListToken<Verified>> for (StatusListTokenHeader, StatusListTokenClaims)
Source§fn from(token: StatusListToken<Verified>) -> Self
fn from(token: StatusListToken<Verified>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<S> Freeze for StatusListToken<S>where
S: Freeze,
impl<S> RefUnwindSafe for StatusListToken<S>where
S: RefUnwindSafe,
impl<S> Send for StatusListToken<S>where
S: Send,
impl<S> Sync for StatusListToken<S>where
S: Sync,
impl<S> Unpin for StatusListToken<S>where
S: Unpin,
impl<S> UnwindSafe for StatusListToken<S>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more