| Commit message (Collapse) | Author | Age |
|
|
|
|
|
| |
The VolumeMode enum will be used when setting the access mode for the
unencrypted volume. It can also be used when refactoring the
VolumeStatus enum in a future release.
|
| |
|
|
|
|
|
|
|
| |
This patch adds the get_library_version function to the main library
module that queries and returns the libnitrokey version. As the version
fields are static values, we fetch them all at the same time and do not
provide getters for the individual fields.
|
|
|
|
|
|
| |
This patch adds the global connect_model function that can be used to
connect to a Nitrokey device of a given model. Contrary to Pro::connect
and Storage::connect, the model does not have to be set at compile time.
|
| |
|
|
|
|
|
| |
This patch adds the function Device::get_model that returns the model of
the connected Nitrokey stick.
|
|
|
|
|
|
| |
Newer Rust versions support integration tests in a top-level tests
directory. This patch refactors the existing unit tests into
integration tests.
|
|
|
|
|
|
|
| |
With Rust edition 2018, it is no longer necessary to declare
dependencies in the code using `extern crate`. Therefore, this patch
removes these declarations and replaces them with `use` declarations if
necessary.
|
|
|
|
|
|
| |
This patch changes use declarations for modules within this crate to use
the crate:: path qualifier. This will be mandatory in Rust edition
2018.
|
|
|
|
|
|
|
|
| |
This patch enables the following compiler warnings:
- missing_docs for public symbols without documentation
- rust_2018_compatibility for Rust edition 2018 support
- rust_2018_idioms for Rust edition 2018 support
- unused for different types of unused code
|
| |
|
|
|
|
|
| |
Most notably, for command errors, this will print a human-readable error
message instead of just the name of the enum.
|
|
|
|
|
|
| |
The Result enum is more idiomatic and easier to use than our custom
CommandStatus enum with the same structure. This is especially true for
the try operator ?.
|
| |
|
|
|
|
|
|
|
|
|
| |
A password safe (PWS) stores names, logins and passwords in slots. PWS
are supported both by the Nitrokey Pro and the Nitrokey Storage. They
are implemented as a struct wrapping a device as the device may not be
disconnected while the password safe is alive. The creation of a
password safe is handled by the GetPasswordSafe trait, implemented by
DeviceWrapper, Pro and Storage.
|
|
|
|
|
| |
This patch adds the Storage struct and the test-storage feature. It
also enables all currently supported Pro commands for the Storage.
|
| |
|
| |
|
|
|
|
|
|
|
| |
DeviceWrapper abstracts over the supported devices. It implements the
traits that are implemented by all supported devices. The previous
UnauthenticatedDevice is renamed to Pro to prepare Storage support.
connect_model is moved to Pro::connect.
|
| |
|
|
|
|
|
|
| |
Now, the documentation clearly states the purpose of each log level.
Also, the documentation for set_log_level is corrected: libnitrokey
always prints to stderr.
|
|
|
|
|
|
|
| |
Since libnitrokey v3.3, libnitrokey no long has debugging output enabled
per default. Therefore, a corresponding note can be removed from the
crate documentation and the set_debug calls can be removed from the
tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In future versions, we want to support not only the Nitrokey Pro, but
also the Nitrokey Storage. This requires a better code layout. This
patch introduces two main changes:
First, the OTP-specific methods are moved from the Device trait and the
AdminAuthenticatedDevice struct to the functionality-based traits
ConfigureOtp and GenerateOtp. This will hopefully make it easier to
integrate the Nitrokey Storage.
Secondly, the code is split into separate modules. These modules are
currently all private and re-exported in the lib module, but we can
consider making them public in the future.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Previously, the user had to explicitly call diconnect() to terminate the
connection to the Nitrokey. Now NK_logout() is called automatically
once the device is out of scope as UnauthenticatedDevice implements
Drop. AdminAuthenticatedDevice and UserAuthenticatedDevice do not have
to implement Drop, as it will be called recursively.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
While the Nitrokey device would generate a WrongSlot error, libnitrokey
catches these errors and raises an InvalidSlotException with error code
201. This patch matches this error code to CommandError::InvalidSlot,
corrects the documentation and adds test cases.
To be able to test a failing OTP generation command, we have to adapt
get_string_result to free the string only if successful. This is due to
the segfault issue in libnitrokey v3.3 (see todo list).
|
|
|
|
|
|
| |
NK_login used a string to identify the model to connect to. Since
libnitrokey v3.3, we can use NK_login_enum together with an enum value
as a more type-safe alternative.
|
|
|
|
| |
Since libnitrokey v3.3, we can also access the minor firmware version.
|
|
|
|
|
|
|
| |
Now libnitrokey v3.3 is compiled from source, fixing the problems with
older libnitrokey versions (freeing strings, firmware version getter).
Also, bindgen is no longer a build dependency. This makes the build
process a lot faster.
|
|
|