pub struct Token<H, C, S> { /* private fields */ }
Expand description
Representation of a structured JWT. Methods vary based on the signature
type S
.
Implementations§
source§impl<H, C> Token<H, C, Unsigned>
impl<H, C> Token<H, C, Unsigned>
sourcepub fn new(header: H, claims: C) -> Self
pub fn new(header: H, claims: C) -> Self
Create a new unsigned token, with mutable headers and claims.
pub fn header_mut(&mut self) -> &mut H
pub fn claims_mut(&mut self) -> &mut C
source§impl<'a, H: FromBase64, C: FromBase64> Token<H, C, Unverified<'a>>
impl<'a, H: FromBase64, C: FromBase64> Token<H, C, Unverified<'a>>
sourcepub fn parse_unverified(
token_str: &str,
) -> Result<Token<H, C, Unverified<'_>>, Error>
pub fn parse_unverified( token_str: &str, ) -> Result<Token<H, C, Unverified<'_>>, Error>
Not recommended. Parse the header and claims without checking the validity of the signature.
Trait Implementations§
source§impl<H, C> SignWithKey<Token<H, C, Signed>> for Token<H, C, Unsigned>
impl<H, C> SignWithKey<Token<H, C, Signed>> for Token<H, C, Unsigned>
fn sign_with_key( self, key: &impl SigningAlgorithm, ) -> Result<Token<H, C, Signed>, Error>
source§impl<H, C> SignWithStore<Token<H, C, Signed>> for Token<H, C, Unsigned>
impl<H, C> SignWithStore<Token<H, C, Signed>> for Token<H, C, Unsigned>
fn sign_with_store<S, A>(self, store: &S) -> Result<Token<H, C, Signed>, Error>where
S: Store<Algorithm = A>,
A: SigningAlgorithm,
source§impl<'a, H, C> VerifyWithKey<Token<H, C, Verified>> for &'a str
impl<'a, H, C> VerifyWithKey<Token<H, C, Verified>> for &'a str
fn verify_with_key( self, key: &impl VerifyingAlgorithm, ) -> Result<Token<H, C, Verified>, Error>
source§impl<'a, H: JoseHeader, C> VerifyWithKey<Token<H, C, Verified>> for Token<H, C, Unverified<'a>>
impl<'a, H: JoseHeader, C> VerifyWithKey<Token<H, C, Verified>> for Token<H, C, Unverified<'a>>
fn verify_with_key( self, key: &impl VerifyingAlgorithm, ) -> Result<Token<H, C, Verified>, Error>
source§impl<'a, H, C> VerifyWithStore<Token<H, C, Verified>> for &'a str
impl<'a, H, C> VerifyWithStore<Token<H, C, Verified>> for &'a str
fn verify_with_store<S, A>(
self,
store: &S,
) -> Result<Token<H, C, Verified>, Error>where
S: Store<Algorithm = A>,
A: VerifyingAlgorithm,
source§impl<'a, H: JoseHeader, C> VerifyWithStore<Token<H, C, Verified>> for Token<H, C, Unverified<'a>>
impl<'a, H: JoseHeader, C> VerifyWithStore<Token<H, C, Verified>> for Token<H, C, Unverified<'a>>
fn verify_with_store<S, A>(
self,
store: &S,
) -> Result<Token<H, C, Verified>, Error>where
S: Store<Algorithm = A>,
A: VerifyingAlgorithm,
Auto Trait Implementations§
impl<H, C, S> Freeze for Token<H, C, S>
impl<H, C, S> RefUnwindSafe for Token<H, C, S>
impl<H, C, S> Send for Token<H, C, S>
impl<H, C, S> Sync for Token<H, C, S>
impl<H, C, S> Unpin for Token<H, C, S>
impl<H, C, S> UnwindSafe for Token<H, C, S>
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