Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Structured TOTP watch face #369

Merged
merged 12 commits into from
Mar 17, 2024
Merged

Conversation

matheusmoreira
Copy link
Collaborator

Improves the standard TOTP watch face by making it easier to define new secrets. Aggregating the TOTP data into a structure allows simple and functional definition of new instances with an initializer generator macro. This also makes the size and offset variables superfluous and so they are removed.

Aggregates all the data necessary for TOTP generation.
Generates a compound initializer for the given TOTP parameters.
Lessens repetition and allows functional definitions of TOTP records.
The data definitions are much shorter and easier to read now.
Computes the size of the array of TOTP records.
The compiler will likely evaluate it at compile time.
Selects the appropriate TOTP data structure
given the TOTP watch face state.
Using the new structured TOTP record data structure
allows the TOTP watch face to statically and implicitly
compute the total number of defined TOTP records.

Users can now simply add new keys and records in the designated area
and the watch face will compile and automatically use them with no need
to maintain a separate array size variable. Less chance of mistakes.
The TOTP watch face now keeps track of each key separately.
There is no need to compute offsets at runtime.
Update the copyrights to include full name attribution
to all who contributed to this watch face, including myself.

Also add an SPDX license identifier header comment to the files.

https://spdx.org/licenses/MIT.html
This allows the user to easily copy the base32 encoded secrets
into the TOTP record initializers. They will be decoded once
at runtime when the face is being set up by the movement framework.

Also rename the array of TOTP records to credentials. Much better.
It now generates the string literal from the preprocessor token.
Even warns the user if the string is too long!
Shorter and far more expressive.
Makes for cleaner symbols.
matheusmoreira added a commit to matheusmoreira/sensor-watch that referenced this pull request Mar 5, 2024
Aggregates the TOTP credentials into a data structure,
making it easier to define and use the credentials.
Also incorporate backwards movement code from another branch.

Co-authored-by: Max Zettlmeißl <max@zettlmeissl.de>
Tested-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
GitHub-Pull-Request: joeycastillo#369
GitHub-Related-Pull-Request: joeycastillo#356
matheusmoreira added a commit to matheusmoreira/sensor-watch that referenced this pull request Mar 5, 2024
Aggregates the TOTP credentials into a data structure,
making it easier to define and use the credentials.
Also incorporate backwards movement code from another branch.

Co-authored-by: Max Zettlmeißl <max@zettlmeissl.de>
Tested-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
GitHub-Pull-Request: joeycastillo#369
GitHub-Related-Pull-Request: joeycastillo#356
matheusmoreira added a commit to matheusmoreira/sensor-watch that referenced this pull request Mar 5, 2024
Aggregates the TOTP credentials into a data structure,
making it easier to define and use the credentials.
Also incorporate backwards movement code from another branch.

Co-authored-by: Max Zettlmeißl <max@zettlmeissl.de>
Tested-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
GitHub-Pull-Request: joeycastillo#369
GitHub-Related-Pull-Request: joeycastillo#356
matheusmoreira added a commit to matheusmoreira/sensor-watch that referenced this pull request Mar 5, 2024
Aggregates the TOTP credentials into a data structure,
making it easier to define and use the credentials.
Also incorporate backwards movement code from another branch.

Co-authored-by: Max Zettlmeißl <max@zettlmeissl.de>
Tested-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
GitHub-Pull-Request: joeycastillo#369
GitHub-Related-Pull-Request: joeycastillo#356
matheusmoreira added a commit to matheusmoreira/sensor-watch that referenced this pull request Mar 5, 2024
Aggregates the TOTP credentials into a data structure,
making it easier to define and use the credentials.
Also incorporate backwards movement code from another branch.

Co-authored-by: Max Zettlmeißl <max@zettlmeissl.de>
Tested-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
GitHub-Pull-Request: joeycastillo#369
GitHub-Related-Pull-Request: joeycastillo#356
@matheusmoreira
Copy link
Collaborator Author

Seems to be working well on real hardware. No issues so far.

matheusmoreira added a commit to matheusmoreira/sensor-watch that referenced this pull request Mar 8, 2024
Aggregates the TOTP credentials into a data structure,
making it easier to define and use the credentials.
Also incorporate backwards movement code from another branch.

Co-authored-by: Max Zettlmeißl <max@zettlmeissl.de>
Tested-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Tested-on-hardware-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
GitHub-Pull-Request: joeycastillo#369
GitHub-Related-Pull-Request: joeycastillo#356
@theAlexes theAlexes merged commit 4633be0 into joeycastillo:main Mar 17, 2024
2 checks passed
@matheusmoreira matheusmoreira deleted the structured-totp branch March 17, 2024 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants