otp

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSecretKey

func GenerateSecretKey(opts *Options) (err error)

func GetAccount added in v1.3.2

func GetAccount(i Account) string

Types

type Account added in v1.3.2

type Account interface {
	OTPAccount() string
}

type Digits

type Digits otp.Digits
const (
	DigitsSix   Digits = Digits(otp.DigitsSix)
	DigitsEight Digits = Digits(otp.DigitsEight)
)

type Options

type Options struct {
	Issuer  string
	Account string
	Secret  string
}

type QRCode

type QRCode struct {
	// contains filtered or unexported fields
}

func NewQR

func NewQR(data string) *QRCode

func (*QRCode) Encode

func (q *QRCode) Encode(size int, level ...qrcode.RecoveryLevel) ([]byte, error)

func (*QRCode) ToDataURL

func (q *QRCode) ToDataURL(size int, level ...qrcode.RecoveryLevel) (value string, err error)

type TOTP

type TOTP struct {
	// contains filtered or unexported fields
}

func NewTOTP

func NewTOTP(opts Options) *TOTP

func (*TOTP) Generate

func (t *TOTP) Generate(ttime time.Time, digits Digits, seconds ...uint) (string, error)

func (*TOTP) QRCode

func (t *TOTP) QRCode() *QRCode

func (*TOTP) ToURL

func (t *TOTP) ToURL() string

func (*TOTP) Validate

func (t *TOTP) Validate(code string, digits Digits, seconds ...uint) (bool, error)

Jump to

Keyboard shortcuts

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