use rand::distr::{Alphanumeric, SampleString as _};

use crate::storage::SessionKey;

pub fn generate_session_key() -> SessionKey {
    match Alphanumeric.sample_string(&mut rand::rng(), 64).try_into() {
        Ok(session_key) => session_key,
        Err(_error) => unreachable!(
            "64 alphanumeric characters are always a valid session key"
        ),
    }
}
