totp

package
v4.33.1 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2021 License: Apache-2.0 Imports: 5 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 *models.TOTPConfiguration, err error)
	GenerateCustom(username, algorithm string, digits, period, secretSize uint) (config *models.TOTPConfiguration, err error)
	Validate(token string, config *models.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 *models.TOTPConfiguration, err error)

Generate generates a TOTP with default options.

func (TimeBased) GenerateCustom

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

GenerateCustom generates a TOTP with custom options.

func (TimeBased) Validate

func (p TimeBased) Validate(token string, config *models.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