Skip to main content

random_token

Function random_token 

Source
pub fn random_token() -> String
Expand description

A fresh high-entropy token: [TOKEN_BYTES] random bytes, base64url-encoded without padding, which is 43 characters.

That encoding is not cosmetic. It is what RFC 8555 §8.1 requires of a challenge token and §6.5.1 of a Replay-Nonce, and it is header-safe and URL-safe everywhere else the value is carried.