From bbdf38018b47328b5faa2cef635c37095045be72 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Fri, 12 Jun 2026 01:54:21 +0200 Subject: feat(server): Really make users stateless (with tests) This commit also remove another load of unneeded features. --- crates/turtle/src/atuin_common/utils.rs | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'crates/turtle/src/atuin_common/utils.rs') diff --git a/crates/turtle/src/atuin_common/utils.rs b/crates/turtle/src/atuin_common/utils.rs index 09718241..ba0c8eb7 100644 --- a/crates/turtle/src/atuin_common/utils.rs +++ b/crates/turtle/src/atuin_common/utils.rs @@ -2,30 +2,8 @@ use std::borrow::Cow; use std::env; use std::path::{Path, PathBuf}; -use base64::prelude::{BASE64_URL_SAFE_NO_PAD, Engine}; -use getrandom::getrandom; use uuid::Uuid; -/// Generate N random bytes, using a cryptographically secure source -pub(crate) fn crypto_random_bytes() -> [u8; N] { - // rand say they are in principle safe for crypto purposes, but that it is perhaps a better - // idea to use getrandom for things such as passwords. - let mut ret = [0u8; N]; - - getrandom(&mut ret).expect("Failed to generate random bytes!"); - - ret -} - -/// Generate N random bytes using a cryptographically secure source, return encoded as a string -pub(crate) fn crypto_random_string() -> String { - let bytes = crypto_random_bytes::(); - - // We only use this to create a random string, and won't be reversing it to find the original - // data - no padding is OK there. It may be in URLs. - BASE64_URL_SAFE_NO_PAD.encode(bytes) -} - pub(crate) fn uuid_v7() -> Uuid { Uuid::now_v7() } -- cgit v1.3.1