faces/totp: define TOTP struct initializer macro
Generates a compound initializer for the given TOTP parameters. Lessens repetition and allows functional definitions of TOTP records.
This commit is contained in:
parent
67907e4e5c
commit
8a7d9326cf
@ -37,6 +37,15 @@ typedef struct {
|
||||
uint8_t *key;
|
||||
} totp_t;
|
||||
|
||||
#define TOTP_INITIALIZER(label_1, label_2, key_array, algo, timestep) \
|
||||
(const totp_t) { \
|
||||
.key = (key_array), \
|
||||
.key_length = sizeof(key_array), \
|
||||
.period = (timestep), \
|
||||
.labels = { (label_1), (label_2) }, \
|
||||
.algorithm = (algo), \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Enter your TOTP key data below
|
||||
static const uint8_t num_keys = 2;
|
||||
|
Loading…
x
Reference in New Issue
Block a user