Documentation ¶
Index ¶
- Variables
- type AuthUsecase
- func (uc *AuthUsecase) ComparePassword(ctx context.Context, email, pass string) (*User, error)
- func (uc *AuthUsecase) CreateUser(ctx context.Context, u *User) (*User, error)
- func (uc *AuthUsecase) GetIdFromRefresh(ctx context.Context, refresh string) (int64, error)
- func (uc *AuthUsecase) Identity(ctx context.Context, access string) (int64, error)
- func (uc *AuthUsecase) NewTokens(ctx context.Context, userId int64) (*v1.Tokens, error)
- type User
- type UserRepo
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUserNotFound = status.Errorf(codes.NotFound, "reason: %v", v1.ErrorReason_USER_NOT_FOUND.String()) ErrUserAlreadyExists = status.Errorf(codes.AlreadyExists, "reason: %v", v1.ErrorReason_USER_ALREADY_EXISTS.String()) ErrWrongPassword = status.Errorf(codes.PermissionDenied, "reason: %v", v1.ErrorReason_WRONG_PASSWORD.String()) ErrInvalidToken = status.Errorf(codes.Unauthenticated, "reason: %v", v1.ErrorReason_INVALID_TOKEN.String()) )
View Source
var ProviderSet = wire.NewSet(NewAuthUsecase)
ProviderSet is biz providers.
Functions ¶
This section is empty.
Types ¶
type AuthUsecase ¶
type AuthUsecase struct {
// contains filtered or unexported fields
}
AuthUsecase is an Auth usecase.
func NewAuthUsecase ¶
func NewAuthUsecase(repo UserRepo, logger log.Logger, hasher hash.PasswordHasher, tokenMaker paseto.TokenMaker) *AuthUsecase
NewAuthUsecase new an Auth usecase.
func (*AuthUsecase) ComparePassword ¶
ComparePassword compare pass with the one saved in db
func (*AuthUsecase) CreateUser ¶
CreateUser save new user to db
func (*AuthUsecase) GetIdFromRefresh ¶
GetIdFromRefresh parse refresh token & return user id
Click to show internal directories.
Click to hide internal directories.