summaryrefslogtreecommitdiffstats
path: root/movement/watch_faces/complication/totp_face_lfs.h
diff options
context:
space:
mode:
authorJames Haggerty <james@gruemail.com>2022-11-01 17:08:05 +1100
committerGitHub <noreply@github.com>2022-11-01 01:08:05 -0500
commitb7a461d280d06749aeb14af1e8c17cbf3616055b (patch)
tree899fb8f3b9aefbbbcddc969f0e6d04570adc7661 /movement/watch_faces/complication/totp_face_lfs.h
parent54495d2d295675da636c60d864715ea36e8ebedd (diff)
downloadSensor-Watch-b7a461d280d06749aeb14af1e8c17cbf3616055b.tar.gz
Sensor-Watch-b7a461d280d06749aeb14af1e8c17cbf3616055b.tar.bz2
Sensor-Watch-b7a461d280d06749aeb14af1e8c17cbf3616055b.zip
Make the TOTP face use the filesystem for secret storage (#95)
* TOTP using filesystem * Filesystem: ability to read files line by line
Diffstat (limited to 'movement/watch_faces/complication/totp_face_lfs.h')
-rw-r--r--movement/watch_faces/complication/totp_face_lfs.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/movement/watch_faces/complication/totp_face_lfs.h b/movement/watch_faces/complication/totp_face_lfs.h
new file mode 100644
index 00000000..0f388bc3
--- /dev/null
+++ b/movement/watch_faces/complication/totp_face_lfs.h
@@ -0,0 +1,26 @@
+#ifndef TOTP_FACE_LFS_H_
+#define TOTP_FACE_LFS_H_
+
+#include "movement.h"
+
+typedef struct {
+ uint32_t timestamp;
+ uint8_t steps;
+ uint32_t current_code;
+ uint8_t current_index;
+} totp_lfs_state_t;
+
+void totp_face_lfs_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
+void totp_face_lfs_activate(movement_settings_t *settings, void *context);
+bool totp_face_lfs_loop(movement_event_t event, movement_settings_t *settings, void *context);
+void totp_face_lfs_resign(movement_settings_t *settings, void *context);
+
+#define totp_face_lfs ((const watch_face_t){ \
+ totp_face_lfs_setup, \
+ totp_face_lfs_activate, \
+ totp_face_lfs_loop, \
+ totp_face_lfs_resign, \
+ NULL, \
+})
+
+#endif // TOTP_FACE_LFS_H_