utils

package
v0.0.0-...-dcfa3c0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const IntZero = 0

Variables

This section is empty.

Functions

func ComparePasswords

func ComparePasswords(hashedPwd, inputPwd string) bool

ComparePasswords func for a comparing password.

func GeneratePassword

func GeneratePassword(p string) string

GeneratePassword func for a making hash & salt with user password.

func NormalizePassword

func NormalizePassword(p string) []byte

NormalizePassword func for a returning the users input as a byte slice.

func ParseRefreshToken

func ParseRefreshToken(refreshToken string) (int64, error)

ParseRefreshToken func for parse second argument from refresh token.

Types

type TokenMetadata

type TokenMetadata struct {
	UserID            string
	Email             string
	UserRole          types.UserRole
	AdditionalDetails map[string]interface{}
	Expires           int64
}

func ExtractTokenMetadata

func ExtractTokenMetadata(c *fiber.Ctx) (*TokenMetadata, error)

type Tokens

type Tokens struct {
	Access  string
	Refresh string
}

Tokens struct to describe tokens object.

func GenerateNewTokens

func GenerateNewTokens(id string, email string, userRole types.UserRole, additionalDetails map[string]interface{}) (*Tokens, error)

GenerateNewTokens func for generate a new Access & Refresh tokens.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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