pub struct Jwt<'a, T> { /* private fields */ }
Implementations§
source§impl<'a, T> Jwt<'a, T>
impl<'a, T> Jwt<'a, T>
sourcepub fn header(&self) -> &JsonWebSignatureHeader
pub fn header(&self) -> &JsonWebSignatureHeader
Get the JWT header
pub fn into_owned(self) -> Jwt<'static, T>
sourcepub fn verify<K, S>(&self, key: &K) -> Result<(), JwtVerificationError>where
K: Verifier<S>,
S: SignatureEncoding,
pub fn verify<K, S>(&self, key: &K) -> Result<(), JwtVerificationError>where
K: Verifier<S>,
S: SignatureEncoding,
Verify the signature of this JWT using the given key.
§Errors
Returns an error if the signature is invalid.
Verify the signature of this JWT using the given symmetric key.
§Errors
Returns an error if the signature is invalid or if the algorithm is not supported.
sourcepub fn verify_with_jwks(
&self,
jwks: &PublicJsonWebKeySet,
) -> Result<(), NoKeyWorked>
pub fn verify_with_jwks( &self, jwks: &PublicJsonWebKeySet, ) -> Result<(), NoKeyWorked>
Verify the signature of this JWT using the given JWKS.
§Errors
Returns an error if the signature is invalid, if no key matches the constraints, or if the algorithm is not supported.
sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Get the raw JWT string as an owned String
sourcepub fn into_parts(self) -> (JsonWebSignatureHeader, T)
pub fn into_parts(self) -> (JsonWebSignatureHeader, T)
Split the JWT into its parts (header and payload).
source§impl<T> Jwt<'static, T>
impl<T> Jwt<'static, T>
sourcepub fn sign<K, S>(
header: JsonWebSignatureHeader,
payload: T,
key: &K,
) -> Result<Self, JwtSignatureError>
pub fn sign<K, S>( header: JsonWebSignatureHeader, payload: T, key: &K, ) -> Result<Self, JwtSignatureError>
Sign the given payload with the given key.
§Errors
Returns an error if the payload could not be serialized or if the key could not sign the payload.
sourcepub fn sign_with_rng<R, K, S>(
rng: &mut R,
header: JsonWebSignatureHeader,
payload: T,
key: &K,
) -> Result<Self, JwtSignatureError>
pub fn sign_with_rng<R, K, S>( rng: &mut R, header: JsonWebSignatureHeader, payload: T, key: &K, ) -> Result<Self, JwtSignatureError>
Sign the given payload with the given key using the given RNG.
§Errors
Returns an error if the payload could not be serialized or if the key could not sign the payload.
Trait Implementations§
impl<'a, T: Eq> Eq for Jwt<'a, T>
impl<'a, T> StructuralPartialEq for Jwt<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for Jwt<'a, T>where
T: Freeze,
impl<'a, T> RefUnwindSafe for Jwt<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for Jwt<'a, T>where
T: Send,
impl<'a, T> Sync for Jwt<'a, T>where
T: Sync,
impl<'a, T> Unpin for Jwt<'a, T>where
T: Unpin,
impl<'a, T> UnwindSafe for Jwt<'a, T>where
T: 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more