logic

package
v0.0.0-...-9d184c9 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PasswordCost       = 13
	ScopeAccess        = "access"
	ScopeActivation    = "activation"
	ScopePasswordReset = "password-reset"
	ScopeRefresh       = "refresh"
)

Variables

View Source
var (
	ErrActivationRequired   = errors.New("user account must be activated")
	ErrEditConflict         = errors.New("unable to update the record due to an edit conflict")
	ErrEmailNotFound        = errors.New("no matching email address found")
	ErrInvalidAccessToken   = errors.New("invalid access token")
	ErrInvalidCredentials   = errors.New("invalid authentication credentials")
	ErrInvalidToken         = errors.New("invalid or missing token")
	ErrMessageNotFound      = errors.New("no matching message found")
	ErrReusedRefreshToken   = errors.New("reused refresh token")
	ErrServerError          = errors.New("the server encountered a problem and could not process your request")
	ErrUserAlreadyActivated = errors.New("user has already been activated")
	ErrUserExists           = errors.New("a user with this email address already exists")
)

Functions

func ActivateUser

func ActivateUser(ctx context.Context, q *data.Queries, plaintext string) (*api.UserResponse, error)

func DeleteMessage

func DeleteMessage(ctx context.Context, q *data.Queries, mid, uid int64) (*api.AcceptanceResponse, error)

func GetMessage

func GetMessage(ctx context.Context, q *data.Queries, mid, uid int64) (*api.MessageResponse, error)

func GetUserMessages

func GetUserMessages(ctx context.Context, q *data.Queries, page, pageSize int32, userID int64) (*api.MessagesResponse, error)

func NewAccessToken

func NewAccessToken(ctx context.Context, q *data.Queries, tokenFromCookie string) (refresh, access *api.TokenResponse, err error)

func NewActivationToken

func NewActivationToken(ctx context.Context, q *data.Queries, email string) (*api.TokenResponse, error)

func NewMessage

func NewMessage(ctx context.Context, q *data.Queries, m string, userID int64) (*api.MessageResponse, error)

func NewPasswordResetToken

func NewPasswordResetToken(ctx context.Context, q *data.Queries, email string) (*api.TokenResponse, error)

func NewRefreshToken

func NewRefreshToken(ctx context.Context, q *data.Queries, email, pass string) (refresh, access *api.TokenResponse, err error)

func NewUser

func NewUser(ctx context.Context, q *data.Queries, name, email, pass string) (*api.UserResponse, *api.TokenResponse, error)

func UpdateMessage

func UpdateMessage(ctx context.Context, q *data.Queries, m string, mid, uid int64) (*api.MessageResponse, error)

func UpdateUserPassword

func UpdateUserPassword(ctx context.Context, q *data.Queries, token, pass string) (*api.AcceptanceResponse, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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