pub struct RefreshTokenHash { /* private fields */ }Expand description
Stable hashed representation of a refresh token suitable for persistence.
The hashing algorithm is intentionally abstracted away from this type so the sessions domain can depend on the hash value without committing to a particular implementation strategy here.
§Examples
use webgates_sessions::tokens::RefreshTokenHash;
let hash = RefreshTokenHash::new("abc123def456").unwrap();
assert_eq!(hash.as_str(), "abc123def456");
// Empty strings are rejected.
assert!(RefreshTokenHash::new("").is_err());Implementations§
Source§impl RefreshTokenHash
impl RefreshTokenHash
Sourcepub fn new(value: impl Into<String>) -> Result<Self, TokenError>
pub fn new(value: impl Into<String>) -> Result<Self, TokenError>
Creates a new hashed refresh-token wrapper.
§Errors
Returns TokenError::InvalidTokenMaterial when value is empty or
contains only whitespace.
Sourcepub fn into_inner(self) -> String
pub fn into_inner(self) -> String
Consumes the wrapper and returns the persisted hash representation.
Trait Implementations§
Source§impl Clone for RefreshTokenHash
impl Clone for RefreshTokenHash
Source§fn clone(&self) -> RefreshTokenHash
fn clone(&self) -> RefreshTokenHash
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 moreSource§impl Debug for RefreshTokenHash
impl Debug for RefreshTokenHash
Source§impl PartialEq for RefreshTokenHash
impl PartialEq for RefreshTokenHash
Source§fn eq(&self, other: &RefreshTokenHash) -> bool
fn eq(&self, other: &RefreshTokenHash) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for RefreshTokenHash
impl StructuralPartialEq for RefreshTokenHash
Auto Trait Implementations§
impl Freeze for RefreshTokenHash
impl RefUnwindSafe for RefreshTokenHash
impl Send for RefreshTokenHash
impl Sync for RefreshTokenHash
impl Unpin for RefreshTokenHash
impl UnsafeUnpin for RefreshTokenHash
impl UnwindSafe for RefreshTokenHash
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