graph_core/crypto/
mod.rs

1mod pkce;
2
3pub use pkce::*;
4
5use base64::engine::general_purpose::URL_SAFE_NO_PAD;
6use base64::Engine;
7use ring::rand::SecureRandom;
8
9pub fn secure_random_32() -> String {
10    let mut buf = [0; 32];
11
12    let rng = ring::rand::SystemRandom::new();
13    rng.fill(&mut buf).expect("ring::error::Unspecified");
14
15    URL_SAFE_NO_PAD.encode(buf)
16}