Delete password easilyier

This commit is contained in:
Alex 2022-05-23 17:36:08 +02:00
parent cb9b64a184
commit 53881fdb21
Signed by: lx
GPG key ID: 0E496D15096376BE
2 changed files with 7 additions and 5 deletions

View file

@ -318,7 +318,6 @@ impl CryptoKeys {
} }
pub async fn delete_password( pub async fn delete_password(
&self,
storage: &StorageCredentials, storage: &StorageCredentials,
password: &str, password: &str,
allow_delete_all: bool, allow_delete_all: bool,

View file

@ -218,14 +218,17 @@ async fn main() -> Result<()> {
let existing_password = rpassword::prompt_password("Enter password to delete: ")?; let existing_password = rpassword::prompt_password("Enter password to delete: ")?;
let keys = CryptoKeys::open(&creds, &user_secrets, &existing_password).await?; let keys = match allow_delete_all {
keys.delete_password(&creds, &existing_password, allow_delete_all) true => Some(CryptoKeys::open(&creds, &user_secrets, &existing_password).await?),
.await?; false => None,
};
CryptoKeys::delete_password(&creds, &existing_password, allow_delete_all).await?;
println!(""); println!("");
println!("Password was deleted successfully."); println!("Password was deleted successfully.");
if allow_delete_all { if let Some(keys) = keys {
println!("As a reminder, here are your cryptographic keys:"); println!("As a reminder, here are your cryptographic keys:");
dump_keys(&keys); dump_keys(&keys);
} }