Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateSecret(lens ...int) string
- func ValidSecret(secret string, lens ...int) bool
- func ValidType(t string) bool
- type Authenticator
- func (a *Authenticator) Active(id string)
- func (a *Authenticator) AddSecret(id, secret string, update bool) (OTP, error)
- func (a *Authenticator) Close(id string)
- func (a *Authenticator) GetSecret(id string) string
- func (a *Authenticator) Inactive(id string)
- func (a *Authenticator) IsActive(id string) bool
- func (a *Authenticator) IsOpen(id string) bool
- func (a *Authenticator) Open(id string)
- func (a *Authenticator) URL(id, user, issuer string) string
- func (a *Authenticator) ValidSecret(id string) bool
- func (a *Authenticator) Verify(id, password string) (bool, error)
- type HOTP
- type OTP
- type TOTP
Constants ¶
View Source
const ( TypeTOTP string = "totp" TypeHOTP = "hotp" )
Variables ¶
Functions ¶
func GenerateSecret ¶
func ValidSecret ¶
Types ¶
type Authenticator ¶
type Authenticator struct { Type string SecretLength int OTPAuth map[string]OTP OTPOpen map[string]bool OTPActive map[string]bool // contains filtered or unexported fields }
func NewAuthenticator ¶
func NewAuthenticator(_type string, secretLength int) (*Authenticator, error)
func (*Authenticator) Active ¶
func (a *Authenticator) Active(id string)
func (*Authenticator) AddSecret ¶
func (a *Authenticator) AddSecret(id, secret string, update bool) (OTP, error)
func (*Authenticator) Close ¶
func (a *Authenticator) Close(id string)
func (*Authenticator) GetSecret ¶
func (a *Authenticator) GetSecret(id string) string
func (*Authenticator) Inactive ¶
func (a *Authenticator) Inactive(id string)
func (*Authenticator) IsActive ¶
func (a *Authenticator) IsActive(id string) bool
func (*Authenticator) IsOpen ¶
func (a *Authenticator) IsOpen(id string) bool
func (*Authenticator) Open ¶
func (a *Authenticator) Open(id string)
func (*Authenticator) URL ¶
func (a *Authenticator) URL(id, user, issuer string) string
func (*Authenticator) ValidSecret ¶
func (a *Authenticator) ValidSecret(id string) bool
type HOTP ¶
type HOTP struct { OTP googleauth.OTPConfig SecretLength int }
func (*HOTP) ValidSecret ¶
type TOTP ¶
type TOTP struct { OTP googleauth.OTPConfig SecretLength int }
func (*TOTP) ValidSecret ¶
Click to show internal directories.
Click to hide internal directories.