pub fn generate_token(n_bytes: usize) -> StringAvailable on crate feature
crypto only.Expand description
Generate n_bytes of cryptographically secure random bytes and return them
as a lowercase hex string of length n_bytes * 2.
Suitable for password-reset tokens, email verification codes, and API keys. Use at least 16 bytes (32 hex chars) for tokens; 32 bytes (64 hex chars) for high-value secrets like API keys.