otp

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 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

func GetAccount(i Account) string

Types

type Account

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 interface {
	Encode(size int, level ...qrcode.RecoveryLevel) ([]byte, error)
	ToDataURL(size int, level ...qrcode.RecoveryLevel) (value string, err error)
}

func NewQR

func NewQR(data string) QRCode

type TOTP

type TOTP interface {
	Generate(ttime time.Time, digits Digits, seconds ...uint) (string, error)
	Validate(code string, digits Digits, seconds ...uint) (bool, error)
	ToURL() string
	QRCode() QRCode
}

func NewTOTP

func NewTOTP(opts Options) TOTP

Jump to

Keyboard shortcuts

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