diff options
Diffstat (limited to 'nitrocli/src/commands.rs')
-rw-r--r-- | nitrocli/src/commands.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/nitrocli/src/commands.rs b/nitrocli/src/commands.rs index 8dc8c42..93e9bd3 100644 --- a/nitrocli/src/commands.rs +++ b/nitrocli/src/commands.rs @@ -322,6 +322,17 @@ pub fn otp_set( Ok(()) } +/// Clear an OTP slot. +pub fn otp_clear(slot: u8, algorithm: args::OtpAlgorithm) -> Result<()> { + let device = authenticate_admin(get_device()?)?; + match algorithm { + args::OtpAlgorithm::Hotp => device.erase_hotp_slot(slot), + args::OtpAlgorithm::Totp => device.erase_totp_slot(slot), + } + .map_err(|err| get_error("Could not clear OTP slot", &err))?; + Ok(()) +} + #[cfg(test)] mod tests { use super::*; |