Removed clipboard feature for now, was annoying
This commit is contained in:
parent
db1db91f44
commit
88ab79182c
3 changed files with 1 additions and 41 deletions
|
|
@ -4,7 +4,6 @@ version = "0.1.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
arboard = "3.6.1"
|
|
||||||
argon2 = { version = "0.5.3", features = ["std", "password-hash"] }
|
argon2 = { version = "0.5.3", features = ["std", "password-hash"] }
|
||||||
chacha20poly1305 = "0.10.1"
|
chacha20poly1305 = "0.10.1"
|
||||||
clap = { version = "4.5", features = ["derive"] }
|
clap = { version = "4.5", features = ["derive"] }
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,6 @@ pub enum Commands {
|
||||||
Delete(DeletePass),
|
Delete(DeletePass),
|
||||||
/// Lists the names of all created passwords
|
/// Lists the names of all created passwords
|
||||||
List,
|
List,
|
||||||
/// Internal use only: clears clipboard after delay
|
|
||||||
#[command(hide = true)]
|
|
||||||
CleanupClipboard { delay: u64 },
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Args)]
|
#[derive(Args)]
|
||||||
|
|
|
||||||
38
src/main.rs
38
src/main.rs
|
|
@ -10,14 +10,6 @@ use zeroize::Zeroize;
|
||||||
fn main() {
|
fn main() {
|
||||||
let cli: Cli = Cli::parse();
|
let cli: Cli = Cli::parse();
|
||||||
|
|
||||||
if let Commands::CleanupClipboard { delay } = cli.command {
|
|
||||||
std::thread::sleep(std::time::Duration::from_secs(delay));
|
|
||||||
if let Ok(mut cb) = arboard::Clipboard::new() {
|
|
||||||
let _ = cb.set_text("");
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let master_hash_path = "master.hash";
|
let master_hash_path = "master.hash";
|
||||||
let file_path = "passwords.enc";
|
let file_path = "passwords.enc";
|
||||||
let salt_path = "salt.bin";
|
let salt_path = "salt.bin";
|
||||||
|
|
@ -82,34 +74,7 @@ fn main() {
|
||||||
p2.zeroize();
|
p2.zeroize();
|
||||||
}
|
}
|
||||||
Commands::Get(args) => match passwords.get(&args.name) {
|
Commands::Get(args) => match passwords.get(&args.name) {
|
||||||
Some(pw) => {
|
Some(pw) => println!("Password for {} : {}", args.name, pw),
|
||||||
if args.copy {
|
|
||||||
match arboard::Clipboard::new() {
|
|
||||||
Ok(mut clipboard) => {
|
|
||||||
let mut temp_pw = pw.clone();
|
|
||||||
if clipboard.set_text(&temp_pw).is_ok() {
|
|
||||||
println!("Password for '{}' copied to clipboard!", args.name);
|
|
||||||
println!("Clipboard will be cleared in 15 seconds...");
|
|
||||||
temp_pw.zeroize();
|
|
||||||
|
|
||||||
let exe_path =
|
|
||||||
std::env::current_exe().expect("Failed to get exe path");
|
|
||||||
std::process::Command::new(exe_path)
|
|
||||||
.arg("cleanup-clipboard")
|
|
||||||
.arg("15")
|
|
||||||
.spawn()
|
|
||||||
.expect("Failed to start background cleanup");
|
|
||||||
} else {
|
|
||||||
temp_pw.zeroize();
|
|
||||||
println!("❌ Failed to copy to clipboard.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Err(_) => println!("❌ Failed to access clipboard."),
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
println!("Password for {} : {}", args.name, pw);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
None => println!("No password found for '{}'", args.name),
|
None => println!("No password found for '{}'", args.name),
|
||||||
},
|
},
|
||||||
Commands::Delete(args) => {
|
Commands::Delete(args) => {
|
||||||
|
|
@ -126,7 +91,6 @@ fn main() {
|
||||||
println!("-----------------------");
|
println!("-----------------------");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Commands::CleanupClipboard { .. } => {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
encryption_key.zeroize();
|
encryption_key.zeroize();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue