totp

package
v4.36.8 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider interface {
	Generate(username string) (config *model.TOTPConfiguration, err error)
	GenerateCustom(username string, algorithm, secret string, digits, period, secretSize uint) (config *model.TOTPConfiguration, err error)
	Validate(token string, config *model.TOTPConfiguration) (valid bool, err error)
}

Provider for TOTP functionality.

type TimeBased

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

TimeBased totp.Provider for production use.

func NewTimeBasedProvider

func NewTimeBasedProvider(config schema.TOTPConfiguration) (provider *TimeBased)

NewTimeBasedProvider creates a new totp.TimeBased which implements the totp.Provider.

func (TimeBased) Generate

func (p TimeBased) Generate(username string) (config *model.TOTPConfiguration, err error)

Generate generates a TOTP with default options.

func (TimeBased) GenerateCustom

func (p TimeBased) GenerateCustom(username, algorithm, secret string, digits, period, secretSize uint) (config *model.TOTPConfiguration, err error)

GenerateCustom generates a TOTP with custom options.

func (TimeBased) Validate

func (p TimeBased) Validate(token string, config *model.TOTPConfiguration) (valid bool, err error)

Validate the token against the given configuration.

Jump to

Keyboard shortcuts

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