summaryrefslogtreecommitdiff
path: root/src/util.rs
Commit message (Collapse)AuthorAge
* Implement std::fmt::Display for CommandErrorRobin Krahl2018-06-07
| | | | | | The std::fmt::Display implementation provides a human-readable error message for a CommandError. It is intended to be used in error messages displayed to the user.
* Implement easier CString creationRobin Krahl2018-06-07
| | | | | | The new get_cstring method in util returns a Result<CString, CommandError>, so mast callers can just use the ? operator to unwrap the result instead of cumbersome unwrapping code.
* Use Result<(), CommandError> instead of CommandStatusRobin Krahl2018-06-07
| | | | | | 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 ?.
* Add rudimentary support for the Nitrokey StorageRobin Krahl2018-05-29
| | | | | This patch adds the Storage struct and the test-storage feature. It also enables all currently supported Pro commands for the Storage.
* Rewrap documentation comments to 100 charactersRobin Krahl2018-05-28
|
* Improve log level documentationRobin Krahl2018-05-22
| | | | | | 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.
* Restructure code by functionalityRobin Krahl2018-05-22
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.