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 JwtCodec
impl Move for JwtCodec
impl RefUnwindSafe for JwtCodec
impl Send for JwtCodec
impl Sync for JwtCodec
impl Unpin for JwtCodec
impl UnsafeUnpin for JwtCodec
impl UnwindSafe for JwtCodec
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