0

I am attempting to verify a token using the npm package otpAuth and the secret is not defined.

Here is the object I pass in to the totp.validate(token) function:

let totp = new OTPAuth.TOTP({
  issuer: 'Example.com',
  label: 'Example',
  algorithm: 'SHA1',
  digits: 6,
  period: 15, 
  secret: otp_base32

Then I run this function to validate a token using the created object:

  let delta = totp.validate({ token });

However no matter what I do, the secret is not showing up. This is how it appears when I log it, every time:

 totp: {
      "issuer": "example.com",
      "label": "Example",
      "secret": {
        "buffer": {}
      },
      "algorithm": "SHA1",
      "digits": 6,
      "period": 15
    }

How can I ensure that the secret is populated in the totp object?

Robert
  • 176
  • 1
  • 12

0 Answers0