totp

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

db.h (651B)


      1 #ifndef DB_H
      2 #define DB_H
      3 
      4 #include <time.h>
      5 #include <limits.h>
      6 #include "token.h"
      7 
      8 struct AES_ctx;
      9 
     10 struct totpkey {
     11 	uint8_t t0[sizeof(uint64_t)];
     12 	uint8_t digest;
     13 	uint8_t digits;
     14 	uint8_t period;
     15 	uint8_t keylen;
     16 	uint8_t desclen;
     17 	uint8_t issuerlen;
     18 	uint8_t filler1;
     19 	uint8_t filler2;
     20 };
     21 
     22 int db_open_read(const char *filename, struct AES_ctx *c, uint8_t *keybuf);
     23 int db_open_write(const char *filename, struct AES_ctx *c, uint8_t *keybuf);
     24 void db_foreach(int fd, struct AES_ctx *c,
     25 		void (*key_cb)(struct token *token,
     26 			       void *data),
     27 		void *cb_data);
     28 int db_add_key(int fd, struct AES_ctx *c,
     29 	       struct token *token);
     30 
     31 #endif