tsk-71: Added expiration check in LoginResult

This commit is contained in:
2025-10-18 22:05:54 -04:00
parent 194cd9e622
commit 7f4adbdb9d

View File

@@ -28,4 +28,10 @@ impl LoginResult {
pub fn _to_json(&self) -> Result<String, serde_json::Error> {
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
}
}