aboutsummaryrefslogtreecommitdiff
path: root/NK_C_API.h
Commit message (Collapse)AuthorAge
* Replace *out function parameter with return valueSzczepan Zalega2018-06-20
| | | | | | | Using return value instead of memory manipulation seem to be cleaner solution and less error prone due to avoiding pointer usage. Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Expose device model in C APIRobin Krahl2018-05-25
| | | | | | | | | The C++ API already provides access to the model of the connected device in NitrokeyManager::get_connected_device_model(). This patch also exposes this information in the C API by adding NK_get_device_model. As there might be no device connected, the function returns a boolean indicating the connection status and writes the model of the connected device to a pointer passed as an argument.
* 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>
* Return allocated string instead of pointer to a string literalSzczepan Zalega2018-04-19
| | | | | | Issue #110 Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Remove (Pro) marks from C API docsSzczepan Zalega2018-04-19
| | | | | | | These were to meant, that the sizes were confirmed for Pro and not for Storage, during library development. Storage has maintained the compatibility, hence there is no need for the mentioned marks. Issue #106 Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* C API docs - mention 320-bits secret for Pro v0.8Szczepan Zalega2018-04-19
| | | | | | Same for C-string requirements for fields and sizes Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Correct documentation for NK_write_{hotp,totp}_slotRobin Krahl2018-04-19
| | | | | | | While the actual secret is 20 bytes, the functions accept a hex string. That means that every byte of the secret is represented by two bytes (characters) in the hex string. So the argument secret for the functions NK_write_{hotp,totp}_slot is char[40], not char[20].
* Add missing `enum` specifier in the C APIRobin Krahl2018-04-10
| | | | | Contrary to C++, C requires the type `enum NK_device_model` instead of only `NK_device_model` when refering to the enum with that name.
* Merge branch '102-get_status_invalid'Szczepan Zalega2018-04-10
|\ | | | | | | Fixes #102
| * Correct C API documentationSzczepan Zalega2018-04-10
| | | | | | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* | Add NK_login_enum to the C APIRobin Krahl2018-04-10
|/ | | | | | | | As with the C++ API, identifying the model by the first character of a string is not intuitive. This patch adds the NK_login_enum function to the C API that accepts an enum value instead of a string. It also adds a new enum NK_device_model as device::DeviceModel is an enum class and therefore cannot be used in C.
* C API wrapper for NK_set_unencrypted_volume_rorw_pin_type_userSzczepan Zalega2018-03-09
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Add documentation for C API / multiple devicesSzczepan Zalega2018-03-01
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* List devices by unique SC:SD idSzczepan Zalega2018-02-28
| | | | | | | Add C API and tests Add mutexes Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Divide unencrypted volume ro/rw commands for backward compatibilitySzczepan Zalega2018-02-23
| | | | | | | | | | Unencrypted volume ro/rw: rename user_admin_pin -> admin_pin to be consistent with latest API. Update description. Document PIN requirements in C++ API Extract pin type function Add C API for separate unencrypted volume read write handling Use correct commands to set ro/rw mode of unencrypted volume Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Correct variable name for unencrypted ro/rw switchSzczepan Zalega2018-02-23
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* C API for Encrypted volume ro/rw switchSzczepan Zalega2018-02-23
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Correct getting minor and major from firmware versionSzczepan Zalega2018-02-23
| | | | | | | | | Add get_minor_firmware_version Correct get_major_firmware version (was returning minor instead) Name 3rd version field for test builds Use minor firmware version in tests Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Include stdbool.h in NK_C_API.hRobin Krahl2018-02-12
| | | | | | | NK_C_API.h uses the type bool although it is not defined in standard C. Since C99, the header stdbool.h provides this type, so this patch includes it in NK_C_API.h to make it valid C code. (Note that the API already required C99 for the "//"-style comments.)
* Add test for enabling firmware updateSzczepan Zalega2018-02-01
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Expose enabling firmware update in C APISzczepan Zalega2018-02-01
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Update license/copyright linesSzczepan Zalega2018-01-16
| | | | | | Remove redundant file Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Add DEBUG_L1 level and set it as default for Python testsSzczepan Zalega2017-10-10
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Export C API functionsSzczepan Zalega2017-07-03
| | | | Guard extern to only C++
* Fix includes in C_APISzczepan Zalega2017-04-26
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Return OTP codes as strings to make sure they are zero-filled properlySzczepan Zalega2017-04-03
| | | | | | | | | Adjust Python tests for new OTP codes return value Also remove manual 0-filling Fixes #57 Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Fix compilation warningsSzczepan Zalega2017-03-11
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Remove unnecessary extern keyword from C APISzczepan Zalega2017-03-11
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Get major firmware versionSzczepan Zalega2016-12-06
|
* Rename methods in API to make string return more obviousSzczepan Zalega2016-11-26
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Document Storage methods in C APISzczepan Zalega2016-11-26
| | | | | | Use uint8_t instead of int where appropriate Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Tests: remake fill SD card test. Get progress bar value when busy.Szczepan Zalega2016-11-26
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Python bindings and tests for most of Storage functionalitySzczepan Zalega2016-11-26
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Fix bug for setting HOTP counters - send uint64 (was uint8)Szczepan Zalega2016-10-19
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Function for getting device's serial number in hex. Fixes #33Szczepan Zalega2016-09-08
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Autodetect inserted stick and connect to itSzczepan Zalega2016-08-05
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Slots token ID documentation and payload fields updateSzczepan Zalega2016-08-05
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Slots config writing - C API documentation updateSzczepan Zalega2016-08-05
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Update general config commands - bool -> uint8_tSzczepan Zalega2016-08-05
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Support writing token id to OTP slots in APISzczepan Zalega2016-08-05
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Allow user to choose new user PIN when unlockingSzczepan Zalega2016-08-05
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Remove commented codeSzczepan Zalega2016-08-05
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Handle OTP slot config in C API during writingSzczepan Zalega2016-08-05
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Support for command: is_aes_supportedSzczepan Zalega2016-08-05
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Add string parameters lengths to function documentation for C APISzczepan Zalega2016-08-01
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Added description for C API functions, updated README.mdSzczepan Zalega2016-08-01
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Do not authenticate on login with admin credentialsSzczepan Zalega2016-08-01
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Choose device model during connectionSzczepan Zalega2016-08-01
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Config options for OTP slots added to command structureSzczepan Zalega2016-08-01
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Authorizing getting OTP codes - initial versionSzczepan Zalega2016-08-01
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>