pub trait TokenRng: CryptoRng {
// Required method
fn generate_token(&mut self) -> Result<String, Error>;
}Expand description
Used to generate CSRF tokens.
This trait is used to generate a token that can be used as a CSRF token. It
is implemented for all CSRNG (Cryptographically Secure RNG) types. This
should not be implemented directly; instead, implement CryptoRng and
RngCore instead.
Implementors of this trait should generate a token that’s difficult to guess and is safe to store as a cookie. For blanket implementations, this is 32 bytes of random data, encoded as base64 without padding.