28 HOTP(key.begin(), key.size(), hash_algo, digits) {}
36 HOTP(
const uint8_t key[],
size_t key_len, std::string_view hash_algo =
"SHA-1",
size_t digits = 6);
42 uint32_t generate_hotp(uint64_t counter);
54 std::pair<bool, uint64_t> verify_hotp(uint32_t otp, uint64_t starting_counter,
size_t resync_range = 0);
57 std::unique_ptr<MessageAuthenticationCode> m_mac;
73 std::string_view hash_algo =
"SHA-1",
75 size_t time_step = 30) :
76 TOTP(key.begin(), key.size(), hash_algo, digits, time_step) {}
85 TOTP(
const uint8_t key[],
87 std::string_view hash_algo =
"SHA-1",
89 size_t time_step = 30);
94 uint32_t generate_totp(std::chrono::system_clock::time_point time_point);
100 uint32_t generate_totp(uint64_t unix_time);
102 bool verify_totp(uint32_t otp, std::chrono::system_clock::time_point time,
size_t clock_drift_accepted = 0);
104 bool verify_totp(uint32_t otp, uint64_t unix_time,
size_t clock_drift_accepted = 0);
109 std::chrono::system_clock::time_point m_unix_epoch;