Generate password on frontend instead

This commit is contained in:
Lncvrt committed 2026-02-18 00:33:33 -07:00
1 parent dff4b45adf
commit 3a1815aec3
3 files changed
+10 -18

No files matched your search

+1 -14
View File
@@ -1,20 +1,7 @@
use rand::RngExt;
#[tauri::command]
fn generate_password(length: u8) -> String {
let chars: Vec<char> = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"
.chars()
.collect();
let mut rng = rand::rng();
(0..length)
.map(|_| chars[rng.random_range(0..chars.len())])
.collect()
}
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![generate_password])
.invoke_handler(tauri::generate_handler![])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}