auth

package
v0.0.0-...-ab15ff5 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoAuthHeaderIncluded = errors.New("not auth header included in request")

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) error

func GetApiKey

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

func GetBearerToken

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

GetBearerToken

func HashPassword

func HashPassword(password string) (string, error)

func MakeJWT

func MakeJWT(userID int, tokenSecret string, expiresIn time.Duration, tokenType TokenType) (string, error)

MakeJWT

func RefreshToken

func RefreshToken(tokenString, tokenSecret string) (string, error)

RefreshToken

func ValidateAPIKEY

func ValidateAPIKEY(tokenString, tokenSecret string) bool

ValidateAPIKEY

func ValidateJWT

func ValidateJWT(tokenString, tokenSecret string) (string, error)

ValidateJWT

Types

type TokenType

type TokenType string
const (
	// TokenTypeAccess
	TokenTypeAccess TokenType = "chirpy-access"
	// TokenTypeRefresh
	TokenTypeRefresh TokenType = "chirpy-refresh"
)

Jump to

Keyboard shortcuts

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