auth

package
v0.0.0-...-bdd1cc4 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const MinPasswordLength = 7

Variables

View Source
var ErrEmptyPassword = errors.New("No password provided")
View Source
var ErrMissingLetterOrNumber = errors.New("Password must contain both letters and numbers")
View Source
var ErrPasswordTooShort = fmt.Errorf("Password must be at least %d characters", MinPasswordLength)

Functions

func CheckPasswordPolicy

func CheckPasswordPolicy(password string) error

CheckPasswordPolicy checks if a password meets the minimum requirements.

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      uuid.UUID
	Credentials map[string]bool
	Expires     int64
}

TokenMetadata struct to describe metadata in JWT.

func ExtractTokenMetadata

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

ExtractTokenMetadata func to extract metadata from JWT.

type Tokens

type Tokens struct {
	Access  string
	Refresh string
}

Tokens struct to describe tokens object.

func GenerateNewTokens

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