otp

package
v0.0.0-...-ef937ea Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTOTPStruct

func NewTOTPStruct(cfg *platformConfig.Config, logger log.Logger) totpPkg.Totp

Types

type TotpStruct

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

func (TotpStruct) EncodeQuery

func (totp TotpStruct) EncodeQuery(v url.Values) string

func (TotpStruct) Generate

func (totp TotpStruct) Generate(opts config.GenerateOpts) (*string, *string, error)

func (TotpStruct) GenerateCode

func (totp TotpStruct) GenerateCode(secret string, t time.Time) (string, error)

GenerateCode creates a TOTP token using the current time. A shortcut for GenerateCodeCustom, GenerateCode uses a configuration that is compatible with Google-Authenticator and most clients.

func (TotpStruct) GenerateCodeCustom

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

GenerateCodeCustom takes a timepoint and produces a passcode using a secret and the provided opts. (Under the hood, this is making an adapted call to hotp.GenerateCodeCustom)

func (TotpStruct) Validate

func (totp TotpStruct) Validate(passcode string, secret string) bool

Validate a TOTP using the current time. A shortcut for ValidateCustom, Validate uses a configuration that is compatible with Google-Authenticator and most clients.

func (TotpStruct) ValidateCustom

func (totp TotpStruct) ValidateCustom(passcode string, secret string, t time.Time, opts config.ValidateOpts) (bool, error)

ValidateCustom validates a TOTP given a user specified time and custom options. Most users should use Validate() to provide an interpolatable TOTP experience.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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