summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>2024-02-25 22:40:32 -0300
committerMatheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>2024-02-25 22:52:31 -0300
commit46a4076f9ee1c7546040c9484baa17fda7fe246a (patch)
treeebb6be50a8dce842d3405e5230f360c8458f0fa5
parentd70511515e986427ab4c73e14458de01e24aa3b8 (diff)
downloadSensor-Watch-46a4076f9ee1c7546040c9484baa17fda7fe246a.tar.gz
Sensor-Watch-46a4076f9ee1c7546040c9484baa17fda7fe246a.tar.bz2
Sensor-Watch-46a4076f9ee1c7546040c9484baa17fda7fe246a.zip
faces/totp: improve TOTP initializer labeling
It now generates the string literal from the preprocessor token. Even warns the user if the string is too long!
-rw-r--r--movement/watch_faces/complication/totp_face.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/movement/watch_faces/complication/totp_face.c b/movement/watch_faces/complication/totp_face.c
index 83126a1a..2edabd83 100644
--- a/movement/watch_faces/complication/totp_face.c
+++ b/movement/watch_faces/complication/totp_face.c
@@ -46,12 +46,12 @@ typedef struct {
unsigned char *key;
} totp_t;
-#define TOTP_INITIALIZER(label_1, label_2, key_array, algo, timestep) \
+#define TOTP_INITIALIZER(label, key_array, algo, timestep) \
(const totp_t) { \
.key = ((unsigned char *) key_array), \
.key_length = sizeof(key_array) - 1, \
.period = (timestep), \
- .labels = { (label_1), (label_2) }, \
+ .labels = (#label), \
.algorithm = (algo), \
}
@@ -59,8 +59,8 @@ typedef struct {
// Enter your TOTP key data below
static totp_t credentials[] = {
- TOTP_INITIALIZER('2', 'F', "JBSWY3DPEHPK3PXP", SHA1, 30),
- TOTP_INITIALIZER('A', 'C', "JBSWY3DPEHPK3PXP", SHA1, 30),
+ TOTP_INITIALIZER(2F, "JBSWY3DPEHPK3PXP", SHA1, 30),
+ TOTP_INITIALIZER(AC, "JBSWY3DPEHPK3PXP", SHA1, 30),
};
// END OF KEY DATA.