user

package
v0.0.0-...-e91a5b0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Timeouts = map[TokenType]time.Duration{
	JWT:      time.Second * 60 * 1000,
	REFRESH:  time.Second * 60 * 60 * 24 * 7,
	Register: time.Second * 60 * 60 * 2,
}

Functions

func GenerateSalt

func GenerateSalt(length int) (string, error)

func GetPayloadFromToken

func GetPayloadFromToken(tokenString string) (string, error)

func GetUserIdFromToken

func GetUserIdFromToken(tokenString string) (int64, error)

func IsValidPassword

func IsValidPassword(password string) (valid bool, err error)

func NewUserService

func NewUserService(registry registry.ServiceRegistry)

Types

type TokenType

type TokenType string
const (
	JWT      TokenType = "JWT"
	REFRESH  TokenType = "Refresh"
	Register TokenType = "Register"
)

type UserService

type UserService struct {
	user.UserService
	// contains filtered or unexported fields
}

func (*UserService) DeleteUser

func (us *UserService) DeleteUser(ctx context.Context, req *user.DeleteUserRequest) error

func (*UserService) GetCurrentUser

func (us *UserService) GetCurrentUser(ctx context.Context) (*user.GetCurrentUserResponse, error)

func (*UserService) GetUser

func (us *UserService) GetUser(ctx context.Context, id int64) (*user.GetUserResponse, error)

func (*UserService) GetUserByKeyWord

func (us *UserService) GetUserByKeyWord(ctx context.Context, keyword string) ([]*user.GetUserResponse, error)

func (*UserService) Login

func (*UserService) Logout

func (*UserService) Logout(ctx context.Context) error

func (*UserService) RefreshToken

func (*UserService) RefreshToken(ctx context.Context, token string) (string, error)

func (*UserService) Register

func (us *UserService) Register(ctx context.Context, req *user.RegisterRequest) error

func (*UserService) UpdateUser

func (us *UserService) UpdateUser(ctx context.Context, req *user.UpdateUserRequest) error

func (*UserService) ValidateToken

func (*UserService) ValidateToken(ctx context.Context, token string) (int64, error)

Jump to

Keyboard shortcuts

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