otp

package
v1.1.30 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth added in v0.3.6

type Auth struct {
	UTC       bool // use UTC for the timestamp instead of local time
	OTPIssuer string
	Logger    glog.ILogger
}

Auth is a one-time-password configuration. This object will be modified by calls to Authenticate and should be saved to ensure the codes are in fact only used once. GoogleAuthenticator

func NewAuth added in v0.3.6

func NewAuth(issuer string, utc bool, log glog.ILogger) *Auth

func (*Auth) GetCode added in v0.3.6

func (s *Auth) GetCode(secret string) (string, error)

GetCode 获取动态码

func (*Auth) GetQrcode added in v0.3.6

func (s *Auth) GetQrcode(url string) (string, error)

func (*Auth) GetSecret added in v0.3.6

func (s *Auth) GetSecret(ctx context.Context) string

GetSecret 获取秘钥

func (*Auth) ProvisionURI added in v0.3.6

func (s *Auth) ProvisionURI(user string, secret string) string

func (*Auth) ProvisionURIWithIssuer added in v0.3.6

func (s *Auth) ProvisionURIWithIssuer(user string, secret string, issuer string) string

func (*Auth) VerifyCode added in v0.3.6

func (s *Auth) VerifyCode(secret, code string) (bool, error)

VerifyCode 验证动态码

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL