mfa

package
v6.0.0-...-cfe9101 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: AGPL-3.0, Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InvalidToken = errors.New("invalid mfa token")

InvalidToken indicates the case where the token validation has failed.

Functions

This section is empty.

Types

type MFA

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

func New

func New(store Store) *MFA

func (*MFA) Activate

func (m *MFA) Activate(userMfaSecret, userID string, token string) error

Activate set the mfa as active and store it with the StoreActive function provided

func (*MFA) Deactivate

func (m *MFA) Deactivate(userId string) error

Deactivate set the mfa as deactivated, remove the mfa secret, store it with the StoreActive and StoreSecret functions provided

func (*MFA) GenerateSecret

func (m *MFA) GenerateSecret(siteURL, userEmail, userID string) (string, []byte, error)

GenerateSecret generates a new user mfa secret and store it with the StoreSecret function provided

func (*MFA) ValidateToken

func (m *MFA) ValidateToken(secret, token string) (bool, error)

Validate the provide token using the secret provided

type Store

type Store interface {
	UpdateMfaActive(userId string, active bool) error
	UpdateMfaSecret(userId, secret string) error
}

Jump to

Keyboard shortcuts

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