Generate password on frontend instead
This commit is contained in:
3 files changed
+10
-18
No files matched your search
+1
-14
@@ -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");
|
||||
}
|
||||
Reference in new issue
Block a user