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

add sha256 and sha512 support for totp #172

Merged
merged 1 commit into from
May 9, 2024
Merged

add sha256 and sha512 support for totp #172

merged 1 commit into from
May 9, 2024

Conversation

jonas-w
Copy link
Contributor

@jonas-w jonas-w commented May 7, 2024

This fixes #171.

  • The code now extracts the algorithm, digits and period query parameter from the totp URL too.
  • parse_totp_secret now returns the TotpParams struct
  • generate_totp now uses the totp_params.algorithm to pass the correct hash type to totp_lite::totp_custom.
    • Code duplication seems to be "necessary" as the hash type needs to be known at compile time, or at least I couldn't figure out another way.
  • generate_totp also uses the parsed number of digits and the time period.
  • There should be no behaviour changes compared to the previous version of the code for URLs without these parameters.

@doy doy merged commit c50a098 into doy:main May 9, 2024
7 of 8 checks passed
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.

TOTP with different algorithm not supported
2 participants