summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NK_C_API.cc2
-rw-r--r--NitrokeyManager.cc5
-rw-r--r--include/NitrokeyManager.h2
3 files changed, 5 insertions, 4 deletions
diff --git a/NK_C_API.cc b/NK_C_API.cc
index f396fcb..6d18e52 100644
--- a/NK_C_API.cc
+++ b/NK_C_API.cc
@@ -273,7 +273,7 @@ extern int NK_totp_set_time(uint64_t time){
extern int NK_totp_get_time(){
auto m = NitrokeyManager::instance();
return get_without_result([&](){
- m->get_time(); // FIXME check how that should work
+ m->get_time(0); // FIXME check how that should work
});
}
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc
index c5259d2..dc58e4d 100644
--- a/NitrokeyManager.cc
+++ b/NitrokeyManager.cc
@@ -399,11 +399,12 @@ namespace nitrokey{
return false;
}
- bool NitrokeyManager::get_time() {
+ bool NitrokeyManager::get_time(uint64_t time) {
auto p = get_payload<SetTime>();
p.reset = 0;
+ p.time = time;
SetTime::CommandTransaction::run(*device, p);
- return false;
+ return true;
}
void NitrokeyManager::change_user_PIN(const char *current_PIN, const char *new_PIN) {
diff --git a/include/NitrokeyManager.h b/include/NitrokeyManager.h
index f0cab68..3e38cc3 100644
--- a/include/NitrokeyManager.h
+++ b/include/NitrokeyManager.h
@@ -37,7 +37,7 @@ namespace nitrokey {
stick10::ReadSlot::ResponsePayload get_HOTP_slot_data(const uint8_t slot_number);
bool set_time(uint64_t time);
- bool get_time();
+ bool get_time(uint64_t time = 0);
bool erase_totp_slot(uint8_t slot_number, const char *temporary_password);
bool erase_hotp_slot(uint8_t slot_number, const char *temporary_password);
bool connect(const char *device_model);