Documentation ¶
Index ¶
- func CheckPasswordHash(password, hash string) bool
- func ConstructVerificationLink(baseUrl, path, verificationToken string, email string) (string, error)
- func CreateVerificationToken() string
- func HashPassword(password string) (string, error)
- func InitVerificationTokenExpiryIndex(collection *mongo.Collection) error
- type AccessDetails
- type AccessTokenDetails
- type AccessTokenManager
- func (atm *AccessTokenManager) DeleteAccessToken(filter interface{}) error
- func (atm *AccessTokenManager) ExtractAccessTokenMetadata(token *jwt.Token) (*AccessDetails, error)
- func (atm *AccessTokenManager) FindAccessToken(uuid string) (*AccessDetails, error)
- func (atm *AccessTokenManager) GenerateAccessToken(userId primitive.ObjectID) (*AccessTokenDetails, error)
- func (atm *AccessTokenManager) SaveAccessToken(userId primitive.ObjectID, atd *AccessTokenDetails) error
- func (atm *AccessTokenManager) ValidateAccessToken(token string, secret string) (*jwt.Token, error)
- type ApiResponse
- type EmailManager
- type IAccessTokenManager
- type IEmailManager
- type IMiddlewareAccessTokenManager
- type IVerificationTokenManager
- type LoginReq
- type SignUpReq
- type StudentRegisteredTutorRes
- type VerificationToken
- type VerificationTokenManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPasswordHash ¶
func CreateVerificationToken ¶
func CreateVerificationToken() string
func HashPassword ¶
func InitVerificationTokenExpiryIndex ¶
func InitVerificationTokenExpiryIndex(collection *mongo.Collection) error
Types ¶
type AccessDetails ¶
type AccessTokenDetails ¶
type AccessTokenManager ¶
type AccessTokenManager struct {
// contains filtered or unexported fields
}
func NewTokenAccessManager ¶
func NewTokenAccessManager(accessTokenSecret string, accessTokenValidityInHours int64, db db.IDatabase) *AccessTokenManager
func (*AccessTokenManager) DeleteAccessToken ¶
func (atm *AccessTokenManager) DeleteAccessToken(filter interface{}) error
func (*AccessTokenManager) ExtractAccessTokenMetadata ¶
func (atm *AccessTokenManager) ExtractAccessTokenMetadata(token *jwt.Token) (*AccessDetails, error)
func (*AccessTokenManager) FindAccessToken ¶
func (atm *AccessTokenManager) FindAccessToken(uuid string) (*AccessDetails, error)
func (*AccessTokenManager) GenerateAccessToken ¶
func (atm *AccessTokenManager) GenerateAccessToken(userId primitive.ObjectID) (*AccessTokenDetails, error)
func (*AccessTokenManager) SaveAccessToken ¶
func (atm *AccessTokenManager) SaveAccessToken(userId primitive.ObjectID, atd *AccessTokenDetails) error
func (*AccessTokenManager) ValidateAccessToken ¶
func (atm *AccessTokenManager) ValidateAccessToken(token string, secret string) (*jwt.Token, error)
type ApiResponse ¶
type ApiResponse struct { Success bool `json:"success"` Message string `json:"message,omitempty"` Data interface{} `json:"data,omitempty"` Error interface{} `json:"error,omitempty"` }
func NewErrorResponse ¶
func NewErrorResponse(err interface{}, message string) ApiResponse
func NewSuccessResponse ¶
func NewSuccessResponse(data interface{}, message string) ApiResponse
type EmailManager ¶
func NewEmailManager ¶
func NewEmailManager(senderEmail, senderName, apiKey string) *EmailManager
func (*EmailManager) SendResetPasswordToken ¶
func (eu *EmailManager) SendResetPasswordToken(email, firstname, tokenUrl string) error
func (*EmailManager) SendSignUpVerificationToken ¶
func (eu *EmailManager) SendSignUpVerificationToken(email, firstname, tokenUrl string) error
type IAccessTokenManager ¶
type IAccessTokenManager interface { SaveAccessToken(userId primitive.ObjectID, atd *AccessTokenDetails) error GenerateAccessToken(userId primitive.ObjectID) (*AccessTokenDetails, error) DeleteAccessToken(filter interface{}) error }
type IEmailManager ¶
type IMiddlewareAccessTokenManager ¶
type IMiddlewareAccessTokenManager interface { ExtractAccessTokenMetadata(token *jwt.Token) (*AccessDetails, error) ValidateAccessToken(token string, secret string) (*jwt.Token, error) FindAccessToken(uuid string) (*AccessDetails, error) }
type VerificationToken ¶
type VerificationTokenManager ¶
type VerificationTokenManager struct { SignUpTokenValidityInSecs uint ForgotPasswordTokenValidityInSecs uint // contains filtered or unexported fields }
func NewVerificationTokenManager ¶
func NewVerificationTokenManager(db db.IDatabase, signUpTokenValidityInSecs uint, forgotPasswordTokenValidityInSecs uint) *VerificationTokenManager
func (*VerificationTokenManager) SaveVerificationToken ¶
func (vtm *VerificationTokenManager) SaveVerificationToken(email string, verificationToken string) error
func (*VerificationTokenManager) ValidateVerificationToken ¶
func (vtm *VerificationTokenManager) ValidateVerificationToken(email string, verificationToken string) (bool, error)
Click to show internal directories.
Click to hide internal directories.