2021-11-25 01:14:17 +08:00
|
|
|
#ifndef TOTP_H_
|
|
|
|
#define TOTP_H_
|
|
|
|
|
2021-11-24 10:37:54 +08:00
|
|
|
#include <inttypes.h>
|
|
|
|
#include "time.h"
|
|
|
|
|
2024-04-10 10:34:43 +08:00
|
|
|
typedef enum __attribute__ ((__packed__)) {
|
2023-01-15 00:58:03 +08:00
|
|
|
SHA1,
|
|
|
|
SHA224,
|
|
|
|
SHA256,
|
|
|
|
SHA384,
|
|
|
|
SHA512
|
|
|
|
} hmac_alg;
|
|
|
|
|
|
|
|
void TOTP(uint8_t* hmacKey, uint8_t keyLength, uint32_t timeStep, hmac_alg algorithm);
|
2021-11-24 10:37:54 +08:00
|
|
|
void setTimezone(uint8_t timezone);
|
|
|
|
uint32_t getCodeFromTimestamp(uint32_t timeStamp);
|
|
|
|
uint32_t getCodeFromTimeStruct(struct tm time);
|
|
|
|
uint32_t getCodeFromSteps(uint32_t steps);
|
2021-11-25 01:14:17 +08:00
|
|
|
|
|
|
|
#endif // TOTP_H_
|