pub struct JsonWebToken<P> { /* private fields */ }Expand description
JWT codec backed by the jsonwebtoken crate.
This is the main codec implementation provided by the crate.
§Key management
The default constructor uses built-in ES384 development keys. This is convenient for tests or local development.
For persistent sessions across restarts or multiple instances, construct the
codec with explicit keys via JsonWebToken::new_with_options.
Implementations§
Source§impl<P> JsonWebToken<P>
impl<P> JsonWebToken<P>
Sourcepub fn new_with_options(options: JsonWebTokenOptions) -> Self
pub fn new_with_options(options: JsonWebTokenOptions) -> Self
Creates a codec from explicit options.
Use this when you need explicit signing or verification configuration.
Sourcepub fn verification_key_count(&self) -> usize
pub fn verification_key_count(&self) -> usize
Returns the number of currently configured verification keys.
Sourcepub fn has_verification_key(&self, kid: &str) -> bool
pub fn has_verification_key(&self, kid: &str) -> bool
Returns whether a verification key for the given kid exists.
Sourcepub fn allows_missing_kid_fallback(&self) -> bool
pub fn allows_missing_kid_fallback(&self) -> bool
Returns whether this codec allows verification without kid.
Sourcepub fn replace_verification_keys(
&self,
keys: HashMap<String, DecodingKey>,
allow_missing_kid_fallback: bool,
)
pub fn replace_verification_keys( &self, keys: HashMap<String, DecodingKey>, allow_missing_kid_fallback: bool, )
Atomically replaces all verification keys.
Trait Implementations§
Source§impl<P: Clone> Clone for JsonWebToken<P>
impl<P: Clone> Clone for JsonWebToken<P>
Source§fn clone(&self) -> JsonWebToken<P>
fn clone(&self) -> JsonWebToken<P>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<P> Freeze for JsonWebToken<P>
impl<P> RefUnwindSafe for JsonWebToken<P>where
P: RefUnwindSafe,
impl<P> Send for JsonWebToken<P>where
P: Send,
impl<P> Sync for JsonWebToken<P>where
P: Sync,
impl<P> Unpin for JsonWebToken<P>where
P: Unpin,
impl<P> UnsafeUnpin for JsonWebToken<P>
impl<P> UnwindSafe for JsonWebToken<P>where
P: 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