auth

package
v0.0.0-...-a0bf825 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) error

CheckPasswordHash compares a plain text password with a hashed password

func GetAPIKey

func GetAPIKey(headers http.Header) (string, error)

GetAPIKey extracts the API key from the Authorization header.

func GetBearerToken

func GetBearerToken(headers http.Header) (string, error)

func HashPassword

func HashPassword(password string) (string, error)

HashPassword takes a plain text password and returns a hashed version

func MakeJWT

func MakeJWT(userID uuid.UUID, tokenSecret string, expiresIn time.Duration) (string, error)

func MakeRefreshToken

func MakeRefreshToken() (string, error)

MakeRefreshToken generates a secure random 256-bit (32-byte) hex-encoded string.

func TestGetBearerToken

func TestGetBearerToken(t *testing.T)

func TestHashPassword

func TestHashPassword(t *testing.T)

func TestJWTCreationAndValidation

func TestJWTCreationAndValidation(t *testing.T)

func ValidateJWT

func ValidateJWT(tokenString, tokenSecret string) (uuid.UUID, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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