aboutsummaryrefslogtreecommitdiff
path: root/libnitrokey
Commit message (Collapse)AuthorAge
* Return firmware version parts as uint8_t instead of intfix/get-firmware-versionRobin Krahl2019-01-17
| | | | | | | | The firmware version parts returned by the Nitrokey devices are uint8_t values. This is part of the public API as part of the NK_storage_status struct. For consistency with this API, this patch changes the functions NK_get_major_firmware_version and NK_get_minor_firmware_version to return uint8_t instead of int.
* Change std::wstring to std::string in DeviceInfoRobin Krahl2019-01-13
| | | | | | | For easier handling, we should use a std::string instead of std::wstring for the serial number in DeviceInfo. For the conversion, I assume that the serial number is valid UTF-8. As it should be alphanumeric and ASCII only, this should be true.
* Implement operator<< for DeviceModelRobin Krahl2019-01-13
|
* Add Device::create static methodRobin Krahl2019-01-13
| | | | | The method makes it easier to create a std::shared_ptr<Device> from a model enum instance.
* Make Device::enumerate staticRobin Krahl2019-01-13
| | | | | | | | | | | Device::enumerate does not need any instance data, therefore it is made static. Note that this not only changes the public API by making the method static. We also return all connected Nitrokey devices instead of only Storage devices. The NitrokeyManager method list_devices_by_cpuID is changed to check the device type so that they still only return Storage devices. The list_device method now returns both Storage and Pro devices.
* Add product_id_to_model functionRobin Krahl2019-01-13
|
* Add misc::Option<T> classRobin Krahl2019-01-13
| | | | | Option<T> is a simple replacement for std::optional, which was introduced in C++17. It stores a value that can be present or absent.
* Extract vendor and product IDs into constantsRobin Krahl2019-01-13
|
* Change Nitrokey::list_devices return type to use DeviceInfoRobin Krahl2019-01-13
| | | | | | In the previous commit, we changed the return value of Device::enumerate to std::vector<DeviceInfo>. Now we change Nitrokey::list_devices to also return DeviceInfo instances.
* Change Device::enumerate return type to use DeviceInfoRobin Krahl2019-01-13
| | | | | | The return type of Device::enumerate is changed from std::vector<std::string> to std::vector<DeviceInfo> to expose the additional information contained in the DeviceInfo struct.
* Add DeviceInfo struct for enumerationRobin Krahl2019-01-13
| | | | | | This is a preparation for a future patch that will change the enumerate method to return a vector of DeviceInfo instances instead of a vector of strings.
* log: define default virtual destructor for LogHandlerIgor Gnatenko2018-07-18
| | | | | Fixes: https://github.com/Nitrokey/libnitrokey/issues/129 Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
* Add general DEPRECATED macro for marking deprecated functions.Szczepan Zalega2018-07-07
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Handle command for getting production dataSzczepan Zalega2018-06-28
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Handle WINK commandSzczepan Zalega2018-06-23
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Add "deprecated" tags to get_time and NK_totp_get_time functionsSzczepan Zalega2018-06-19
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Add set_time_soft to replace get_timeRobin Krahl2018-06-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | The SetTime command supports two modes: set the time without checking the currently set time, or verify that the currently set time is not zero and not larger than the new time (see cmd_set_time(uint8_t*, uint8_t*) in src/keyboard/report_protocol.c, lines 678--710, in the Nitrokey Pro firmware). NitrokeyManager called these two modes set_time(uint64_t) and get_time(uint64_t), which is highly misleading -- the command does never get the time. Furthermore, the get_time method per default calls the command with the time zero, which will always result in an error. The C API has the methods NK_totp_set_time(uint64_t) and NK_totp_get_time(). NK_totp_get_time() calls get_time(uint64_t) with the time zero, leading to an error, and is therefore useless. This patch proposes a new wording. While it would make sense to call the first mode “reset” and the second mode “set”, this would break compatibility. Therefore, new methods set_time_soft(uint64_t) and NK_totp_set_time_soft(uint64_t) are introduced to represent the difference between a hard and a soft setting of the time. The old methods, get_time(uint64_t) and NK_totp_get_time(), are not removed but marked as deprecated. They should be removed in an upcoming major release.
* Move implementation from header back to compilation unitSzczepan Zalega2018-06-19
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Add getters for the library versionRobin Krahl2018-05-25
| | | | | | | CMake generates version.h from version.h.in and sets the major and minor version as specified in CMakeLists.txt and the current git version as returned by `git describe --always`. These values are also added to the C API as NK_get{_major,_minor,}_library_version.
* Change const char* to char* for functions returning duplicated strings.Szczepan Zalega2018-04-19
| | | | | | | All functions returning duplicated C-strings, which needs to be deallocated on caller side, are typed char* instead of const char* Issue #110 Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Merge branch '102-get_status_invalid'Szczepan Zalega2018-04-10
|\ | | | | | | Fixes #102
| * Name magic numbers in validation functionsSzczepan Zalega2018-04-10
| | | | | | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
| * Correct validation functions for GetStatus and WriteGeneralConfig structsSzczepan Zalega2018-04-10
| | | | | | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* | Add a NitrokeyManager::connect overload for enumRobin Krahl2018-04-10
|/ | | | | | | Identifying the model to connect to by the first character of a string is not intuitive. This patch adds an overload for the connect function that accepts a device::DeviceModel enum value, providing a cleaner interface.
* Make unbundling easierDavid Seifert2018-03-13