aboutsummaryrefslogtreecommitdiff
path: root/nitrocli/src/commands.rs
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2018-12-27 17:27:08 +0100
committerDaniel Mueller <deso@posteo.net>2019-01-07 18:13:42 -0800
commit6a69bbf736966c493cead716026db92c5b44962a (patch)
tree1f77268f2e0abe04f18a5c29b0bf0afc35b8cafc /nitrocli/src/commands.rs
parent9b73d152a4e154ac24491b98b3c5736aaa57bc0e (diff)
downloadnitrocli-6a69bbf736966c493cead716026db92c5b44962a.tar.gz
nitrocli-6a69bbf736966c493cead716026db92c5b44962a.tar.bz2
Implement the pws clear subcommand
This patch implements the pws clear command which allows the user to clear a slot in the password safe.
Diffstat (limited to 'nitrocli/src/commands.rs')
-rw-r--r--nitrocli/src/commands.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/nitrocli/src/commands.rs b/nitrocli/src/commands.rs
index e1c88c8..4deb1a7 100644
--- a/nitrocli/src/commands.rs
+++ b/nitrocli/src/commands.rs
@@ -593,6 +593,15 @@ pub fn pws_set(slot: u8, name: &str, login: &str, password: &str) -> Result<()>
.map_err(|err| get_error("Could not write PWS slot", &err))
}
+/// Clear a PWS slot.
+pub fn pws_clear(slot: u8) -> Result<()> {
+ let device = get_device()?;
+ let pws = get_password_safe(&device)?;
+ pws
+ .erase_slot(slot)
+ .map_err(|err| get_error("Could not clear PWS slot", &err))
+}
+
#[cfg(test)]
mod tests {
use super::*;