totpmdl

package
v1.2.15 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TOTPGenerate

type TOTPGenerate struct {
	// Name of the issuing Organization/Company/application.
	Issuer string
	// Name of the User's Account (eg, email address)
	AccountName string
	// Number of seconds a TOTP hash is valid for. Defaults to 30 seconds.
	Period uint
	// Size in size of the generated Secret. Defaults to 20 bytes.
	SecretSize uint
	// Secret to store. Defaults to a randomly generated secret of SecretSize.  You should generally leave this empty.
	// Secret []byte
	// Digits to request. Defaults to 6.
	Digits otp.Digits
	// Algorithm to use for HMAC. Defaults to SHA1.
	Algorithm otp.Algorithm
}

func (*TOTPGenerate) CreateSecretKey

func (t *TOTPGenerate) CreateSecretKey() (*otp.Key, error)

create totp secret key

func (*TOTPGenerate) NewQR

func (t *TOTPGenerate) NewQR(key *otp.Key) ([]byte, error)

generate QR

type TOTPValidate

type TOTPValidate struct {
	//OTP Generated by authenticator application
	Token string
	//secret key
	Secret string
	// Number of seconds a TOTP hash is valid for. Defaults to 30 seconds.
	Period uint
	// Periods before or after the current time to allow.  Value of 1 allows up to Period
	// of either side of the specified time.  Defaults to 0 allowed skews.  Values greater
	// than 1 are likely sketchy.
	Skew uint
	// Digits to request. Defaults to 6.
	Digits otp.Digits
	// Algorithm to use for HMAC. Defaults to SHA1.
	Algorithm otp.Algorithm
}

func (*TOTPValidate) ValidateTOTP

func (v *TOTPValidate) ValidateTOTP() (bool, error)

validate totp code

Jump to

Keyboard shortcuts

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