pquerna / otp

TOTP library for Go
Apache License 2.0
2.32k stars 224 forks source link

Generated custom code sometimes comes as 5 digits long instead of 6 #82

Closed nizigama closed 1 year ago

nizigama commented 1 year ago
passcode, err := totp.GenerateCodeCustom(secret, time.Now(), totp.ValidateOpts{
      Period:    otpTTL,
      Skew:      1,
      Digits:    otp.DigitsSix,
      Algorithm: otp.AlgorithmSHA512,
})

if err != nil {
   return err
}

The code sometimes generates a 5 digits long passcode instead of 6 as set with the otp.DigitsSix parameter. And it happens randomly