otp

package
v2.0.61 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 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

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

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

func (*Auth) GetCode

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

GetCode 获取动态码

func (*Auth) GetQrcode

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

func (*Auth) GetSecret

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

GetSecret 获取秘钥

func (*Auth) ProvisionURI

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

func (*Auth) ProvisionURIWithIssuer

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

func (*Auth) VerifyCode

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