totp

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateTOTP

func GenerateTOTP(opts Opts) (code string)

Generate a TOTP

func GenerateTOTPFromOTPAuth

func GenerateTOTPFromOTPAuth(otpAuth string, timestamp string) (label string, code string, err error)

Types

type Algo

type Algo int
const (
	Invalid Algo = iota
	SHA1
	SHA256
	SHA512
)

type Opts

type Opts struct {
	// the number of seconds between generating TOTPs. A default timestep of 30 seconds is recommended
	Timestep uint
	// The shared secret
	Secret []byte
	// Number of Digits required
	Digits uint
	// the algorithm to use
	Algorithm Algo
	// For testing purposes, the current Unix time
	CurrentUnixTime uint64
}

func (Opts) Algo

func (o Opts) Algo() func() hash.Hash

Jump to

Keyboard shortcuts

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