Initial commit
This commit is contained in:
commit
8d675c9799
96 files changed
+7244
No files matched your search
@@ -0,0 +1,21 @@
|
||||
use rand::Rng;
|
||||
|
||||
#[tauri::command]
|
||||
fn generate_password(length: u8) -> String {
|
||||
let chars: Vec<char> = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"
|
||||
.chars()
|
||||
.collect();
|
||||
let mut rng = rand::thread_rng();
|
||||
(0..length)
|
||||
.map(|_| chars[rng.gen_range(0..chars.len())])
|
||||
.collect()
|
||||
}
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_opener::init())
|
||||
.invoke_handler(tauri::generate_handler![generate_password])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
fn main() {
|
||||
password_generator_lib::run()
|
||||
}
|
||||
Reference in new issue
Block a user