This project is a simple password manager written for the command line interface (CLI) to help me learn Rust. It lets users securely store, manage, and retrieve passwords.
//store # of passwords user wishes to create
let passwords_to_create : u8;
//buffer for stdin
let mut buffer = String::new();
io::stdin().read_line(&mut buffer).expect("(-) Failed at reading stdin");
// menu_choice = match user_input.trim().parse() { Ok(n) => n, Err(_) => { println!("(-) Not a valid number"); continue;} };
//parse stidn
passwords_to_create = match buffer.trim().parse() { Ok(n) => n, Err(_) => {println!("(-) Not a valid number"); return;} };
for _i in 1..=passwords_to_create {
println!("Username/Url: ");
//create a buffer for username
let mut buffer = String::new();
io::stdin().read_line(&mut buffer).expect("(-) Failed at reading stdin");
let username = buffer.trim().to_string();
println!("\nPlease input a password: ");
let mut pass_buffer = String::new();
io::stdin().read_line(&mut pass_buffer).expect("(-) Failed at reading stdin");
let new_password = pass_buffer.trim().to_string();
//struct instance
let new_user_password = SessionPassword { where_from: username, password: new_password, };
store.push(new_user_password);
}
Function is already working.