add card expiry checks

This commit is contained in:
ppc
2026-01-05 21:32:38 +00:00
parent 4a7aea406a
commit a9d6d36eea
+9 -1
View File
@@ -1,5 +1,7 @@
use std::{sync::{Mutex, OnceLock}, time::{Duration, Instant}};
use tracing::debug;
use crate::utils::{parse_access_code, parse_idm_hex};
#[derive(Debug, Clone)]
@@ -52,7 +54,13 @@ impl CardPresenter {
}
}
guard.take()
let card = guard.take();
if let Some(ref stored_card) = card && stored_card.is_expired() {
debug!("Stored card has expired and will not be provided");
return None;
};
card
}
pub fn present_card(&self, access_code: &String, idm_hex: Option<&String>, validity: Duration) -> CardPresentResult {