domain

package
v0.0.0-...-28d87ae Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const LoginStatusInitialized = "initialized"
View Source
const MaxPasswordLen = 128
View Source
const MaxUsernameLen = 64
View Source
const MinPasswordLen = 16
View Source
const MinUsernameLen = 8

Variables

This section is empty.

Functions

func NewUser

func NewUser(username, email, password string) (*User, *Password, error)

func ValidateUsernameRequirements

func ValidateUsernameRequirements(username string) error

Types

type EmailInvalidError

type EmailInvalidError struct {
	Email string
}

func (EmailInvalidError) Error

func (e EmailInvalidError) Error() string

type Hasher

type Hasher interface {
	Hash(password string) (string, error)
	Verify(password, hash string) (bool, error)
}

type Login

type Login struct {
	ID          uuid.UUID
	RedirectURL url.URL
	Status      string
	Attempts    int
	CSRFToken   string
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

func NewLogin

func NewLogin(redirectURL url.URL, csrfToken string) *Login

type LoginNotFoundError

type LoginNotFoundError struct {
	Field string
	Value string
}

func (LoginNotFoundError) Error

func (e LoginNotFoundError) Error() string

type LoginRepo

type LoginRepo interface {
	GetByID(id uuid.UUID) (*Login, error)
	Create(login *Login) (*Login, error)
}

type Password

type Password string

func ValidatePasswordRequirements

func ValidatePasswordRequirements(password string) (*Password, error)

type PasswordInvalidLengthError

type PasswordInvalidLengthError struct{}

func (PasswordInvalidLengthError) Error

type User

type User struct {
	ID        uuid.UUID
	Username  string
	Email     string
	Enabled   bool
	CreatedAt time.Time
	UpdatedAt time.Time
}

type UserAlreadyExistsError

type UserAlreadyExistsError struct {
	Field string
	Value string
}

func (UserAlreadyExistsError) Error

func (e UserAlreadyExistsError) Error() string

type UserNotFoundError

type UserNotFoundError struct {
	Field string
	Value string
}

func (UserNotFoundError) Error

func (e UserNotFoundError) Error() string

type UserRepo

type UserRepo interface {
	Create(user *User, password *Password) (*User, error)
	GetByID(id uuid.UUID) (*User, error)
	GetByUsername(username string) (*User, error)
	VerifyPassword(username string, password string) (bool, error)
}

type UsernameInvalidError

type UsernameInvalidError struct{}

func (UsernameInvalidError) Error

func (e UsernameInvalidError) Error() string

Jump to

Keyboard shortcuts

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