authenticator

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: MIT Imports: 18 Imported by: 3

README

authenticator

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyPassword = errors.New("empty password")
View Source
var ErrInvalid2FACode = errors.New("invalid two factor authentication code")
View Source
var ErrInvalidPassword = errors.New("invalid login credentials")
View Source
var ErrInvalidResetCode = errors.New("invalid reset code")
View Source
var ErrNotEnoughSystemEntropy = errors.New("not enough system entropy")
View Source
var ErrPasswordTooSimple = errors.New("password too simple")
View Source
var ErrTwoFactorNotConfigured = errors.New("two factor authentication not configured")

Functions

This section is empty.

Types

type Authenticator

type Authenticator interface {
	Authenticate(password string) error
}

type PasswordAuthenticator

type PasswordAuthenticator struct {
	Hasher           string     `json:"hasher"`
	HashedPassword   string     `json:"password"`
	ResetCode        *string    `json:"reset_code"`
	ResetCodeExpires *time.Time `json:"reset_code_expires"`
	// contains filtered or unexported fields
}

func NewPasswordAuthenticator

func NewPasswordAuthenticator(password string) (*PasswordAuthenticator, error)

func (*PasswordAuthenticator) Authenticate

func (auth *PasswordAuthenticator) Authenticate(password string) error

func (*PasswordAuthenticator) CheckResetCode

func (auth *PasswordAuthenticator) CheckResetCode(code string) error

func (*PasswordAuthenticator) IsDirty

func (auth *PasswordAuthenticator) IsDirty() bool

func (*PasswordAuthenticator) ResetPassword

func (auth *PasswordAuthenticator) ResetPassword(dur time.Duration) (string, error)

func (*PasswordAuthenticator) Scan

func (auth *PasswordAuthenticator) Scan(value interface{}) error

func (*PasswordAuthenticator) SetPassword

func (auth *PasswordAuthenticator) SetPassword(password string, inputs ...string) error

func (*PasswordAuthenticator) Value

func (auth *PasswordAuthenticator) Value() (driver.Value, error)

type TwoFactorAuthenticator

type TwoFactorAuthenticator struct {
	Domain       string   `json:"domain"`
	Username     string   `json:"username"`
	Secret       string   `json:"secret"`
	RecoveryKeys []string `json:"recovery_keys"`
	// contains filtered or unexported fields
}

func NewTwoFactorAuthenticator

func NewTwoFactorAuthenticator(username, domain string) (*TwoFactorAuthenticator, error)

func (*TwoFactorAuthenticator) Authenticate

func (auth *TwoFactorAuthenticator) Authenticate(code string) error

func (*TwoFactorAuthenticator) Configure

func (auth *TwoFactorAuthenticator) Configure() (*TwoFactorConfig, error)

func (*TwoFactorAuthenticator) ConsumeRecoveryKey

func (auth *TwoFactorAuthenticator) ConsumeRecoveryKey(code string) bool

func (*TwoFactorAuthenticator) GenCode

func (auth *TwoFactorAuthenticator) GenCode() string

func (*TwoFactorAuthenticator) IsDirty

func (auth *TwoFactorAuthenticator) IsDirty() bool

func (*TwoFactorAuthenticator) QRCode

func (auth *TwoFactorAuthenticator) QRCode() ([]byte, error)

func (*TwoFactorAuthenticator) QRCodeDataURI

func (auth *TwoFactorAuthenticator) QRCodeDataURI() (string, error)

func (*TwoFactorAuthenticator) Scan added in v0.0.3

func (auth *TwoFactorAuthenticator) Scan(value interface{}) error

func (*TwoFactorAuthenticator) URI

func (auth *TwoFactorAuthenticator) URI() string

func (*TwoFactorAuthenticator) Value added in v0.0.3

func (auth *TwoFactorAuthenticator) Value() (driver.Value, error)

type TwoFactorConfig

type TwoFactorConfig struct {
	Domain       string   `json:"domain"`
	Username     string   `json:"username"`
	URI          string   `json:"uri"`
	QRCode       string   `json:"qr_code"`
	RecoveryKeys []string `json:"recovery_keys"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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