Documentation
¶
Index ¶
- type GoogleAuthenticator
- func (g *GoogleAuthenticator) CreateSecret() (string, error)
- func (g *GoogleAuthenticator) GenerateQRCode(title string, secret string) (base64QR string, err error)
- func (g *GoogleAuthenticator) GetCode(secret string, ts ...int64) (string, error)
- func (g *GoogleAuthenticator) VerifyCode(secret string, code string, discrepancy int, ts ...int64) bool
- type GoogleAuthenticatorConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GoogleAuthenticator ¶
type GoogleAuthenticator struct {
// contains filtered or unexported fields
}
func NewGoogleAuthenticator ¶
func NewGoogleAuthenticator(codeLength, secretLength int) *GoogleAuthenticator
NewGoogleAuthenticator constructor
func (*GoogleAuthenticator) CreateSecret ¶
func (g *GoogleAuthenticator) CreateSecret() (string, error)
CreateSecret in TOTP
func (*GoogleAuthenticator) GenerateQRCode ¶
func (g *GoogleAuthenticator) GenerateQRCode(title string, secret string) (base64QR string, err error)
GenerateQRCode png and encode to base64
func (*GoogleAuthenticator) GetCode ¶
func (g *GoogleAuthenticator) GetCode(secret string, ts ...int64) (string, error)
GetCode in TOTP with secret and time
func (*GoogleAuthenticator) VerifyCode ¶
func (g *GoogleAuthenticator) VerifyCode(secret string, code string, discrepancy int, ts ...int64) bool
VerifyCode checks if the given code is valid for the provided secret and error range
Click to show internal directories.
Click to hide internal directories.