pub struct RekeyState { /* private fields */ }Available on crate feature
crypto only.Expand description
Tracks the current key epoch and when rekeying is needed.
Implementations§
Source§impl RekeyState
impl RekeyState
Sourcepub fn send_count(&self) -> u64
pub fn send_count(&self) -> u64
Get the send counter for the current epoch.
Sourcepub fn recv_count(&self) -> u64
pub fn recv_count(&self) -> u64
Get the receive counter for the current epoch.
Sourcepub fn increment_send(&mut self) -> Result<u64, CryptoError>
pub fn increment_send(&mut self) -> Result<u64, CryptoError>
Increment the send counter.
Returns the counter value to use for this message.
§Errors
Returns CounterExhaustion if the counter has reached the hard limit.
Sourcepub fn record_recv(&mut self, counter: u64)
pub fn record_recv(&mut self, counter: u64)
Record a received message counter.
Note: Actual replay detection is handled by the replay window.
Sourcepub fn should_rekey(&self) -> bool
pub fn should_rekey(&self) -> bool
Check if we should initiate a rekey (soft limit reached).
Sourcepub fn keys_expired(&self) -> bool
pub fn keys_expired(&self) -> bool
Check if the current keys are expired (hard limit reached).
Sourcepub fn advance_epoch(&mut self) -> Result<(), CryptoError>
pub fn advance_epoch(&mut self) -> Result<(), CryptoError>
Advance to the next epoch.
Resets counters and updates epoch start time.
§Errors
Returns EpochExhaustion if the epoch counter has reached the limit.
Trait Implementations§
Source§impl Debug for RekeyState
impl Debug for RekeyState
Auto Trait Implementations§
impl Freeze for RekeyState
impl RefUnwindSafe for RekeyState
impl Send for RekeyState
impl Sync for RekeyState
impl Unpin for RekeyState
impl UnwindSafe for RekeyState
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