From 7f4adbdb9d90486326c05c096abb6b8531cd19b9 Mon Sep 17 00:00:00 2001 From: phoenix Date: Sat, 18 Oct 2025 22:05:54 -0400 Subject: [PATCH] tsk-71: Added expiration check in LoginResult --- src/login_result.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/login_result.rs b/src/login_result.rs index 670be51..563fd9e 100644 --- a/src/login_result.rs +++ b/src/login_result.rs @@ -28,4 +28,10 @@ impl LoginResult { pub fn _to_json(&self) -> Result { serde_json::to_string_pretty(&self) } + + pub fn token_expired(&self) -> bool { + let current_time = time::OffsetDateTime::now_utc(); + let expired = time::OffsetDateTime::from_unix_timestamp(self.expiration).unwrap(); + current_time > expired + } }