pub struct KeyRotator { /* private fields */ }Expand description
Key rotation state
Implementations§
Source§impl KeyRotator
impl KeyRotator
Sourcepub fn new(config: KeyRotationConfig) -> Result<Self>
pub fn new(config: KeyRotationConfig) -> Result<Self>
Create new key rotator
Sourcepub fn needs_rotation(&self) -> bool
pub fn needs_rotation(&self) -> bool
Check if rotation is needed
Sourcepub fn rotate_keys(&mut self) -> Result<KeyRotationEvent>
pub fn rotate_keys(&mut self) -> Result<KeyRotationEvent>
Perform key rotation
Sourcepub fn commit_rotation(&mut self)
pub fn commit_rotation(&mut self)
Commit rotation (after ACK received)
Sourcepub fn record_bytes(&mut self, bytes: u64)
pub fn record_bytes(&mut self, bytes: u64)
Record bytes transferred
Sourcepub fn current_public_key(&self) -> [u8; 32]
pub fn current_public_key(&self) -> [u8; 32]
Get current public key
Sourcepub fn next_public_key(&self) -> Option<[u8; 32]>
pub fn next_public_key(&self) -> Option<[u8; 32]>
Get next public key (if pre-generated)
Sourcepub fn create_rotation_message(&self) -> Option<ControlPayload>
pub fn create_rotation_message(&self) -> Option<ControlPayload>
Generate a CONTROL message for key rotation.
Returns None when no next key has been pre-generated yet — callers must
call rotate_keys() before this to avoid sending the current key as “new”,
which would silently produce a no-op rotation on the peer.
Sourcepub fn stats(&self) -> KeyRotationStats
pub fn stats(&self) -> KeyRotationStats
Get rotation statistics
Trait Implementations§
Auto Trait Implementations§
impl Freeze for KeyRotator
impl RefUnwindSafe for KeyRotator
impl Send for KeyRotator
impl Sync for KeyRotator
impl Unpin for KeyRotator
impl UnsafeUnpin for KeyRotator
impl UnwindSafe for KeyRotator
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