pub trait ChallengeStore {
// Required methods
fn issue(
&self,
session_context: &[u8],
ttl_seconds: i64,
) -> Result<(Vec<u8>, i64), String>;
fn validate(
&self,
challenge: &[u8],
session_context: &[u8],
now: i64,
) -> Result<(), String>;
fn consume(
&self,
challenge: &[u8],
session_context: &[u8],
now: i64,
) -> Result<(), String>;
}Expand description
Tracks verifier-issued challenges so each is accepted at most once within its freshness window (SPEC §10).
Required Methods§
Sourcefn issue(
&self,
session_context: &[u8],
ttl_seconds: i64,
) -> Result<(Vec<u8>, i64), String>
fn issue( &self, session_context: &[u8], ttl_seconds: i64, ) -> Result<(Vec<u8>, i64), String>
Generate a fresh challenge bound to session_context (which must
be empty or exactly 32 bytes; empty = unbound), valid for
ttl_seconds (which must be positive). Returns the challenge and
its expiry (unix seconds).
Sourcefn validate(
&self,
challenge: &[u8],
session_context: &[u8],
now: i64,
) -> Result<(), String>
fn validate( &self, challenge: &[u8], session_context: &[u8], now: i64, ) -> Result<(), String>
Report whether challenge could be consumed right now — issued,
unexpired, unconsumed, and bound to session_context — WITHOUT
consuming it. verify_bundle calls this before any signature work.
Sourcefn consume(
&self,
challenge: &[u8],
session_context: &[u8],
now: i64,
) -> Result<(), String>
fn consume( &self, challenge: &[u8], session_context: &[u8], now: i64, ) -> Result<(), String>
Atomically remove the challenge’s issuance record. Exactly one
consume of a given challenge may ever succeed; all later calls
(and calls with a mismatched session_context, which do NOT
remove the record) return an error. Removing the record keeps the
store’s capacity a count of PENDING challenges — a consumed
challenge frees its slot immediately.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".