totp

Simple cli tool for storing TOTP secrets and generating tokens
git clone https://git.inz.fi/totp/
Log | Files | Refs | Submodules

token.h (491B)


      1 #ifndef TOKEN_H
      2 #define TOKEN_H
      3 
      4 #include <stdlib.h>
      5 #include <stdbool.h>
      6 #include <stdint.h>
      7 #include <time.h>
      8 #include "util.h"
      9 
     10 enum digest {
     11 	DIGEST_SHA1 = 0,
     12 	DIGEST_SHA224,
     13 	DIGEST_SHA256,
     14 	DIGEST_SHA384,
     15 	DIGEST_SHA512,
     16 };
     17 
     18 extern const char *digest_names[];
     19 
     20 struct token {
     21 	struct bytes key;
     22 	struct bytes desc;
     23 	struct bytes issuer;
     24 	enum digest digest;
     25 	time_t t0;
     26 	uint8_t digits;
     27 	uint8_t period;
     28 	bool valid;
     29 };
     30 
     31 struct token token_parse_uri(char *data);
     32 
     33 #endif /* TOKEN_H */