Skip to content

fix: ensured that generateTOTP converts the digits and period params into numbers. #25

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

Merged
merged 4 commits into from
Feb 25, 2025

Conversation

szabolcsnagy
Copy link
Contributor

  1. Added back the ability to generate long OTPs while staying compatible with the authenticator apps.
  2. Also, fixed and issue with generateTOTP. It was not working correctly when the digits and period parameters are passed as a string instead of a number.
  3. Based on this article the original TOTP algorithm can generate OTPs up to 10 characters long. I modified generateHOTP to stay on the 32bit value if the digits parameter is less than or equal to 10.

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this!

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much! I've verified this works for my app now as well.

@szabolcsnagy
Copy link
Contributor Author

No problem. Thanks for merging it so quickly.

@kentcdodds kentcdodds merged commit 33d8db9 into epicweb-dev:main Feb 25, 2025
2 checks passed
Copy link

🎉 This PR is included in version 4.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants