utils

package
v0.0.0-...-3a3e309 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

bcrypt password comparison

func GetJWTToken

func GetJWTToken(email string, w http.ResponseWriter) string

Creating JWT Token

func GetUsernameFromEmail

func GetUsernameFromEmail(email string) string

func HashPassword

func HashPassword(password string) (string, error)

bcrypt password hashing with salt

func Hasher

func Hasher(bv []byte) string

Util method for sha hashing

func IsAuthorized

func IsAuthorized(user models.TokenManager, w http.ResponseWriter, r *http.Request) bool

API Authorization with JWT Token and username

func JWTTokenCheck

func JWTTokenCheck(tokenStr string, w http.ResponseWriter)

Checking JWT Token validity

func JWTTokenUpdate

func JWTTokenUpdate(tokenStr string, w http.ResponseWriter)

Updating JWT Token

Types

type Claims

type Claims struct {
	Email string `json:"Email"`
	jwt.StandardClaims
}

JWT token claim with email

Jump to

Keyboard shortcuts

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