aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--TODO.md1
-rw-r--r--src/device/mod.rs4
-rw-r--r--src/device/storage.rs10
-rw-r--r--src/device/wrapper.rs2
-rw-r--r--tests/device.rs10
6 files changed, 14 insertions, 14 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a9ef359..b477c3b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,7 @@ SPDX-License-Identifier: CC0-1.0
- Add the `list_devices` function.
- Add the `connect_path` function to the `Manager` struct.
- Add the `get_status` function to the `Device` trait.
+- Rename `Status::get_status` to `get_storage_status`.
# v0.4.0 (2020-01-02)
- Remove the `test-pro` and `test-storage` features.
diff --git a/TODO.md b/TODO.md
index ed5a0ca..aaa6856 100644
--- a/TODO.md
+++ b/TODO.md
@@ -13,6 +13,5 @@ SPDX-License-Identifier: CC0-1.0
- Disable creation of multiple password safes at the same time.
- Check timing in Storage tests.
- Consider restructuring `device::StorageStatus`.
-- Consider renaming `Storage::get_status` (cf. `Device::get_status`).
[nitrokey-storage-firmware issue 65]: https://github.com/Nitrokey/nitrokey-storage-firmware/issues/65
diff --git a/src/device/mod.rs b/src/device/mod.rs
index 668c230..ef9f018 100644
--- a/src/device/mod.rs
+++ b/src/device/mod.rs
@@ -230,7 +230,7 @@ pub trait Device<'a>: Authenticate<'a> + GetPasswordSafe<'a> + GenerateOtp + fmt
///
/// This methods returns the status information common to all Nitrokey devices as a
/// [`Status`][] struct. Some models may provide more information, for example
- /// [`Storage::get_status`][] returns the [`StorageStatus`][] struct.
+ /// [`get_storage_status`][] returns the [`StorageStatus`][] struct.
///
/// # Errors
///
@@ -249,9 +249,9 @@ pub trait Device<'a>: Authenticate<'a> + GetPasswordSafe<'a> + GenerateOtp + fmt
/// # Ok::<(), nitrokey::Error>(())
/// ```
///
+ /// [`get_storage_status`]: struct.Storage.html#method.get_storage_status
/// [`NotConnected`]: enum.CommunicationError.html#variant.NotConnected
/// [`Status`]: struct.Status.html
- /// [`Storage::get_status`]: struct.Storage.html#method.get_status
/// [`StorageStatus`]: struct.StorageStatus.html
fn get_status(&self) -> Result<Status, Error>;
diff --git a/src/device/storage.rs b/src/device/storage.rs
index 64e6848..08ec4e9 100644
--- a/src/device/storage.rs
+++ b/src/device/storage.rs
@@ -525,7 +525,7 @@ impl<'a> Storage<'a> {
/// # fn try_main() -> Result<(), Error> {
/// let mut manager = nitrokey::take()?;
/// let device = manager.connect_storage()?;
- /// match device.get_status() {
+ /// match device.get_storage_status() {
/// Ok(status) => {
/// println!("SD card ID: {:#x}", status.serial_number_sd_card);
/// },
@@ -534,7 +534,7 @@ impl<'a> Storage<'a> {
/// # Ok(())
/// # }
/// ```
- pub fn get_status(&self) -> Result<StorageStatus, Error> {
+ pub fn get_storage_status(&self) -> Result<StorageStatus, Error> {
let mut raw_status = nitrokey_sys::NK_storage_status {
unencrypted_volume_read_only: false,
unencrypted_volume_active: false,
@@ -682,8 +682,8 @@ impl<'a> Device<'a> for Storage<'a> {
fn get_status(&self) -> Result<Status, Error> {
// Currently, the GET_STATUS command does not report the correct firmware version and
// serial number on the Nitrokey Storage, see [0]. Until this is fixed in libnitrokey, we
- // have to manually execute the GET_DEVICE_STATUS command (Storage::get_status) and
- // complete the missing data, see [1].
+ // have to manually execute the GET_DEVICE_STATUS command (get_storage_status) and complete
+ // the missing data, see [1].
// [0] https://github.com/Nitrokey/nitrokey-storage-firmware/issues/96
// [1] https://github.com/Nitrokey/libnitrokey/issues/166
@@ -699,7 +699,7 @@ impl<'a> Device<'a> for Storage<'a> {
get_command_result(unsafe { nitrokey_sys::NK_get_status(&mut raw_status) })?;
let mut status = Status::from(raw_status);
- let storage_status = Storage::get_status(&self)?;
+ let storage_status = self.get_storage_status()?;
status.firmware_version = storage_status.firmware_version;
status.serial_number = storage_status.serial_number_smart_card;
diff --git a/src/device/wrapper.rs b/src/device/wrapper.rs
index adbb695..69291ad 100644
--- a/src/device/wrapper.rs
+++ b/src/device/wrapper.rs
@@ -135,7 +135,7 @@ impl<'a> Device<'a> for DeviceWrapper<'a> {
fn get_status(&self) -> Result<Status, Error> {
match self {
DeviceWrapper::Pro(dev) => dev.get_status(),
- DeviceWrapper::Storage(dev) => Device::get_status(dev),
+ DeviceWrapper::Storage(dev) => dev.get_status(),
}
}
}
diff --git a/tests/device.rs b/tests/device.rs
index 92b79bd..f2a7031 100644
--- a/tests/device.rs
+++ b/tests/device.rs
@@ -564,7 +564,7 @@ fn set_encrypted_volume_mode(device: Storage) {
#[test_device]
fn set_unencrypted_volume_mode(device: Storage) {
fn assert_mode(device: &Storage, mode: VolumeMode) {
- let status = unwrap_ok!(device.get_status());
+ let status = unwrap_ok!(device.get_storage_status());
assert_eq!(
status.unencrypted_volume.read_only,
mode == VolumeMode::ReadOnly
@@ -595,7 +595,7 @@ fn set_unencrypted_volume_mode(device: Storage) {
#[test_device]
fn get_storage_status(device: Storage) {
- let status = unwrap_ok!(device.get_status());
+ let status = unwrap_ok!(device.get_storage_status());
assert!(status.serial_number_sd_card > 0);
assert!(status.serial_number_smart_card > 0);
}
@@ -615,7 +615,7 @@ fn get_production_info(device: Storage) {
assert!(info.sd_card.oem != 0);
assert!(info.sd_card.manufacturer != 0);
- let status = unwrap_ok!(device.get_status());
+ let status = unwrap_ok!(device.get_storage_status());
assert_eq!(status.firmware_version, info.firmware_version);
assert_eq!(status.serial_number_sd_card, info.sd_card.serial_number);
}
@@ -630,12 +630,12 @@ fn clear_new_sd_card_warning(device: Storage) {
// We have to perform an SD card operation to reset the new_sd_card_found field
assert_ok!((), device.lock());
- let status = unwrap_ok!(device.get_status());
+ let status = unwrap_ok!(device.get_storage_status());
assert!(status.new_sd_card_found);
assert_ok!((), device.clear_new_sd_card_warning(DEFAULT_ADMIN_PIN));
- let status = unwrap_ok!(device.get_status());
+ let status = unwrap_ok!(device.get_storage_status());
assert!(!status.new_sd_card_found);
}