| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
| |
This patch adds license and copyright information to all files to make
nitrokey-rs compliant with the REUSE practices [0].
[0] https://reuse.software/practices/2.0/
|
|
|
|
|
|
|
|
|
|
| |
If possible, check specific error codes instead of `is_err()`. This
makes the code more readable and catches bugs resulting in the wrong
error code. Also, using the assert_*_err and assert_ok macros yields
error messages containing the expected and the actual value.
To be able to use these macros with the `get_password_safe` method, we
also have to implement `Debug` for `PasswordSafe` and `Device`.
|
|
|
|
|
|
| |
Previously, library errors were part of the CommandError enum. As
command errors and library errors are two different error types, they
should be split into two enums.
|
|
|
|
|
|
|
|
|
| |
These macros allow easier comparisions using the new error type. This
patch fixes all tests and updates nitrokey-test to 0.2.0 so that it
integrates with the new error structure.
Some tests may still fail until CommunicationError::NotConnected is
actually returned.
|
| |
|
|
|
|
|
| |
Previously the totp_error test case in the otp test suite called hotp
methods. This patch fixes the test case by calling totp metods instead.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
We experienced various problems running the tests and while they may or
may not be caused by local setup issues, it is helpful to have more
information than just an indication that an assertion (true/false) was
violated.
To that end, this change adjusts some of the assert!(<func>().is_ok())
to compare against Ok(()) instead. This way, if the result is not the Ok
variant, the error code will get printed.
|
|
|
|
| |
This change adjusts the OTP tests to use the nitrokey-test crate.
|
|
|
|
|
|
|
|
| |
This patch adds the force argument to the set_time method in the
ConfigureOtp trait that allows the user to choose whether jumps to the
past are allowed when updating the time. It is implemented by using the
NK_totp_set_time_soft function. Previously, jumps where unconditionally
allowed.
|
| |
|
|
Newer Rust versions support integration tests in a top-level tests
directory. This patch refactors the existing unit tests into
integration tests.
|