pub struct JwtCodec { /* private fields */ }Expand description
High-performance HS256 JWT signer and verifier with kid key-rotation support.
Implementations§
Source§impl JwtCodec
Inherent implementation of JwtCodec.
impl JwtCodec
Inherent implementation of JwtCodec.
Sourcepub fn with_default_kid<K>(self, kid: K) -> Self
pub fn with_default_kid<K>(self, kid: K) -> Self
Sourcepub fn with_leeway_secs(self, leeway_secs: u64) -> Self
pub fn with_leeway_secs(self, leeway_secs: u64) -> Self
Sourcepub fn with_required_issuer<S>(self, issuer: S) -> Self
pub fn with_required_issuer<S>(self, issuer: S) -> Self
Sourcepub fn with_required_audience<S>(self, audience: S) -> Self
pub fn with_required_audience<S>(self, audience: S) -> Self
Sourcepub fn encode(&self, claims: &JwtClaims) -> Result<String, AuthError>
pub fn encode(&self, claims: &JwtClaims) -> Result<String, AuthError>
Encodes and signs claims into a compact HS256 JWT (header.payload.signature).
§Arguments
&JwtClaims- Claims payload to sign.
§Returns
Result<String, AuthError>- Compact JWT string, orAuthError::InvalidCredentialson serialization failure.
Trait Implementations§
Auto Trait Implementations§
impl Forget for JwtCodec
impl Freeze for JwtCodecwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<fn() -> XxHash3_64>: Freeze,
PhantomData<(String, Vec<u8>)>: Freeze,
PhantomData<(String, HmacSha256Key)>: Freeze,
impl Move for JwtCodec
impl RefUnwindSafe for JwtCodec
impl Send for JwtCodec
impl Sync for JwtCodec
impl Unpin for JwtCodec
impl UnsafeUnpin for JwtCodecwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<fn() -> XxHash3_64>: UnsafeUnpin,
PhantomData<(String, Vec<u8>)>: UnsafeUnpin,
PhantomData<(String, HmacSha256Key)>: UnsafeUnpin,
impl UnwindSafe for JwtCodecwhere
RawVecInner: UnwindSafe,
HashMap<String, Vec<u8>, BuildHasherDefault<XxHash3_64>>: UnwindSafe,
HashMap<String, HmacSha256Key, BuildHasherDefault<XxHash3_64>>: UnwindSafe,
Blanket Implementations§
impl<T> AnySend for T
impl<T> AnySendClone for T
impl<T> AnySendSync for T
impl<T> AnySendSyncClone for T
impl<T> AnySync for T
impl<T> AnySyncClone for T
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