pub struct ReplayDefenseState {
pub domain: String,
pub signature: Option<String>,
pub nonce: Option<String>,
pub captured_at_epoch_ms: u64,
}Expand description
Per-session replay-defense state captured when the session was first bound.
The state is the frozen record the runner compares against
the freshly observed context on every reuse. It is fully
serialisable so the existing session snapshot path
(SessionSnapshot in
Browser T23) can persist and reload it across restarts.
§Example
use stygian_browser::replay_defense::ReplayDefenseState;
let captured = stygian_browser::freshness::unix_epoch_ms();
let state = ReplayDefenseState::with_fingerprint(
"example.com",
"sha256:abc",
Some("nonce-001"),
captured,
);
assert_eq!(state.domain, "example.com");
assert_eq!(state.signature.as_deref(), Some("sha256:abc"));
assert_eq!(state.nonce.as_deref(), Some("nonce-001"));Fields§
§domain: StringLower-cased host the state was bound to.
signature: Option<String>Fingerprint signature captured at session start.
nonce: Option<String>Session nonce issued at session start (when applicable).
captured_at_epoch_ms: u64Unix epoch milliseconds when the state was captured.
Implementations§
Source§impl ReplayDefenseState
impl ReplayDefenseState
Sourcepub fn new(
domain: &str,
signature: Option<&str>,
nonce: Option<&str>,
captured_at_epoch_ms: u64,
) -> Self
pub fn new( domain: &str, signature: Option<&str>, nonce: Option<&str>, captured_at_epoch_ms: u64, ) -> Self
Build a state record.
Trait Implementations§
Source§impl Clone for ReplayDefenseState
impl Clone for ReplayDefenseState
Source§fn clone(&self) -> ReplayDefenseState
fn clone(&self) -> ReplayDefenseState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ReplayDefenseState
impl Debug for ReplayDefenseState
Source§impl<'de> Deserialize<'de> for ReplayDefenseState
impl<'de> Deserialize<'de> for ReplayDefenseState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ReplayDefenseState
impl PartialEq for ReplayDefenseState
Source§impl Serialize for ReplayDefenseState
impl Serialize for ReplayDefenseState
impl Eq for ReplayDefenseState
impl StructuralPartialEq for ReplayDefenseState
Auto Trait Implementations§
impl Freeze for ReplayDefenseState
impl RefUnwindSafe for ReplayDefenseState
impl Send for ReplayDefenseState
impl Sync for ReplayDefenseState
impl Unpin for ReplayDefenseState
impl UnsafeUnpin for ReplayDefenseState
impl UnwindSafe for ReplayDefenseState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.