diff --git a/totp/totp.go b/totp/totp.go index a2fb7d5..f4e0ff5 100644 --- a/totp/totp.go +++ b/totp/totp.go @@ -18,10 +18,11 @@ package totp import ( + "io" + "github.com/pquerna/otp" "github.com/pquerna/otp/hotp" "github.com/pquerna/otp/internal" - "io" "crypto/rand" "encoding/base32" @@ -100,6 +101,10 @@ func ValidateCustom(passcode string, secret string, t time.Time, opts ValidateOp opts.Period = 30 } + if opts.Skew == 0 { + opts.Skew = 1 + } + counters := []uint64{} counter := int64(math.Floor(float64(t.Unix()) / float64(opts.Period)))