auth

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultArgon2Params = Argon2Params{
	Memory:      64 * 1024,
	Iterations:  3,
	Parallelism: 2,
	SaltLength:  16,
	KeyLength:   32,
}

TODO: 1- import conf from env TODO: 2- read more about effects of this config TODO: 3- use a wrapper pkg to use Argon2

Functions

func GenerateHash

func GenerateHash(password string, p Argon2Params) (string, error)

func GenerateToken

func GenerateToken(username, secret_key string) (string, error)

generating JWT for user

func ValidateToken

func ValidateToken(token_str, secret_key string) (jwt.MapClaims, error)

validating tokens

func VerifyPassword

func VerifyPassword(encoded, password string) (bool, error)

Types

type Argon2Params

type Argon2Params struct {
	Memory      uint32
	Iterations  uint32
	Parallelism uint8
	SaltLength  uint32
	KeyLength   uint32
}

Jump to

Keyboard shortcuts

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