totp

package
v0.0.0-...-475f6a8 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidCode   = errors.New("invalid code")
	ErrInvalidConfig = errors.New("invalid config")
)
View Source
var DefaultConfig = Config{
	// contains filtered or unexported fields
}

Functions

func Generate

func Generate(key Key, t time.Time, conf Config) (string, error)

func GenerateURL

func GenerateURL(key Key, issuer string, userName string, conf Config) (string, error)

func Verify

func Verify(key Key, code string, conf Config) error

Types

type Algorithm

type Algorithm uint8
const (
	HmacSHA1 Algorithm = iota
	HmacSHA256
	HmacSHA512
)

func (Algorithm) String

func (a Algorithm) String() (string, error)

type Config

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

func NewConfig

func NewConfig(algo Algorithm, currTimeFunc func() time.Time, digits int, validationSteps int) (Config, error)

type Key

type Key []byte

func (Key) Check

func (k Key) Check() error

func (Key) Encode

func (k Key) Encode() []byte

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳