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

how do I generate 16 character length secret key consistently? #201

Closed
vafada opened this issue Jan 16, 2020 · 2 comments · Fixed by #202
Closed

how do I generate 16 character length secret key consistently? #201

vafada opened this issue Jan 16, 2020 · 2 comments · Fixed by #202
Labels
bug Fix required

Comments

@vafada
Copy link

vafada commented Jan 16, 2020

Describe the bug

When generating a secret via const secret = authenticator.generateSecret()

the length of secret varies on every run.

To Reproduce
Steps to reproduce the behavior:
1.

const secret = authenticator.generateSecret()
console.log(secret);
console.log(secret.length);
  1. Run step 1 multiple times, secret.length will be different for every run

Expected behavior

I expect the secret generated of have a consistent length of 16

Details (please provide any relevant information):

  • otplib version: v12
  • os: linux
  • browser:
  • node / yarn: node v.12.13.0
  • frameworks (if any):

Additional context

the website ALWAYS generates a 16 character length string:

https://github.com/yeojz/otplib/blob/master/website/src/components/SecretStore.jsx#L19-L21

@vafada vafada changed the title how do I get 16 secret key how do I generate 16 character length secret key consistently? Jan 16, 2020
@yeojz
Copy link
Owner

yeojz commented Jan 18, 2020

Thanks for the report. Will look into it.

At a glance, it looks like it is highly likely due to the thirty-two implementation.

@yeojz yeojz added the triaging Investigation will be taken or is ongoing label Jan 18, 2020
@yeojz yeojz added bug Fix required and removed triaging Investigation will be taken or is ongoing labels Jan 23, 2020
@yeojz
Copy link
Owner

yeojz commented Jan 23, 2020

Thanks for the report.
Found the area of concern and will be addressed in #202

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

Successfully merging a pull request may close this issue.

2 participants