summaryrefslogtreecommitdiff
path: root/tests/otp.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/otp.rs')
-rw-r--r--tests/otp.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/otp.rs b/tests/otp.rs
index 8ca8311..d55d54a 100644
--- a/tests/otp.rs
+++ b/tests/otp.rs
@@ -7,12 +7,10 @@ use std::ops::DerefMut;
use nitrokey::{
Admin, Authenticate, CommandError, Config, ConfigureOtp, Device, GenerateOtp, LibraryError,
- OtpMode, OtpSlotData,
+ OtpMode, OtpSlotData, DEFAULT_ADMIN_PIN, DEFAULT_USER_PIN,
};
use nitrokey_test::test as test_device;
-use crate::util::{ADMIN_PASSWORD, USER_PASSWORD};
-
// test suite according to RFC 4226, Appendix D
static HOTP_SECRET: &str = "3132333435363738393031323334353637383930";
static HOTP_CODES: &[&str] = &[
@@ -41,7 +39,7 @@ fn make_admin_test_device<'a, T>(device: &'a mut T) -> Admin<'a, T>
where
T: Device,
{
- unwrap_ok!(device.authenticate_admin(ADMIN_PASSWORD))
+ unwrap_ok!(device.authenticate_admin(DEFAULT_ADMIN_PIN))
}
fn configure_hotp(admin: &mut ConfigureOtp, counter: u8) {
@@ -91,7 +89,7 @@ fn hotp_pin(device: DeviceWrapper) {
assert_ok!((), admin.write_config(config));
configure_hotp(&mut admin, 0);
- let mut user = unwrap_ok!(device.authenticate_user(USER_PASSWORD));
+ let mut user = unwrap_ok!(device.authenticate_user(DEFAULT_USER_PIN));
check_hotp_codes(&mut user, 0);
assert_cmd_err!(CommandError::NotAuthorized, user.get_hotp_code(1));
@@ -219,7 +217,7 @@ fn totp_pin(device: DeviceWrapper) {
assert_ok!((), admin.write_config(config));
configure_totp(&mut admin, 1);
- let mut user = unwrap_ok!(device.authenticate_user(USER_PASSWORD));
+ let mut user = unwrap_ok!(device.authenticate_user(DEFAULT_USER_PIN));
check_totp_codes(&mut user, 1, TotpTimestampSize::U32);
assert_cmd_err!(CommandError::NotAuthorized, user.get_totp_code(1));
@@ -234,7 +232,7 @@ fn totp_pin_64(device: Pro) {
assert_ok!((), admin.write_config(config));
configure_totp(&mut admin, 1);
- let mut user = unwrap_ok!(admin.authenticate_user(USER_PASSWORD));
+ let mut user = unwrap_ok!(admin.authenticate_user(DEFAULT_USER_PIN));
check_totp_codes(&mut user, 1, TotpTimestampSize::U64);
assert_cmd_err!(CommandError::NotAuthorized, device.get_totp_code(1));