diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2016-08-04 12:06:04 +0200 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2016-08-05 10:17:30 +0200 |
commit | 7b3174e6c5271a2e7160625ce70aa28f120fb662 (patch) | |
tree | 0308f03a48504350bdac25e4c396bb67dd2e3e05 /NitrokeyManager.cc | |
parent | fd95d2ec8b0160657709f1655887739191f33932 (diff) | |
download | libnitrokey-7b3174e6c5271a2e7160625ce70aa28f120fb662.tar.gz libnitrokey-7b3174e6c5271a2e7160625ce70aa28f120fb662.tar.bz2 |
Handle OTP slot config in C API during writing
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'NitrokeyManager.cc')
-rw-r--r-- | NitrokeyManager.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc index ef7358f..488c5fe 100644 --- a/NitrokeyManager.cc +++ b/NitrokeyManager.cc @@ -138,8 +138,9 @@ namespace nitrokey{ } - bool NitrokeyManager::write_HOTP_slot(uint8_t slot_number, const char *slot_name, const char *secret, uint64_t hotp_counter, - bool use_8_digits, const char *temporary_password) { + bool NitrokeyManager::write_HOTP_slot(uint8_t slot_number, const char *slot_name, const char *secret, + uint8_t hotp_counter, bool use_8_digits, + bool use_enter, bool use_tokenID, const char *temporary_password) { assert(is_valid_hotp_slot_number(slot_number)); assert(strlen(secret)==20); //160 bits assert(strlen(slot_name)<=15); @@ -151,6 +152,8 @@ namespace nitrokey{ strcpyT(payload.slot_name, slot_name); payload.slot_counter = hotp_counter; payload.use_8_digits = use_8_digits; + payload.use_enter = use_enter; + payload.use_tokenID = use_tokenID; auto auth = get_payload<Authorize>(); strcpyT(auth.temporary_password, temporary_password); @@ -162,7 +165,8 @@ namespace nitrokey{ } bool NitrokeyManager::write_TOTP_slot(uint8_t slot_number, const char *slot_name, const char *secret, - uint16_t time_window, bool use_8_digits, const char *temporary_password) { + uint16_t time_window, bool use_8_digits, + bool use_enter, bool use_tokenID, const char *temporary_password) { auto payload = get_payload<WriteToTOTPSlot>(); assert(is_valid_totp_slot_number(slot_number)); assert(strlen(secret) == sizeof payload.slot_secret); //160 bits @@ -174,6 +178,9 @@ namespace nitrokey{ strcpyT(payload.slot_name, slot_name); payload.slot_interval = time_window; //FIXME naming payload.use_8_digits = use_8_digits; + payload.use_enter = use_enter; + payload.use_tokenID = use_tokenID; + payload.slot_token_id auto auth = get_payload<Authorize>(); strcpyT(auth.temporary_password, temporary_password); |