web3-proxy/web3_proxy/src/users.rs

12 lines
231 B
Rust
Raw Normal View History

2022-08-05 22:22:23 +03:00
use rand::prelude::*;
use uuid::{Builder, Uuid};
pub fn new_api_key() -> Uuid {
// TODO: chacha20?
let mut rng = thread_rng();
let random_bytes = rng.gen();
Builder::from_random_bytes(random_bytes).into_uuid()
}