auth

package
v0.0.0-...-4cd26af Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: MIT Imports: 9 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 Decode

func Decode(s string) (string, error)

func Encode

func Encode(s string) string

func GetBearerToken

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

func HashPassword

func HashPassword(password string) (string, error)

func MakeJWT

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

func RefreshToken

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

func ValidateJWT

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

Types

type TokenType

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

Jump to

Keyboard shortcuts

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