aboutsummaryrefslogtreecommitdiff
path: root/NK_C_API.h
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-03-31 18:15:37 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2017-04-03 13:20:36 +0200
commit9782076fd0c80385f48e2a3c4c61c9dda06841b3 (patch)
treead94f5c728d20f265dd8d5b24476f23a0b97cb0b /NK_C_API.h
parent71fd63402dcbbc37d6c8b3818de35f7142b850b0 (diff)
downloadlibnitrokey-9782076fd0c80385f48e2a3c4c61c9dda06841b3.tar.gz
libnitrokey-9782076fd0c80385f48e2a3c4c61c9dda06841b3.tar.bz2
Return OTP codes as strings to make sure they are zero-filled properly
Adjust Python tests for new OTP codes return value Also remove manual 0-filling Fixes #57 Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'NK_C_API.h')
-rw-r--r--NK_C_API.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/NK_C_API.h b/NK_C_API.h
index f52034a..97e9ea5 100644
--- a/NK_C_API.h
+++ b/NK_C_API.h
@@ -195,7 +195,7 @@ NK_C_API int NK_write_totp_slot(uint8_t slot_number, const char *slot_name, cons
* @param slot_number HOTP slot number, slot_number<3
* @return HOTP code
*/
-NK_C_API uint32_t NK_get_hotp_code(uint8_t slot_number);
+NK_C_API const char * NK_get_hotp_code(uint8_t slot_number);
/**
* Get HOTP code from the device (PIN protected)
@@ -204,7 +204,7 @@ NK_C_API uint32_t NK_get_hotp_code(uint8_t slot_number);
* otherwise should be set to empty string - ''
* @return HOTP code
*/
-NK_C_API uint32_t NK_get_hotp_code_PIN(uint8_t slot_number, const char* user_temporary_password);
+NK_C_API const char * NK_get_hotp_code_PIN(uint8_t slot_number, const char *user_temporary_password);
/**
* Get TOTP code from the device
@@ -214,7 +214,8 @@ NK_C_API uint32_t NK_get_hotp_code_PIN(uint8_t slot_number, const char* user_tem
* @param last_interval last interval
* @return TOTP code
*/
-NK_C_API uint32_t NK_get_totp_code(uint8_t slot_number, uint64_t challenge, uint64_t last_totp_time, uint8_t last_interval);
+NK_C_API const char * NK_get_totp_code(uint8_t slot_number, uint64_t challenge, uint64_t last_totp_time,
+ uint8_t last_interval);
/**
* Get TOTP code from the device (PIN protected)
@@ -226,8 +227,9 @@ NK_C_API uint32_t NK_get_totp_code(uint8_t slot_number, uint64_t challenge, uint
* otherwise should be set to empty string - ''
* @return TOTP code
*/
-NK_C_API uint32_t NK_get_totp_code_PIN(uint8_t slot_number, uint64_t challenge,
- uint64_t last_totp_time, uint8_t last_interval, const char* user_temporary_password);
+NK_C_API const char * NK_get_totp_code_PIN(uint8_t slot_number, uint64_t challenge,
+ uint64_t last_totp_time, uint8_t last_interval,
+ const char *user_temporary_password);
/**
* Set time on the device (for TOTP requests)