pub struct ReplayWindow { /* private fields */ }Available on crate feature
crypto only.Expand description
Anti-replay sliding window.
Per 1-SECURITY.md:
- Window size: 2048 bits minimum
- Below window: MUST reject
- Seen nonce: MUST reject
- Above highest: Update window
Implementations§
Source§impl ReplayWindow
impl ReplayWindow
Sourcepub fn check_and_update(&mut self, nonce: u64) -> Result<(), CryptoError>
pub fn check_and_update(&mut self, nonce: u64) -> Result<(), CryptoError>
Check if a nonce is a replay and update the window.
Returns Ok(()) if the nonce is valid (not seen before). Returns Err(ReplayDetected) if the nonce is a replay.
Per 1-SECURITY.md, replay check MUST occur BEFORE AEAD verification.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ReplayWindow
impl RefUnwindSafe for ReplayWindow
impl Send for ReplayWindow
impl Sync for ReplayWindow
impl Unpin for ReplayWindow
impl UnwindSafe for ReplayWindow
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