aboutsummaryrefslogtreecommitdiff
path: root/NitrokeyManager.cc
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-07-27 19:05:18 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2016-08-01 13:54:57 +0200
commit7b6800f7e2cf890a14e3b49d6fc7405e70d94a1e (patch)
tree36c0c8640021e726b14258835c2d6c2430b78276 /NitrokeyManager.cc
parent97b2b07bf359344695059858d7dd63865df97213 (diff)
downloadlibnitrokey-7b6800f7e2cf890a14e3b49d6fc7405e70d94a1e.tar.gz
libnitrokey-7b6800f7e2cf890a14e3b49d6fc7405e70d94a1e.tar.bz2
Config options for OTP slots added to command structure
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'NitrokeyManager.cc')
-rw-r--r--NitrokeyManager.cc10
1 files changed, 3 insertions, 7 deletions
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc
index e1eb8a0..caf9724 100644
--- a/NitrokeyManager.cc
+++ b/NitrokeyManager.cc
@@ -130,7 +130,7 @@ namespace nitrokey{
bool NitrokeyManager::write_HOTP_slot(uint8_t slot_number, const char *slot_name, const char *secret, uint64_t hotp_counter,
- const char *temporary_password) {
+ bool use_8_digits, const char *temporary_password) {
assert(is_valid_hotp_slot_number(slot_number));
assert(strlen(secret)==20); //160 bits
assert(strlen(slot_name)<=15);
@@ -141,7 +141,7 @@ namespace nitrokey{
strcpyT(payload.slot_secret, secret);
strcpyT(payload.slot_name, slot_name);
payload.slot_counter = hotp_counter;
- payload.slot_config; //TODO
+ payload.use_8_digits = use_8_digits;
auto auth = get_payload<Authorize>();
strcpyT(auth.temporary_password, temporary_password);
@@ -152,8 +152,6 @@ namespace nitrokey{
return true;
}
- enum totp_config{digits8=0, enter=1, tokenID=2};
-
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) {
auto payload = get_payload<WriteToTOTPSlot>();
@@ -166,9 +164,7 @@ namespace nitrokey{
strcpyT(payload.slot_secret, secret);
strcpyT(payload.slot_name, slot_name);
payload.slot_interval = time_window; //FIXME naming
- bitset<8> config; //FIXME better config manipulation
- config.set(totp_config::digits8, use_8_digits);
- payload.slot_config = (uint8_t) config.to_ulong();
+ payload.use_8_digits = use_8_digits;
auto auth = get_payload<Authorize>();
strcpyT(auth.temporary_password, temporary_password);