pquerna / otp

TOTP library for Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

nizigama opened this issue · comments

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