users

package
v0.0.0-...-625d9dc Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package users contains handler implementations of the ./internal/api/restapi/operations/user

Index

Constants

View Source
const (
	// SaltLen length of the password hash prefix.
	SaltLen int = 16
)

Variables

This section is empty.

Functions

func CheckPass

func CheckPass(passHash []byte, plainPassword string) bool

CheckPass compare hash and string password.

func HashPass

func HashPass(salt []byte, plainPassword string) []byte

HashPass calculate password hash with salt.

func MakeSalt

func MakeSalt(n int) []byte

MakeSalt ... nolint:errcheck

func NewCreateUserHandler

func NewCreateUserHandler(repo RepoInterface, tm token.Manager) user.CreateUserHandler

NewCreateUserHandler builder for user.CreateUserHandler interface implementation.

func NewLoginUserHandler

func NewLoginUserHandler(repo RepoInterface, tm token.Manager, expDelay time.Duration) user.LoginUserHandler

NewLoginUserHandler builder for user.LoginUserHandler interface implementation.

func NewLogoutUserHandler

func NewLogoutUserHandler(expDelay time.Duration) user.LogoutUserHandler

NewLogoutUserHandler builder for user.LogoutUserHandler interface implementation.

Types

type RepoInterface

type RepoInterface interface {
	StoreUser(ctx context.Context, user *models.User, passwordHash []byte) (*models.User, error)
	FindUserByLogin(ctx context.Context, login string) (*models.User, []byte, error)
}

RepoInterface users repository behavior.

Jump to

Keyboard shortcuts

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