Function portier::generate_nonce

source ·
pub async fn generate_nonce(
    rng: impl SecureRandom + Send + Sync + 'static
) -> String
Expand description

Returns 128-bits of secure random data in an URL-safe encoding.

This is a default implementation for use by Store::new_nonce to generate nonces (numbers used once). This function panics if the RNG fails.

The RNG is usually SystemRandom. Note that SystemRandom may perform lazy initialization, and it is therefore recommended to do a dummy SystemRandom::fill after creating. See SystemRandom::new for details.