pub fn generate_challenge() -> Vec<u8> ⓘExpand description
Generate random challenge bytes for authentication
Generates 32 bytes of cryptographically secure random data using
rand::rngs::OsRng for use in challenge-response authentication protocols.
The challenge serves as a nonce to prevent replay attacks during handshakes.
§Security
Uses OsRng which provides the highest quality randomness available on the
platform by interfacing directly with the operating system’s random number
generator (e.g., /dev/urandom on Unix systems, CryptGenRandom on Windows).
§Example
ⓘ
use eidetica::auth::crypto::generate_challenge;
let challenge = generate_challenge();
assert_eq!(challenge.len(), 32);