update library

This commit is contained in:
Mystikfluu 2023-01-13 22:35:17 +01:00
parent f3c0b89bdf
commit 3a80459b1c
4 changed files with 14 additions and 10 deletions

5
Cargo.lock generated
View File

@ -193,20 +193,19 @@ dependencies = [
[[package]]
name = "ip_lib"
version = "0.1.0"
version = "1.0.0"
dependencies = [
"aes-gcm",
"brotli",
"hex",
"home",
"rand",
"rpassword",
"sha2",
]
[[package]]
name = "ipass"
version = "0.4.1"
version = "0.4.2"
dependencies = [
"ip_lib",
"rpassword",

View File

@ -1,6 +1,6 @@
[package]
name = "ipass"
version = "0.4.1"
version = "0.4.2"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

@ -1 +1 @@
Subproject commit 380ae204378be877fffb7ee7f9167748defc2156
Subproject commit d2c9adefdc4a7096ff7047f830807245291407fa

View File

@ -56,6 +56,11 @@ fn main() {
}
}
fn ask_for_pw() -> String {
let output = rpassword::prompt_password("Please enter the master password: ").unwrap();
return output.replace("\n", "").replace("\r","");
}
fn version_help(version: &str) {
let mut data = version.split(".");
print!("Major {} ", data.next().unwrap());
@ -176,7 +181,7 @@ fn add(args: &Vec<String>) {
}
println!("Adding password for {}",args[2]);
let succeeded: bool = ip_lib::create_entry(&args[2], pw);
let succeeded: bool = ip_lib::create_entry(&args[2], pw, ask_for_pw());
if !succeeded {
println!("You already have an entry with that name! Did you mean to use \"edit\"?");
return;
@ -194,7 +199,7 @@ fn get(args: &Vec<String>) {
let filepath = &(ip_lib::get_ipass_folder()+name+".ipass");
if std::path::Path::new(filepath).exists() {
println!("Getting entry");
let entry: String = ip_lib::get_entry(name);
let entry: String = ip_lib::get_entry(name, ask_for_pw());
let mut data = entry.split(";");
println!("Username: '{}' Password: '{}'",data.next().unwrap(),data.next().unwrap());
} else {
@ -218,7 +223,7 @@ fn changepw(args: &Vec<String>) {
output = args[3].clone();
}
ip_lib::edit_password(&args[2], output);
ip_lib::edit_password(&args[2], output, ask_for_pw());
println!("Changed Password of {}!", args[2]);
} else {
@ -241,7 +246,7 @@ fn changeuser(args: &Vec<String>) {
output = args[3].clone();
}
ip_lib::edit_username(&args[2], output);
ip_lib::edit_username(&args[2], output, ask_for_pw());
println!("Changed Username of {}!", args[2]);
} else {
@ -257,7 +262,7 @@ fn rename(args: &Vec<String>) {
}
let filepath = &(ip_lib::get_ipass_folder()+&args[2]+".ipass");
if std::path::Path::new(filepath).exists() {
ip_lib::rename(&args[2],&args[3]);
ip_lib::rename(&args[2],&args[3], ask_for_pw());
println!("Renamed {} to {}", args[2], args[3]);
} else {
println!("No such file");