From 6a69bbf736966c493cead716026db92c5b44962a Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Thu, 27 Dec 2018 17:27:08 +0100 Subject: Implement the pws clear subcommand This patch implements the pws clear command which allows the user to clear a slot in the password safe. --- nitrocli/src/commands.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'nitrocli/src/commands.rs') 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::*; -- cgit v1.2.1