aboutsummaryrefslogtreecommitdiff
path: root/nitrokey/src/device/pro.rs
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2020-01-14 19:21:26 +0100
committerDaniel Mueller <deso@posteo.net>2020-01-15 12:08:15 -0800
commit1e07212370806f3ea4ff7a6f66e5716b60ab1f77 (patch)
treec562f40b9888b9daf62a9d9a42eeef8bfa35413f /nitrokey/src/device/pro.rs
parent5251aa2d1665ee12245d5d5fe09c1f207272978f (diff)
downloadnitrocli-1e07212370806f3ea4ff7a6f66e5716b60ab1f77.tar.gz
nitrocli-1e07212370806f3ea4ff7a6f66e5716b60ab1f77.tar.bz2
Bump nitrokey dependency to version 0.5.1
This change updates the version of the nitrokey crate that we use to 0.5.1. As part of that, it replaces occurrences of Storage::get_status with Storage::get_storage_status as the method has been renamed. Import subrepo nitrokey/:nitrokey at 817409140a8778215d2d65d614d3672166fff576
Diffstat (limited to 'nitrokey/src/device/pro.rs')
-rw-r--r--nitrokey/src/device/pro.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/nitrokey/src/device/pro.rs b/nitrokey/src/device/pro.rs
index a65345e..591b730 100644
--- a/nitrokey/src/device/pro.rs
+++ b/nitrokey/src/device/pro.rs
@@ -3,8 +3,10 @@
use nitrokey_sys;
-use crate::device::{Device, Model};
+use crate::device::{Device, Model, Status};
+use crate::error::Error;
use crate::otp::GenerateOtp;
+use crate::util::get_command_result;
/// A Nitrokey Pro device without user or admin authentication.
///
@@ -74,6 +76,20 @@ impl<'a> Device<'a> for Pro<'a> {
fn get_model(&self) -> Model {
Model::Pro
}
+
+ fn get_status(&self) -> Result<Status, Error> {
+ let mut raw_status = nitrokey_sys::NK_status {
+ firmware_version_major: 0,
+ firmware_version_minor: 0,
+ serial_number_smart_card: 0,
+ config_numlock: 0,
+ config_capslock: 0,
+ config_scrolllock: 0,
+ otp_user_password: false,
+ };
+ get_command_result(unsafe { nitrokey_sys::NK_get_status(&mut raw_status) })?;
+ Ok(raw_status.into())
+ }
}
impl<'a> GenerateOtp for Pro<'a> {}