auth

package
v0.0.0-...-8cb3723 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JWT

type JWT interface {
	GenerateToken(*model.User) (string, string, error)
}

JWT represents jwt interface

type Service

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

Service represents the auth application service

func NewAuthService

func NewAuthService(userRepo model.UserRepo, accountRepo model.AccountRepo, jwt JWT, m mail.Service, mob mobile.Service, mag magic.Service) *Service

NewAuthService creates new auth service

func (*Service) Authenticate

func (s *Service) Authenticate(c context.Context, email, password string) (*model.LoginResponseWithToken, error)

Authenticate tries to authenticate the user provided by username and password

func (*Service) Forgot

func (s *Service) Forgot(c *gin.Context, email string) error

Send pin for forgot password

func (*Service) Magic

Magic returns any error from creating a new user in our database with a magic link

func (*Service) Mobile

func (s *Service) Mobile(c *gin.Context, m *request.MobileSignup) error

Mobile returns any error from creating a new user in our database with a mobile number

func (*Service) MobileVerify

func (s *Service) MobileVerify(c context.Context, countryCode, mobile, code string, signup bool) (*model.AuthToken, error)

MobileVerify verifies the mobile verification code, i.e. (6-digit) code

func (*Service) RecoverPassword

func (s *Service) RecoverPassword(c *gin.Context, email string, otp string, password string) error

Verify OTP and recover password

func (*Service) RefVerify

func (s *Service) RefVerify(c context.Context, referralCode string) (*model.ReferralCodeVerifyResponse, error)

RefVerify verifies the referral code

func (*Service) Refresh

func (s *Service) Refresh(c context.Context, refreshToken string) (*model.RefreshToken, error)

Refresh refreshes jwt token and puts new claims inside

func (*Service) Signup

func (s *Service) Signup(c *gin.Context, e *request.EmailSignup, password string) (*model.LoginResponseWithToken, error)

Signup returns any error from creating a new user in our database

func (*Service) User

func (s *Service) User(c *gin.Context) *model.AuthUser

User returns user data stored in jwt token

func (*Service) Verify

func (s *Service) Verify(c context.Context, token string) error

Verify verifies the (verification) token and deletes it

Jump to

Keyboard shortcuts

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