auth

package
v0.0.0-...-92a3c75 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendEmail

func SendEmail(email string, hashEmail string) error

Types

type Auth

type Auth struct {
	// contains filtered or unexported fields
}

func NewAuth

func NewAuth(repo UserRepo, hash Hasher, cache CacheUsers, jwt *config.JWTConfig) *Auth

func (*Auth) ParseToken

func (a *Auth) ParseToken(token string) (int, error)

func (*Auth) RefreshTokens

func (a *Auth) RefreshTokens(refreshToken string) (string, string, error)

func (*Auth) SaveUser

func (a *Auth) SaveUser(hashEmail string) error

func (*Auth) SignIn

func (a *Auth) SignIn(userInfo *domain.SignIn) (string, string, error)

func (*Auth) SignUp

func (a *Auth) SignUp(userInfo *domain.SignUp) error

func (*Auth) UniqueEmail

func (a *Auth) UniqueEmail(email string) error

type CacheUsers

type CacheUsers interface {
	SaveUser(hashEmail string, userInfo *domain.SignUp) error
	UserByHash(hashEmail string) ([]string, error)
	Exists(hashEmail string) bool
}

type Hasher

type Hasher interface {
	Hash(string) (string, error)
}

type UserRepo

type UserRepo interface {
	UniqueEmail(email string) error
	SignUp(userInfo *domain.SignUp) error
	GetByCredentials(userInfo *domain.SignIn) (int, error)
	CreateRefreshToken(session domain.RefreshSession) error
	CredentialsByRefresh(refreshToken string) (int, time.Time, error)
}

Jump to

Keyboard shortcuts

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