token_info.h 584 B

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