pub fn urlsafe_base64(len: Option<i64>, padding: bool) -> Result<String, Error>Expand description
Generate a URL-safe base64-encoded String of random bytes.
If len is Some and non-negative, generate a vector of len random
bytes. If len is None, generate 16 random bytes. Take the resulting
bytes and base64 encode them.
§Examples
let bytes = spinoso_securerandom::urlsafe_base64(Some(1024), false)?;
assert_eq!(bytes.len(), 1366);
assert!(bytes.is_ascii());§Errors
If the given length is negative, return an ArgumentError.
If the underlying source of randomness returns an error, return a
RandomBytesError.