Versions in this module Expand all Collapse all v0 v0.16.1 Dec 19, 2024 Changes in this version + const ScopeEmailVerification + const ScopeResetPassword + const ScopeUnsubscribe + var ErrEmailNotValidated = errors.New("user email not validated") + var ErrInvalidInput = errors.New("one or more of the provided inputs are not valid") + var ErrPasswordLength = errors.New("provided password has insufficient length") + var ErrPasswordMatchConfirm = errors.New("provided password does not match confirm password") + var ErrPasswordNotMatch = errors.New("provided password does not match our records") + var ErrTokenExpired = errors.New("token expired") + var ErrTokenNotExist = errors.New("the provided token does not exist") + var ErrTokenScopeInvalid = errors.New("the scope of the token was not what was expected") + var ErrUnrecoverable = errors.New("an unexpected error has occurred") + var ErrUserNotExist = errors.New("user have not been registered") + type Auth struct + func NewAuth(db psql.Postgres, email emailClient.EmailClient) Auth + func (a Auth) AuthenticateUser(ctx context.Context, email string, password string) error + func (a Auth) RegisterUser(ctx context.Context, name string, email string, password string, ...) error + func (a Auth) VerifyUserEmail(ctx context.Context, token string, scope string) error + type Token struct + func NewTokenSvc(db psql.Postgres, tokenSigningKey string) *Token + func (svc *Token) CreateResetPasswordToken(ctx context.Context, userID uuid.UUID) (string, error) + func (svc *Token) CreateSubscriberEmailValidation(ctx context.Context, subscriberID uuid.UUID) (string, error) + func (svc *Token) CreateUnsubscribeToken(ctx context.Context, subscriberID uuid.UUID) (string, error) + func (svc *Token) CreateUserEmailVerification(ctx context.Context, userID uuid.UUID) (string, error) + func (svc *Token) Delete(ctx context.Context, token string) error + func (svc *Token) GetAssociatedSubscriberID(ctx context.Context, token string) (uuid.UUID, error) + func (svc *Token) GetAssociatedUserID(ctx context.Context, token string) (uuid.UUID, error) + func (svc *Token) IsExpired(ctx context.Context, token string) error + func (svc *Token) Validate(ctx context.Context, token, scope string) error + type TokenMetaInformation struct + Resource string + ResourceID uuid.UUID + Scope string