feat: init

This commit is contained in:
zhenyi
2026-06-07 11:30:56 +08:00
commit 563381c1ca
361 changed files with 41327 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
pub mod captcha;
pub mod email;
pub mod login;
pub mod logout;
pub mod me;
pub mod register;
pub mod reset_pass;
pub mod rsa;
pub mod totp;
pub(crate) fn generate_token(prefix: &str) -> String {
let mut rng = rand::thread_rng();
use rand::Rng;
let chars: String = (0..64)
.map(|_| {
let idx = rng.gen_range(0..62);
const CHARSET: &[u8] =
b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
CHARSET[idx] as char
})
.collect();
format!("{}_{}", prefix, chars)
}
// constant_time_eq is provided by crate::service::util