sensor-watch/movement/watch_faces
Matheus Afonso Martins Moreira 10701f3d50 faces/totp: avoid displaying when key is invalid
Fixes a division by zero bug caused by calling getCodeFromTimestamp
without having initialized the TOTP library with a secret first.
This was happening because the face calls totp_display on activation,
meaning the validity of the secret was not checked since this is
done in the generate function.

Now the validity of the key is determined solely by the size
of the current decoded key. A general display function checks it
and decides whether to display the code or just the error message.

The size of the current decoded key is initialized to zero
on watch face activation, ensuring fail safe operation.

Tested-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Tested-on-hardware-by: madhogs <59648482+madhogs@users.noreply.github.com>
Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/385
2024-03-20 12:54:20 -03:00
..
clock faces: restore simple_clock_face 2024-03-16 20:04:08 -03:00
complication faces/totp: avoid displaying when key is invalid 2024-03-20 12:54:20 -03:00
demo Fix missing documentation for many clock faces: 2023-11-27 23:06:19 -05:00
sensor Fix missing documentation for many clock faces: 2023-11-27 23:06:19 -05:00
settings Change inactivity deadlines: add 10 minutes and remove 2 days. (#365) 2024-02-07 14:02:41 -05:00