diff options
Diffstat (limited to 'nitrocli/src/commands.rs')
-rw-r--r-- | nitrocli/src/commands.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/nitrocli/src/commands.rs b/nitrocli/src/commands.rs index ac2bbf1..c1942e8 100644 --- a/nitrocli/src/commands.rs +++ b/nitrocli/src/commands.rs @@ -450,7 +450,7 @@ fn prepare_secret(secret: &str) -> Result<String> { ) } else { Err(Error::Error( - "The given secret is not an ASCII string despite --ascii being set".to_string(), + "The given secret is not an ASCII string despite --format ascii being set".to_string(), )) } } @@ -462,12 +462,11 @@ pub fn otp_set( algorithm: args::OtpAlgorithm, counter: u64, time_window: u16, - ascii: bool, + secret_format: args::OtpSecretFormat, ) -> Result<()> { - let secret = if ascii { - prepare_secret(&data.secret)? - } else { - data.secret + let secret = match secret_format { + args::OtpSecretFormat::Ascii => prepare_secret(&data.secret)?, + args::OtpSecretFormat::Hex => data.secret, }; let data = nitrokey::OtpSlotData { secret, ..data }; let device = authenticate_admin(get_device(ctx)?)?; |