diff options
author | Robin Krahl <robin.krahl@ireas.org> | 2018-12-30 18:39:31 +0100 |
---|---|---|
committer | Daniel Mueller <deso@posteo.net> | 2019-01-01 17:14:54 -0800 |
commit | fc4a8e12af694a40fe17bcebddd9e4617075400f (patch) | |
tree | 16d5be1bce14d26fafed93c89674948406d290eb /nitrocli/src/pinentry.rs | |
parent | 8a59f307a2e0b9fa398ac200da44d8e5725150a7 (diff) | |
download | nitrocli-fc4a8e12af694a40fe17bcebddd9e4617075400f.tar.gz nitrocli-fc4a8e12af694a40fe17bcebddd9e4617075400f.tar.bz2 |
Implement the pin unblock subcommand
This patch implements the pin unblock command that unblocks and resets
the user PIN. The name unblock is chosen over libnitrokey's unlock to
be consistent with the GnuPG terminology and to avoid confusion with the
unrelated lock command.
Diffstat (limited to 'nitrocli/src/pinentry.rs')
-rw-r--r-- | nitrocli/src/pinentry.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/nitrocli/src/pinentry.rs b/nitrocli/src/pinentry.rs index 90986be..33b5266 100644 --- a/nitrocli/src/pinentry.rs +++ b/nitrocli/src/pinentry.rs @@ -51,9 +51,13 @@ impl PinType { fn description(self, mode: Mode) -> &'static str { match self { PinType::Admin => match mode { + Mode::Choose => "Please enter a new admin PIN", + Mode::Confirm => "Please confirm the new admin PIN", Mode::Query => "Please enter the admin PIN", }, PinType::User => match mode { + Mode::Choose => "Please enter a new user PIN", + Mode::Confirm => "Please confirm the new user PIN", Mode::Query => "Please enter the user PIN", }, } @@ -67,13 +71,17 @@ impl PinType { /// quality bar is shown. #[derive(Clone, Copy, Debug, PartialEq)] pub enum Mode { + /// Let the user choose a new PIN. + Choose, + /// Let the user confirm the previously chosen PIN. + Confirm, /// Query an existing PIN. Query, } impl Mode { fn show_quality_bar(self) -> bool { - false + self == Mode::Choose } } |