utils

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComparePasswords added in v1.2.0

func ComparePasswords(hashedPwd, inputPwd string) bool

ComparePasswords func for a comparing password.

func ConnectionURLBuilder added in v1.2.0

func ConnectionURLBuilder(n string) (string, error)

ConnectionURLBuilder func for building URL connection.

func GeneratePassword added in v1.2.0

func GeneratePassword(p string) string

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

func GetCredentialsByRole added in v1.2.0

func GetCredentialsByRole(role string) ([]string, error)

GetCredentialsByRole func for getting credentials from a role name.

func NewValidator added in v1.2.0

func NewValidator() *validator.Validate

NewValidator func for create a new validator for model fields.

func NormalizePassword added in v1.2.0

func NormalizePassword(p string) []byte

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

func ParseRefreshToken added in v1.2.0

func ParseRefreshToken(refreshToken string) (int64, error)

ParseRefreshToken func for parse second argument from refresh token.

func StartServer added in v1.2.0

func StartServer(a *fiber.App)

StartServer func for starting a simple server.

func StartServerWithGracefulShutdown

func StartServerWithGracefulShutdown(a *fiber.App)

StartServerWithGracefulShutdown function for starting server with a graceful shutdown.

func ValidatorErrors

func ValidatorErrors(err error) map[string]string

ValidatorErrors func for show validation errors for each invalid fields.

func VerifyRole added in v1.2.0

func VerifyRole(role string) (string, error)

VerifyRole func for verifying a given role.

Types

type TokenMetadata added in v1.2.0

type TokenMetadata struct {
	UserID      uuid.UUID
	Credentials map[string]bool
	Expires     int64
}

TokenMetadata struct to describe metadata in JWT.

func ExtractTokenMetadata added in v1.2.0

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

ExtractTokenMetadata func to extract metadata from JWT.

type Tokens added in v1.2.0

type Tokens struct {
	Access  string
	Refresh string
}

Tokens struct to describe tokens object.

func GenerateNewTokens added in v1.2.0

func GenerateNewTokens(id string, credentials []string) (*Tokens, error)

GenerateNewTokens func for generate a new Access & Refresh tokens.

Jump to

Keyboard shortcuts

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