aboutsummaryrefslogtreecommitdiffstats
path: root/crates/turtle/src/atuin_common/utils.rs
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-06-12 01:54:21 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-06-12 01:54:21 +0200
commitbbdf38018b47328b5faa2cef635c37095045be72 (patch)
tree8983817d547551ae12508a8ae8731b622d990af4 /crates/turtle/src/atuin_common/utils.rs
parentfeat(server): Make user stuff stateless (diff)
downloadatuin-bbdf38018b47328b5faa2cef635c37095045be72.zip
feat(server): Really make users stateless (with tests)
This commit also remove another load of unneeded features.
Diffstat (limited to 'crates/turtle/src/atuin_common/utils.rs')
-rw-r--r--crates/turtle/src/atuin_common/utils.rs22
1 files changed, 0 insertions, 22 deletions
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<const N: usize>() -> [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<const N: usize>() -> String {
- let bytes = crypto_random_bytes::<N>();
-
- // 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()
}