pub struct Session {
pub id: String,
pub four_words: String,
pub display_name: String,
pub created_at: u64,
pub last_activity: u64,
pub expires_at: u64,
pub auth_method: AuthMethod,
}Expand description
Represents an authenticated session
Fields§
§id: String§four_words: String§display_name: String§created_at: u64§last_activity: u64§expires_at: u64§auth_method: AuthMethodImplementations§
Source§impl Session
impl Session
Sourcepub fn new(
four_words: String,
display_name: String,
timeout_seconds: u64,
) -> Self
pub fn new( four_words: String, display_name: String, timeout_seconds: u64, ) -> Self
Create a new session
Sourcepub fn new_password_only(
four_words: String,
display_name: String,
timeout_seconds: u64,
) -> Self
pub fn new_password_only( four_words: String, display_name: String, timeout_seconds: u64, ) -> Self
Create a password-only session (familiar device)
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if the session has expired
Sourcepub fn time_remaining(&self) -> Duration
pub fn time_remaining(&self) -> Duration
Get remaining time until expiration
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Session
impl<'de> Deserialize<'de> for Session
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<Session> for SessionInfo
impl From<Session> for SessionInfo
Auto Trait Implementations§
impl Freeze for Session
impl RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnwindSafe for Session
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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