totp

package
v0.0.0-...-aff8de1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateCode

func GenerateCode(secret string, t time.Time) (passcode string, err error)

GenerateCode generates and returns passcode.

func GenerateCodeCustom

func GenerateCodeCustom(secret string, t time.Time, opts ValidateOpts) (passcode string, err error)

func GenerateTotpKey

func GenerateTotpKey(opts GenerateOpts) (key *gotp.Key, err error)

func ValidateCode

func ValidateCode(passcode string, secret string) bool

func ValidateCodeCustom

func ValidateCodeCustom(passcode string, secret string, t time.Time, opts ValidateOpts) (result bool, err error)

Types

type GenerateOpts

type GenerateOpts struct {
	Issuer      string
	AccountName string
	Period      uint
	SecretSize  uint
	Secret      []byte
	Digits      gotp.Digits
	Algorithm   gotp.Algorithm
	Rand        io.Reader
}

type ValidateOpts

type ValidateOpts struct {
	Period    uint
	Window    uint
	Digits    gotp.Digits
	Algorithm gotp.Algorithm
}

ValidateOpts is the type used to handling options of TOTP validate.

Jump to

Keyboard shortcuts

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