Versions in this module Expand all Collapse all v1 v1.0.1 Feb 8, 2024 v1.0.0 Nov 12, 2023 Changes in this version + var ErrInvalidCode = errors.New("go-otp: invalid code given") + type Digits uint8 + const DigitsEight + const DigitsSix + func (d Digits) Int() int + func (d Digits) String() string + type HOTP struct + func NewHOTP(opts HOTPOptions) (*HOTP, error) + func (h *HOTP) Base32Secret() string + func (h *HOTP) Counter() uint64 + func (h *HOTP) Digits() Digits + func (h *HOTP) Generate() (string, error) + func (h *HOTP) Hash() Hash + func (h *HOTP) Secret() []byte + func (h *HOTP) SetCounter(counter uint64) + func (h *HOTP) SetDigits(digits Digits) + func (h *HOTP) SetHash(hash Hash) + func (h *HOTP) SetSecret(secret []byte) + func (h *HOTP) Validate(code string) error + type HOTPOptions struct + Counter uint64 + Digits Digits + Hash Hash + Secret []byte + type Hash uint8 + const HashSHA1 + const HashSHA256 + const HashSHA512 + func (h Hash) Hash() hash.Hash + func (h Hash) Size() int + func (h Hash) String() string + type TOTP struct + func NewTOTP(opts TOTPOptions) (*TOTP, error) + func (t *TOTP) Base32Secret() string + func (t *TOTP) Digits() Digits + func (t *TOTP) Generate() (string, error) + func (t *TOTP) Hash() Hash + func (t *TOTP) Period() uint64 + func (t *TOTP) Secret() []byte + func (t *TOTP) SetDigits(digits Digits) + func (t *TOTP) SetHash(hash Hash) + func (t *TOTP) SetPeriod(period uint64) + func (t *TOTP) SetSecret(secret []byte) + func (t *TOTP) SetTime(tm time.Time) + func (t *TOTP) SetTimeStart(tm time.Time) + func (t *TOTP) Time() time.Time + func (t *TOTP) TimeStart() time.Time + func (t *TOTP) URL(issuer, accountName string) *url.URL + func (t *TOTP) Validate(code string) error + type TOTPOptions struct + Digits Digits + Hash Hash + Period uint64 + Secret []byte + Time time.Time + TimeStart time.Time