Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidType = fmt.Errorf("valid type must be hotp or totp") ErrSecretRequired = fmt.Errorf("the secret is required") ErrInvalidSecret = fmt.Errorf("the secret must be a base32 encoded string") ErrInvalidDigits = fmt.Errorf("parse digits to int failed") ErrCounterRequired = fmt.Errorf("the counter is required for hotp") ErrInvalidCounter = fmt.Errorf("parse counter to uint failed") ErrInvalidPeriod = fmt.Errorf("parse period to uint failed") )
Functions ¶
This section is empty.
Types ¶
type HOTP ¶
type HOTP struct {
Key []byte
}
func (HOTP) Generate ¶
Generate https://datatracker.ietf.org/doc/html/rfc4226#section-5.3
type Key ¶
type Key struct { Typ string Issuer string Account string Secret []byte Period int Counter uint64 Digits int Algorithm string // contains filtered or unexported fields }
func ParseFromURL ¶
ParseFromURL https://github.com/google/google-authenticator/wiki/Key-Uri-Format
type Option ¶
type Option func(*Options)
func WithHashFunc ¶
WithHashFunc The default hash func is sha1.New You can use other hash func such as: sha256.New, sha512.New, md5.New
func WithStartTime ¶
WithStartTime The default start time = 0 The UNIX time to start counting time steps
type Options ¶
func NewOptions ¶
func NewOptions() *Options
Click to show internal directories.
Click to hide internal directories.