pub struct SessionToken(/* private fields */);Expand description
A session-scoped bearer token.
§Lifetime
One SessionToken is created per proxy-server invocation. It is printed
to stderr (informational) and embedded at generation time into every client
artifact produced for that session.
Implementations§
Source§impl SessionToken
impl SessionToken
Sourcepub fn generate() -> SessionToken
pub fn generate() -> SessionToken
Generate a new cryptographically random 64-character hex token.
Internally draws 32 random bytes from the OS RNG and hex-encodes them, yielding a string that is unique with overwhelming probability.
Sourcepub fn verify(&self, header: &str) -> bool
pub fn verify(&self, header: &str) -> bool
Verify an Authorization header value in constant time.
The header argument is the full header value, e.g.
"Bearer a3f7...". Returns true only when the header matches
"Bearer <self.value()>" exactly (case-sensitive on the prefix).
Uses XOR-fold over bytes to avoid early-exit timing leaks.
Trait Implementations§
Source§impl Clone for SessionToken
impl Clone for SessionToken
Source§fn clone(&self) -> SessionToken
fn clone(&self) -> SessionToken
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 Freeze for SessionToken
impl RefUnwindSafe for SessionToken
impl Send for SessionToken
impl Sync for SessionToken
impl Unpin for SessionToken
impl UnsafeUnpin for SessionToken
impl UnwindSafe for SessionToken
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