totp

package
v0.0.0-...-122f59b Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DependencySet = wire.NewSet(
	wire.Struct(new(Store), "*"),
	wire.Struct(new(Provider), "*"),
)
View Source
var ErrInvalidCode = errors.New("invalid code")
View Source
var InvalidTOTPSecret = apierrors.Invalid.WithReason("InvalidTOTPSecret")

Functions

func TranslateTOTPError

func TranslateTOTPError(err error) error

Types

type Provider

type Provider struct {
	Store  *Store
	Config *config.AuthenticatorTOTPConfig
	Clock  clock.Clock
}

func (*Provider) Authenticate

func (p *Provider) Authenticate(a *authenticator.TOTP, code string) error

func (*Provider) Create

func (p *Provider) Create(a *authenticator.TOTP) error

func (*Provider) Delete

func (p *Provider) Delete(a *authenticator.TOTP) error

func (*Provider) Get

func (p *Provider) Get(userID string, id string) (*authenticator.TOTP, error)

func (*Provider) GetMany

func (p *Provider) GetMany(ids []string) ([]*authenticator.TOTP, error)

func (*Provider) List

func (p *Provider) List(userID string) ([]*authenticator.TOTP, error)

func (*Provider) New

func (p *Provider) New(id string, userID string, totpSpec *authenticator.TOTPSpec, isDefault bool, kind string) (*authenticator.TOTP, error)

type Store

type Store struct {
	SQLBuilder  *appdb.SQLBuilderApp
	SQLExecutor *appdb.SQLExecutor
}

func (*Store) Create

func (s *Store) Create(a *authenticator.TOTP) (err error)

func (*Store) Delete

func (s *Store) Delete(id string) error

func (*Store) Get

func (s *Store) Get(userID string, id string) (*authenticator.TOTP, error)

func (*Store) GetMany

func (s *Store) GetMany(ids []string) ([]*authenticator.TOTP, error)

func (*Store) List

func (s *Store) List(userID string) ([]*authenticator.TOTP, error)

Jump to

Keyboard shortcuts

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