prompt user for encryption passkey if not provided
This commit is contained in:
parent
e1f86d3750
commit
d3cdc309ed
1 changed files with 13 additions and 1 deletions
14
src/main.rs
14
src/main.rs
|
@ -192,7 +192,9 @@ fn main() {
|
|||
accountmanager::ManifestAccountLoadError::MissingPasskey
|
||||
| accountmanager::ManifestAccountLoadError::DecryptionFailed,
|
||||
) => {
|
||||
error!("Incorrect passkey");
|
||||
if passkey.is_some() {
|
||||
error!("Incorrect passkey");
|
||||
}
|
||||
passkey = rpassword::prompt_password_stdout("Enter encryption passkey: ").ok();
|
||||
}
|
||||
Err(e) => {
|
||||
|
@ -313,6 +315,16 @@ fn main() {
|
|||
manifest.save(&passkey).expect("Failed to save manifest.");
|
||||
return;
|
||||
} else if matches.is_present("encrypt") {
|
||||
if passkey.is_none() {
|
||||
loop {
|
||||
passkey = rpassword::prompt_password_stdout("Enter encryption passkey: ").ok();
|
||||
let passkey_confirm = rpassword::prompt_password_stdout("Confirm encryption passkey: ").ok();
|
||||
if passkey == passkey_confirm {
|
||||
break;
|
||||
}
|
||||
error!("Passkeys do not match, try again.");
|
||||
}
|
||||
}
|
||||
for entry in &mut manifest.entries {
|
||||
entry.encryption = Some(accountmanager::EntryEncryptionParams::generate());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue