pub struct SessionKeys {
pub sending_key: [u8; 32],
pub receiving_key: [u8; 32],
pub sending_nonce: AtomicU64,
pub created_at: u64,
pub messages_sent: AtomicU64,
}Expand description
Session keys derived from handshake
Fields§
§sending_key: [u8; 32]Key for sending
receiving_key: [u8; 32]Key for receiving
sending_nonce: AtomicU64Sending nonce counter
created_at: u64Time when keys were derived (uptime seconds)
messages_sent: AtomicU64Number of messages sent with these keys
Implementations§
Source§impl SessionKeys
impl SessionKeys
Sourcepub fn new(sending_key: [u8; 32], receiving_key: [u8; 32], now: u64) -> Self
pub fn new(sending_key: [u8; 32], receiving_key: [u8; 32], now: u64) -> Self
Create new session keys
Sourcepub fn needs_rekey(&self, now: u64) -> bool
pub fn needs_rekey(&self, now: u64) -> bool
Check if keys need rotation
Sourcepub fn next_nonce(&self) -> Result<u64, WireGuardError>
pub fn next_nonce(&self) -> Result<u64, WireGuardError>
Get and increment the sending nonce