core

package
v0.0.0-...-a49029b Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// auth
	ErrUserAlreadyExists  = errors.New("user already exists")
	ErrInvalidAuthConfig  = errors.New("invalid secret")
	ErrInvalidCredentials = errors.New("invalid credentials")
	ErrUnauthorized       = errors.New("unauthorized")
)

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {
	Secret   string
	TokenTTL int
}

type AuthService

type AuthService interface {
	Login(ctx context.Context, user User) (*string, error)
	Signup(ctx context.Context, user User) error
	UpdatePassword(ctx context.Context, user User) error
}

type User

type User struct {
	ID           int
	Username     string
	PasswordHash string
}

type UserStore

type UserStore interface {
	AddUser(ctx context.Context, user User) (userID int, err error)
	GetUserByUsername(ctx context.Context, username string) (user *User, err error)
	UpdateUser(ctx context.Context, user User) (userID int, err error)
}

Jump to

Keyboard shortcuts

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