keyfork-shard: fixup user PIN prompt

This commit is contained in:
Ryan Heywood 2023-11-04 12:19:53 -05:00
parent 726b62b3f4
commit 7f90e4ada4
Signed by: ryan
GPG Key ID: 8E401478A3FBEF72
1 changed files with 3 additions and 3 deletions

View File

@ -52,8 +52,8 @@ impl SmartcardManager {
std::io::stdin().read_line(&mut String::new()).map(|_| ())
}
/// Utility function to obtain a prompt from the command line.
pub fn prompt_pin(&self, prompt: impl std::fmt::Display) -> std::io::Result<String> {
/// Utility function to obtain a prompt response from the command line.
pub fn prompt_input(&self, prompt: impl std::fmt::Display) -> std::io::Result<String> {
eprint!("{prompt}: ");
let mut output = String::new();
std::io::stdin().read_line(&mut output)?;
@ -201,7 +201,7 @@ impl DecryptionHelper for &mut SmartcardManager {
.fingerprints()?
.decryption()
.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 decryptor =
user.decryptor(&|| eprintln!("Touch confirmation needed for decryption"))?;