Versions in this module Expand all Collapse all v2 v2.11.4 Mar 7, 2021 v2.11.3 Mar 7, 2021 Changes in this version + const HOTP + const SHA1 + const SHA256 + const SHA512 + const TOTP + var ErrMaxAttempts = errors.New("OTP: Max attempts reached, Account locked out") + var ErrWeakSecretSize = errors.New("Weak secret size, The shared secret MUST be at least 128 bits") + func GenerateOTP(secret string, counter uint64, algo HashAlgorithm, dig Digits) (string, error) + func GenerateSecret(size uint) (string, error) + type Digits int + const EightDigits + const SixDigits + func (d Digits) String() string + type HashAlgorithm string + func (h HashAlgorithm) Hasher() func() hash.Hash + func (h HashAlgorithm) String() string + type Key struct + func NewKey(t Type, label, secret string) *Key + func NewKeyFromRaw(raw string) (*Key, error) + func (k *Key) AccountName() string + func (k *Key) Algorithm() HashAlgorithm + func (k *Key) Counter() uint64 + func (k *Key) Digits() Digits + func (k *Key) Issuer() string + func (k *Key) IssuerLabelPrefix() string + func (k *Key) Label() string + func (k *Key) Period() uint64 + func (k *Key) Secret() string + func (k *Key) SetAlgorithm(algo HashAlgorithm) + func (k *Key) SetCounter(count uint64) + func (k *Key) SetDigits(d Digits) + func (k *Key) SetIssuer(issuer string) + func (k *Key) SetLabel(label string) + func (k *Key) SetPeriod(p uint64) + func (k *Key) SetSecret(secret string) + func (k *Key) SetType(t Type) + func (k *Key) Type() Type + type Type string + type VerificationDisabledError time.Duration + func (v VerificationDisabledError) Error() string + type Verifier struct + DealyTime time.Time + EnableLockout bool + Failures uint + Key *Key + LockOutDelay uint + LockOutStartAt uint + MaxAttempts uint + Skew uint + func New(key *Key) *Verifier + func (v *Verifier) GenerateOTP() (string, error) + func (v *Verifier) Verify(otp string) (bool, error)