token_info.h 635 B

123456789101112131415161718192021222324252627282930
  1. #ifndef _TOTP_TOKEN_INFO_H_
  2. #define _TOTP_TOKEN_INFO_H_
  3. #include <inttypes.h>
  4. typedef enum {
  5. SHA1,
  6. SHA256,
  7. SHA512
  8. } TokenHashAlgo;
  9. typedef enum {
  10. TOTP_6_DIGITS,
  11. TOTP_8_DIGITS
  12. } TokenDigitsCount;
  13. typedef struct {
  14. uint8_t* token;
  15. uint8_t token_length;
  16. char* name;
  17. TokenHashAlgo algo;
  18. TokenDigitsCount digits;
  19. } TokenInfo;
  20. TokenInfo* token_info_alloc();
  21. void token_info_free(TokenInfo* token_info);
  22. void token_info_set_secret(TokenInfo* token_info, const char* base32_token_secret, uint8_t token_secret_length, uint8_t* iv);
  23. uint8_t token_info_get_digits_count(TokenInfo* token_info);
  24. #endif