You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// A shortcut for ValidateCustom, Validate uses a configuration
// that is compatible with Google-Authenticator and most clients.
funcValidate(passcodestring, secretstring) bool {
rv, _:=ValidateCustom(
passcode,
secret,
time.Now().UTC(),
ValidateOpts{
Period: 30,
Skew: 1,
Digits: otp.DigitsSix,
Algorithm: otp.AlgorithmSHA1,
},
)
returnrv
}
I suppose the comment is technically correct, because if I use ValidateCustom together with the zero-value of the ValidateOpts struct it will use a Skew value of 0, but I originally misinterpreted this to mean the package's default Skew was 0.
If you only read the docs, and ignore the package's internal implementation here you'll see what I mean. There's nothing to indicate what the default Skew is except the comment on ValidateOpts, so it would be fair to assume this is the default for Validate.
Since we shouldn't make a backwards-incompatible change to either ValidateOpts or Validate for API stability, I suppose this detail should be clarified via a more specific comment?
The text was updated successfully, but these errors were encountered:
The comment on the
Skew
field onValidateOpts
is a bit misleading.It says:
otp/totp/totp.go
Lines 68 to 71 in 5971b1e
If I decide "ok I'm happy with the defaults" and call
Validate
(rather thanValidateCustom
), it actually uses a default Skew of 1:otp/totp/totp.go
Lines 34 to 50 in 5971b1e
I suppose the comment is technically correct, because if I use
ValidateCustom
together with the zero-value of theValidateOpts
struct it will use a Skew value of 0, but I originally misinterpreted this to mean the package's default Skew was 0.If you only read the docs, and ignore the package's internal implementation here you'll see what I mean. There's nothing to indicate what the default Skew is except the comment on
ValidateOpts
, so it would be fair to assume this is the default forValidate
.Since we shouldn't make a backwards-incompatible change to either
ValidateOpts
orValidate
for API stability, I suppose this detail should be clarified via a more specific comment?The text was updated successfully, but these errors were encountered: