pub struct NonceTracker { /* private fields */ }Expand description
Tracks used nonces to prevent replay attacks.
Implementations§
Source§impl NonceTracker
impl NonceTracker
Sourcepub fn check_and_mark(&mut self, nonce: u64) -> bool
pub fn check_and_mark(&mut self, nonce: u64) -> bool
Checks if a nonce has been used and marks it as used.
Returns true if the nonce was new (valid), false if it was a replay.
Sourcepub const fn total_tracked(&self) -> u64
pub const fn total_tracked(&self) -> u64
Returns the total nonces ever tracked.
Trait Implementations§
Source§impl Debug for NonceTracker
impl Debug for NonceTracker
Auto Trait Implementations§
impl Freeze for NonceTracker
impl RefUnwindSafe for NonceTracker
impl Send for NonceTracker
impl Sync for NonceTracker
impl Unpin for NonceTracker
impl UnsafeUnpin for NonceTracker
impl UnwindSafe for NonceTracker
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