totp

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2023 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)

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
}

Jump to

Keyboard shortcuts

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