aboutsummaryrefslogtreecommitdiff
path: root/nitrocli/src/commands.rs
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2018-12-31 18:10:40 +0000
committerDaniel Mueller <deso@posteo.net>2019-01-01 17:14:51 -0800
commit8a59f307a2e0b9fa398ac200da44d8e5725150a7 (patch)
tree2db6b6bab9373a90ac54161342b5f60e149af002 /nitrocli/src/commands.rs
parentabcaafee042c6f2036b822e6f1c6c2683a526d92 (diff)
downloadnitrocli-8a59f307a2e0b9fa398ac200da44d8e5725150a7.tar.gz
nitrocli-8a59f307a2e0b9fa398ac200da44d8e5725150a7.tar.bz2
Implement the pin command and rename clear to pin clear
We have functionality for changing the Nitrokey's user & admin PINs as well as for resetting the user PIN coming up. With the prospect of this new functionality arriving, it makes sense to introduce a new top-level command for the sole purpose of PIN management. This change introduces such a command, pin, and moves the existing clear command for clearing the PIN cache into it.
Diffstat (limited to 'nitrocli/src/commands.rs')
-rw-r--r--nitrocli/src/commands.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/nitrocli/src/commands.rs b/nitrocli/src/commands.rs
index 17c8c8c..7f25415 100644
--- a/nitrocli/src/commands.rs
+++ b/nitrocli/src/commands.rs
@@ -275,13 +275,6 @@ pub fn storage_status() -> Result<()> {
Ok(())
}
-/// Clear the PIN stored when opening the nitrokey's encrypted volume.
-pub fn clear() -> Result<()> {
- pinentry::clear_passphrase(pinentry::PinType::Admin)?;
- pinentry::clear_passphrase(pinentry::PinType::User)?;
- Ok(())
-}
-
/// Return a String representation of the given Option.
fn format_option<T: fmt::Display>(option: Option<T>) -> String {
match option {
@@ -474,6 +467,13 @@ pub fn otp_status(all: bool) -> Result<()> {
Ok(())
}
+/// Clear the PIN stored by various operations.
+pub fn pin_clear() -> Result<()> {
+ pinentry::clear_passphrase(pinentry::PinType::Admin)?;
+ pinentry::clear_passphrase(pinentry::PinType::User)?;
+ Ok(())
+}
+
#[cfg(test)]
mod tests {
use super::*;