aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/NitrokeyManager.h2
-rw-r--r--include/stick10_commands.h26
2 files changed, 23 insertions, 5 deletions
diff --git a/include/NitrokeyManager.h b/include/NitrokeyManager.h
index 90b2d1d..3a86597 100644
--- a/include/NitrokeyManager.h
+++ b/include/NitrokeyManager.h
@@ -20,7 +20,7 @@ namespace nitrokey {
bool first_authenticate(const char *pin, const char *temporary_password);
bool 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);
bool 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);
uint32_t get_HOTP_code(uint8_t slot_number, const char *user_temporary_password);
diff --git a/include/stick10_commands.h b/include/stick10_commands.h
index 7a7e2f2..6df8727 100644
--- a/include/stick10_commands.h
+++ b/include/stick10_commands.h
@@ -88,7 +88,14 @@ class WriteToHOTPSlot : Command<CommandID::WRITE_TO_SLOT> {
uint8_t slot_number;
uint8_t slot_name[15];
uint8_t slot_secret[20];
- uint8_t slot_config;
+ union{
+ uint8_t _slot_config;
+ struct{
+ bool use_8_digits : 1;
+ bool use_enter : 1;
+ bool use_tokenID : 1;
+ };
+ };
uint8_t slot_token_id[13];
uint64_t slot_counter;
@@ -98,7 +105,11 @@ class WriteToHOTPSlot : Command<CommandID::WRITE_TO_SLOT> {
ss << "slot_number:\t" << (int)(slot_number) << std::endl;
ss << "slot_name:\t" << slot_name << std::endl;
ss << "slot_secret:\t" << slot_secret << std::endl;
- ss << "slot_config:\t" << std::bitset<8>((int)slot_config) << std::endl;
+ ss << "slot_config:\t" << std::bitset<8>((int)_slot_config) << std::endl;
+ ss << "\tuse_8_digits(0):\t" << use_8_digits << std::endl;
+ ss << "\tuse_enter(1):\t" << use_enter << std::endl;
+ ss << "\tuse_tokenID(2):\t" << use_tokenID << std::endl;
+
ss << "slot_token_id:\t";
for (auto i : slot_token_id)
ss << std::hex << std::setw(2) << std::setfill('0')<< (int) i << " " ;
@@ -118,7 +129,14 @@ class WriteToTOTPSlot : Command<CommandID::WRITE_TO_SLOT> {
uint8_t slot_number;
uint8_t slot_name[15];
uint8_t slot_secret[20];
- uint8_t slot_config;
+ union{
+ uint8_t _slot_config;
+ struct{
+ bool use_8_digits : 1;
+ bool use_enter : 1;
+ bool use_tokenID : 1;
+ };
+ };
uint8_t slot_token_id[13];
uint16_t slot_interval;
@@ -128,7 +146,7 @@ class WriteToTOTPSlot : Command<CommandID::WRITE_TO_SLOT> {
ss << "slot_number:\t" << (int)(slot_number) << std::endl;
ss << "slot_name:\t" << slot_name << std::endl;
ss << "slot_secret:\t" << slot_secret << std::endl;
- ss << "slot_config:\t" << std::bitset<8>((int)slot_config) << std::endl;
+ ss << "slot_config:\t" << std::bitset<8>((int)_slot_config) << std::endl;
ss << "slot_token_id:\t";
for (auto i : slot_token_id)
ss << std::hex << std::setw(2) << std::setfill('0')<< (int) i << " " ;