Documentation ¶
Overview ¶
Package services provides different services which combine functions from modules and the store interface
Index ¶
- Variables
- type AuthService
- func (s AuthService) ComparePassword(input, hashed string) (bool, error)
- func (s AuthService) GenerateTOTP(issuer, account string) (twofa.TOTPKey, error)
- func (s AuthService) GenerateVerifyToken() (string, error)
- func (s AuthService) HashPassword(password string) (string, error)
- func (s AuthService) Login(c echo.Context) (string, error)
- func (s AuthService) NewJWT(secret string, c *jwt.Claims) *jwt.JWT
- func (s AuthService) ParseJWT(input, key string, c jwt.Claims) (*jwt.JWT, error)
- func (s AuthService) Register(c echo.Context) error
- func (s AuthService) ValidateTOTP(code, secret string) bool
- type CallService
- type InviteService
- type RoomService
- type ServerService
- func (s ServerService) CreateServer(c echo.Context) error
- func (s ServerService) DeleteServer(hash string) error
- func (s ServerService) GetServer(c echo.Context) (*models.Server, error)
- func (s ServerService) GetServers() ([]models.Server, error)
- func (s ServerService) UpdateServer(hash string) error
- type UserService
- func (s UserService) CreateUser(user models.PublicUser) error
- func (s UserService) GetUser(username string) (models.User, error)
- func (s UserService) GetUserPublicKey(username string) (string, error)
- func (s UserService) PutUserServer(username string) ([]models.Server, error)
- func (s UserService) UpdateTwoFAVerify(username, verify string) error
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type AuthService ¶
type AuthService struct {
// contains filtered or unexported fields
}
AuthService wraps authentication dependencies
func NewAuthService ¶
NewAuthService returns a new authentication service
func (AuthService) ComparePassword ¶
func (s AuthService) ComparePassword(input, hashed string) (bool, error)
ComparePassword returns if the input and the real password match
func (AuthService) GenerateTOTP ¶
func (s AuthService) GenerateTOTP(issuer, account string) (twofa.TOTPKey, error)
GenerateTOTP generates a new TOTP
func (AuthService) GenerateVerifyToken ¶
func (s AuthService) GenerateVerifyToken() (string, error)
GenerateVerifyToken generates a random verify token
func (AuthService) HashPassword ¶
func (s AuthService) HashPassword(password string) (string, error)
HashPassword returns the Argon2-hashed password or an error
func (AuthService) Login ¶
func (s AuthService) Login(c echo.Context) (string, error)
Login handles the login process of a user
func (AuthService) NewJWT ¶
NewJWT returns a new JWT
func (AuthService) ParseJWT ¶
ParseJWT parses a JWT
func (AuthService) Register ¶
func (s AuthService) Register(c echo.Context) error
Register handles the registration process of a new user
func (AuthService) ValidateTOTP ¶
func (s AuthService) ValidateTOTP(code, secret string) bool
ValidateTOTP validates a 6 digit TOTP code
type CallService ¶
type CallService struct {
// contains filtered or unexported fields
}
func NewCallService ¶
func NewCallService() CallService
func (CallService) NewCall ¶
func (s CallService) NewCall(username, roomHash string, w http.ResponseWriter, r *http.Request) error
type InviteService ¶
type InviteService struct {
// contains filtered or unexported fields
}
InviteService provides a service to create, get and delete invites
func NewInviteService ¶
NewInviteService returns a new invite service
type RoomService ¶
type RoomService struct {
// contains filtered or unexported fields
}
RoomService provides a service to create, get, update and delete rooms
func NewRoomService ¶
func NewRoomService(store *store.Store, logger *log.Logger) RoomService
NewRoomService returns a new room service
func (RoomService) CreateRoom ¶
func (s RoomService) CreateRoom(c echo.Context) error
CreateRoom creates and inserts a new room into the database
func (RoomService) DeleteRoom ¶
func (s RoomService) DeleteRoom(c echo.Context) error
DeleteRoom deletes ONE room from the database identified by the provided room hash
func (RoomService) GetRoom ¶
func (s RoomService) GetRoom(c echo.Context) (*models.Room, error)
GetRoom returns ONE room from the database identified by the provided hash
func (RoomService) GetRooms ¶
func (s RoomService) GetRooms() ([]models.Room, error)
GetRooms returns multiple rooms from the database
func (RoomService) UpdateRoom ¶
func (s RoomService) UpdateRoom(c echo.Context) error
UpdateRoom updates ONE room in the database indentified by the provided hash
type ServerService ¶
type ServerService struct {
// contains filtered or unexported fields
}
ServerService wraps dependencies
func NewServerService ¶
func NewServerService(store *store.Store, logger *log.Logger) ServerService
NewServerService returns a new server service
func (ServerService) CreateServer ¶
func (s ServerService) CreateServer(c echo.Context) error
CreateServer creates a new virtual server
func (ServerService) DeleteServer ¶
func (s ServerService) DeleteServer(hash string) error
DeleteServer deletes one virtual server dentified by 'hash'
func (ServerService) GetServer ¶
func (s ServerService) GetServer(c echo.Context) (*models.Server, error)
GetServer returns one virtual server identified by 'hash'
func (ServerService) GetServers ¶
func (s ServerService) GetServers() ([]models.Server, error)
GetServers returns all virtual servers
func (ServerService) UpdateServer ¶
func (s ServerService) UpdateServer(hash string) error
UpdateServer updates one virtual server identified by 'hash'
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
UserService is the top-level service struct
func NewUserService ¶
func NewUserService(s *store.Store, c *config.Config) UserService
NewUserService returns a new user service
func (UserService) CreateUser ¶
func (s UserService) CreateUser(user models.PublicUser) error
CreateUser creates a new 'user' or returns an error if the new user could not be created
func (UserService) GetUser ¶
func (s UserService) GetUser(username string) (models.User, error)
GetUser returns a user identified by the provided 'username' or an error if the user does not exist
func (UserService) GetUserPublicKey ¶
func (s UserService) GetUserPublicKey(username string) (string, error)
func (UserService) PutUserServer ¶
func (s UserService) PutUserServer(username string) ([]models.Server, error)
func (UserService) UpdateTwoFAVerify ¶
func (s UserService) UpdateTwoFAVerify(username, verify string) error