dpop_verifier/replay.rs
1use crate::DpopError;
2use async_trait::async_trait;
3
4#[derive(Debug, Clone)]
5pub struct ReplayContext<'a> {
6 pub jkt: Option<&'a str>,
7 pub htm: Option<&'a str>,
8 pub htu: Option<&'a str>,
9 pub client_id: Option<&'a str>,
10 pub iat: i64,
11}
12
13/// Implement this in your app for DB/Redis/etc.
14/// Return Ok(true) if this jti was inserted the first time; Ok(false) if already present (replay).
15#[async_trait]
16pub trait ReplayStore {
17 async fn insert_once(
18 &mut self,
19 jti_hash: [u8; 32],
20 ctx: ReplayContext<'_>,
21 ) -> Result<bool, DpopError>;
22}