Documentation ¶
Index ¶
- Variables
- type Digits
- type HOTP
- 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
- type Hash
- type TOTP
- 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
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidCode = errors.New("go-otp: invalid code given")
Functions ¶
This section is empty.
Types ¶
type HOTP ¶
type HOTP struct {
// contains filtered or unexported fields
}
func (*HOTP) Base32Secret ¶
Base32Secret returns the HOTP secret encoded in base32.
func (*HOTP) SetCounter ¶
SetCounter sets the HOTP counter to given counter.
type HOTPOptions ¶
type TOTP ¶
type TOTP struct {
// contains filtered or unexported fields
}
func (*TOTP) Base32Secret ¶
Base32Secret returns the TOTP secret encoded in base32.
func (*TOTP) SetTimeStart ¶
SetTimeStart sets the TOTP time start.
func (*TOTP) URL ¶
URL returns net/url.URL representation for the TOTP.
type TOTPOptions ¶
type TOTPOptions struct { Secret []byte // Secret between client and server. K in RFC 4226. Time time.Time // Current time in RFC 6238. TimeStart time.Time // Time to start counting time steps. T0 in RFC 6238. Digits Digits // Number of digits in a TOTP code. Digit in RFC 4226. Period uint64 // Time step in seconds, X in RFC 6238, 30 seconds is recommended. Hash Hash // Algorithm for the TOTP, SHA256 is recommended. }
Click to show internal directories.
Click to hide internal directories.