| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
|
|
|
| |
libnitrokey’s NK_read_config function returns a pointer to an array that
has been allocated using new[]. We would have to delete this pointer
using delete[], but we only have access to free. Therefore this patch
modifies the Device::get_config function to call NK_get_status instead
of NK_read_config.
This also makes the code more safe as we get the data as a struct
instead of an array. It does not add much overhead as NK_read_config
also executes the GET_STATUS command on the Nitrokey device.
|
|
|
|
|
|
| |
This makes it easier to parse only the config part of the NK_status
struct and avoids code duplication in the upcoming get_config
refactoring.
|
|
|
|
|
|
| |
Previously, the RawConfig struct had a try_from function. As the
TryFrom trait has been stabilized with Rust 1.34.0, we can use it
instead.
|
|
|
|
|
|
|
| |
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/
|
|
|
|
|
|
|
| |
This includes:
- using idiomatic Rust
- limiting the scope of unsafe blocks
- simplifying code
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
This patch changes all public functions to return the Error enum instead
of the CommandError enum. This breaks the tests which will be fixed
with the next patch.
This patch also adds a placeholder variant Error::CommandError and a
placeholder enum CommandError to make the transition to a new
nitrokey-test version easier.
|
|
|
|
| |
This prepares the refactoring of util::CommandError into multiple enums.
|
|
|
|
|
|
| |
This patch changes use declarations for modules within this crate to use
the crate:: path qualifier. This will be mandatory in Rust edition
2018.
|
| |
|
|
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.
|