Documentation
¶
Index ¶
- func ConvAlgoString(algorithm string) (func() hash.Hash, error)
- func Itob(v uint64) []byte
- type Hotp
- func (o *Hotp) AccountName() string
- func (o *Hotp) At(c uint64) uint32
- func (o *Hotp) Digits() uint8
- func (o *Hotp) Generate() uint32
- func (o *Hotp) ID() uint64
- func (o *Hotp) Issuer() string
- func (o *Hotp) SetID(id uint64)
- func (o *Hotp) ToString(d uint32) string
- func (o *Hotp) Type() string
- func (o *Hotp) URI() string
- type Otp
- type Totp
- func (o *Totp) AccountName() string
- func (o *Totp) At(c uint64) uint32
- func (o *Totp) Digits() uint8
- func (o *Totp) Generate() uint32
- func (o *Totp) GenerateWithRemainingSeconds(t time.Time) (uint32, uint64)
- func (o *Totp) ID() uint64
- func (o *Totp) Issuer() string
- func (o *Totp) SetID(id uint64)
- func (o *Totp) ToString(d uint32) string
- func (o *Totp) Type() string
- func (o *Totp) URI() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvAlgoString ¶
ConvAlgoString converts an algorithm string to the hash function
Types ¶
type Hotp ¶
type Hotp struct {
// contains filtered or unexported fields
}
Hotp defines an HOTP object
func NewDefaultHotp ¶
NewDefaultHotp creates an Hotp object with default arguments
func NewHotp ¶
func NewHotp(accountName, issuer, secret string, algorithm func() hash.Hash, algoString string, digits uint8, counter uint64) *Hotp
NewHotp creates an Hotp object with detailed arguments
func (*Hotp) AccountName ¶
func (o *Hotp) AccountName() string
AccountName returns the OTP account name
type Otp ¶
type Otp interface { ID() uint64 SetID(id uint64) Type() string AccountName() string Issuer() string Digits() uint8 URI() string At(uint64) uint32 Generate() uint32 ToString(uint32) string }
Otp defines an OTP interface
func NewOtpFromURI ¶
NewOtpFromURI makes an OTP object from a URI, ref. <https://github.com/google/google-authenticator/wiki/Key-Uri-Format>
type Totp ¶
type Totp struct {
// contains filtered or unexported fields
}
Totp defines an TOTP object
func NewDefaultTotp ¶
NewDefaultTotp creates an Totp object with default arguments
func NewTotp ¶
func NewTotp(accountName, issuer, secret string, algorithm func() hash.Hash, algoString string, digits uint8, period uint64) *Totp
NewTotp creates an Totp object with detailed arguments
func (*Totp) AccountName ¶
func (o *Totp) AccountName() string
AccountName returns the OTP account name
func (*Totp) GenerateWithRemainingSeconds ¶
GenerateWithRemainingSeconds generates an TOTP value with the remaining seconds