account

package
v0.19.15 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONTENT_TYPE      = "Content-Type"
	CONTENT_TYPE_JSON = "application/json"
	AUTHORIZATION     = "Authorization"
)
View Source
const (
	PW_SALT_BYTES = 32
	PW_HASH_BYTES = 64
)

Variables

This section is empty.

Functions

func InitResource

func InitResource(router *gin.RouterGroup, path string, s service) (r resource, err error)

func InitService

func InitService(store StoreService, admin AdminService, session SessionService, ctx context.Context) (s service, err error)

Types

type AccountRegister

type AccountRegister struct {
	Username  string `json:"username"`
	Email     string `json:"email"`
	FirstName string `json:"firstname"`
	LastName  string `json:"lastname"`
	Number    string `json:"number"`
	Password  string `json:"password"`
}

type AdminService added in v0.11.0

type AdminService interface {
	Register(accountId uuid.UUID, rights Rights) (err error)
	Rights(accountId uuid.UUID) (p privilege.Privilege[Rights], err error)
}

type Crypt

type Crypt struct {
	Id  string `json:"id"`
	Key string `json:"key"`
}

type InternalLoggin

type InternalLoggin struct {
	AccountId uuid.UUID `json:"account_id"`
	Username  string    `json:"username"`
	Salt      []byte    `json:"salt"`
	Password  []byte    `json:"password"`
}

type Rights added in v0.15.0

type Rights struct {
	Weight float32 `json:"weight"`
	Admin  bool    `json:"admin"`
}

type SessionService

type SessionService interface {
	Create(accountId uuid.UUID) (accessToken session.AccessToken, err error)
	Renew(token string) (accessToken session.AccessToken, err error)
	Validate(token string) (accessToken session.AccessToken, accountId uuid.UUID, err error)
}

type StoreService

type StoreService interface {
	Register(account types.Account) (err error)
	Link(login types.Login) (err error)
	Accounts() (accounts []types.Account, err error)
	GetById(id uuid.UUID) (user types.Account, err error)
	GetLogin(username string) (login types.Login, err error)
	GetByUsername(username string) (user types.Account, err error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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