summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/auth.rs2
-rw-r--r--src/device.rs2
-rw-r--r--src/lib.rs4
-rw-r--r--src/tests/device.rs2
-rw-r--r--src/tests/otp.rs7
-rw-r--r--src/tests/pws.rs2
6 files changed, 11 insertions, 8 deletions
diff --git a/src/auth.rs b/src/auth.rs
index 8d97063..6a0a71f 100644
--- a/src/auth.rs
+++ b/src/auth.rs
@@ -1,10 +1,10 @@
use config::{Config, RawConfig};
use device::{Device, DeviceWrapper, Pro, Storage};
use nitrokey_sys;
+use otp::{ConfigureOtp, GenerateOtp, OtpMode, OtpSlotData, RawOtpSlotData};
use std::ffi::CString;
use std::ops::Deref;
use std::os::raw::c_int;
-use otp::{ConfigureOtp, GenerateOtp, OtpMode, OtpSlotData, RawOtpSlotData};
use util::{generate_password, result_from_string, CommandError, CommandStatus};
static TEMPORARY_PASSWORD_LENGTH: usize = 25;
diff --git a/src/device.rs b/src/device.rs
index cd8a05a..73952cc 100644
--- a/src/device.rs
+++ b/src/device.rs
@@ -2,9 +2,9 @@ use auth::Authenticate;
use config::{Config, RawConfig};
use libc;
use nitrokey_sys;
-use std::ffi::CString;
use otp::GenerateOtp;
use pws::GetPasswordSafe;
+use std::ffi::CString;
use util::{get_last_error, result_from_string, CommandError, CommandStatus};
/// Available Nitrokey models.
diff --git a/src/lib.rs b/src/lib.rs
index b30e9ba..432ce4e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -93,13 +93,13 @@ mod config;
mod device;
mod otp;
mod pws;
-mod util;
#[cfg(test)]
mod tests;
+mod util;
+pub use auth::{Admin, Authenticate, User};
pub use config::Config;
pub use device::{connect, Device, DeviceWrapper, Pro, Storage};
-pub use auth::{Admin, Authenticate, User};
pub use otp::{ConfigureOtp, GenerateOtp, OtpMode, OtpSlotData};
pub use pws::{GetPasswordSafe, PasswordSafe, SLOT_COUNT};
pub use util::{CommandError, CommandStatus, LogLevel};
diff --git a/src/tests/device.rs b/src/tests/device.rs
index 80541d4..6c24025 100644
--- a/src/tests/device.rs
+++ b/src/tests/device.rs
@@ -1,6 +1,6 @@
use std::ffi::CStr;
-use {Authenticate, CommandError, CommandStatus, Config, Device};
use tests::util::{Target, ADMIN_PASSWORD, USER_PASSWORD};
+use {Authenticate, CommandError, CommandStatus, Config, Device};
static ADMIN_NEW_PASSWORD: &str = "1234567890";
static USER_NEW_PASSWORD: &str = "abcdefghij";
diff --git a/src/tests/otp.rs b/src/tests/otp.rs
index de3b646..44689be 100644
--- a/src/tests/otp.rs
+++ b/src/tests/otp.rs
@@ -1,7 +1,7 @@
use std::ops::Deref;
+use tests::util::{Target, ADMIN_PASSWORD, USER_PASSWORD};
use {Admin, Authenticate, CommandError, CommandStatus, Config, ConfigureOtp, GenerateOtp, OtpMode,
OtpSlotData};
-use tests::util::{Target, ADMIN_PASSWORD, USER_PASSWORD};
// test suite according to RFC 4226, Appendix D
static HOTP_SECRET: &str = "3132333435363738393031323334353637383930";
@@ -30,7 +30,10 @@ fn get_admin_test_device() -> Admin<Target> {
fn configure_hotp(admin: &ConfigureOtp, counter: u8) {
let slot_data = OtpSlotData::new(1, "test-hotp", HOTP_SECRET, OtpMode::SixDigits);
- assert_eq!(CommandStatus::Success, admin.write_hotp_slot(slot_data, counter.into()));
+ assert_eq!(
+ CommandStatus::Success,
+ admin.write_hotp_slot(slot_data, counter.into())
+ );
}
fn check_hotp_codes(device: &GenerateOtp, offset: u8) {
diff --git a/src/tests/pws.rs b/src/tests/pws.rs
index 5f5a325..f45a81a 100644
--- a/src/tests/pws.rs
+++ b/src/tests/pws.rs
@@ -1,6 +1,6 @@
-use util::{CommandError, CommandStatus};
use pws::{GetPasswordSafe, PasswordSafe, SLOT_COUNT};
use tests::util::{Target, ADMIN_PASSWORD, USER_PASSWORD};
+use util::{CommandError, CommandStatus};
fn get_pws() -> PasswordSafe<Target> {
Target::connect()