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

Cannot generateSecret due to Buffer not being found #499

Open
robecole1 opened this issue Feb 21, 2025 · 0 comments
Open

Cannot generateSecret due to Buffer not being found #499

robecole1 opened this issue Feb 21, 2025 · 0 comments

Comments

@robecole1
Copy link

I am trying to use the generateSecret function, but I am getting this error whenever it is ran. I am running this on React v17.0.2 and am using node 16.17.0. I have tried doing npm install buffer, and have tried importing Buffer into this file, but the issue still persists.

ReferenceError: Can't find variable: Buffer
generateSecret
node_modules/time2fa/dist/index.mjs:179
  176 |   };
  177 | };
  178 | const generateSecret = (secretSize = DEFAULT_TOTP_SECRET_SIZE) => {
> 179 |   const bytes = Buffer.from(crypto.randomBytes(secretSize));
  180 |   return Encode32(bytes);
  181 | };
  182 | const generateBackupCodes = (numCodes = 10, codeLength = DEFAULT_TOTP_DIGITS) => {
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

No branches or pull requests

1 participant