keyfork-shard: fixup user PIN prompt
This commit is contained in:
parent
726b62b3f4
commit
7f90e4ada4
|
@ -52,8 +52,8 @@ impl SmartcardManager {
|
||||||
std::io::stdin().read_line(&mut String::new()).map(|_| ())
|
std::io::stdin().read_line(&mut String::new()).map(|_| ())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Utility function to obtain a prompt from the command line.
|
/// Utility function to obtain a prompt response from the command line.
|
||||||
pub fn prompt_pin(&self, prompt: impl std::fmt::Display) -> std::io::Result<String> {
|
pub fn prompt_input(&self, prompt: impl std::fmt::Display) -> std::io::Result<String> {
|
||||||
eprint!("{prompt}: ");
|
eprint!("{prompt}: ");
|
||||||
let mut output = String::new();
|
let mut output = String::new();
|
||||||
std::io::stdin().read_line(&mut output)?;
|
std::io::stdin().read_line(&mut output)?;
|
||||||
|
@ -201,7 +201,7 @@ impl DecryptionHelper for &mut SmartcardManager {
|
||||||
.fingerprints()?
|
.fingerprints()?
|
||||||
.decryption()
|
.decryption()
|
||||||
.map(|fp| Fingerprint::from_bytes(fp.as_bytes()));
|
.map(|fp| Fingerprint::from_bytes(fp.as_bytes()));
|
||||||
let pin = self.prompt_pin("Please enter PIN to unlock card")?;
|
let pin = self.prompt_input("User PIN")?;
|
||||||
let mut user = transaction.to_user_card(pin.as_str().trim())?;
|
let mut user = transaction.to_user_card(pin.as_str().trim())?;
|
||||||
let mut decryptor =
|
let mut decryptor =
|
||||||
user.decryptor(&|| eprintln!("Touch confirmation needed for decryption"))?;
|
user.decryptor(&|| eprintln!("Touch confirmation needed for decryption"))?;
|
||||||
|
|
Loading…
Reference in New Issue