pub struct TestJwt {
pub header: HashMap<String, String>,
pub payload: HashMap<String, Value>,
pub signature: String,
}Expand description
A test JWT-like structure for testing.
WARNING: This is NOT a real JWT implementation and should only be used for testing.
Fields§
§header: HashMap<String, String>Header claims.
payload: HashMap<String, Value>Payload claims.
signature: StringTest signature (not cryptographic).
Implementations§
Source§impl TestJwt
impl TestJwt
Sourcepub fn expires_in(self, seconds: u64) -> Self
pub fn expires_in(self, seconds: u64) -> Self
Sets the expiration time (seconds from now).
Sourcepub fn issued_now(self) -> Self
pub fn issued_now(self) -> Self
Sets the issued-at time to now.
Sourcepub fn encode(&self) -> String
pub fn encode(&self) -> String
Encodes the value as a JWT-like string (hex encoded for testing).
WARNING: This is NOT a real JWT - it uses simple hex encoding without proper signing. Use only for testing.
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Checks if the value is expired (based on exp claim).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TestJwt
impl RefUnwindSafe for TestJwt
impl Send for TestJwt
impl Sync for TestJwt
impl Unpin for TestJwt
impl UnwindSafe for TestJwt
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).