utils

package
v0.0.0-...-a683649 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2019 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

func GenerateAccessToken

func GenerateAccessToken(
	userId int64,
	thingId int64,
	durationInMinutes time.Duration,
) (string, error)

Function returns token string which was generated. Set `durationInMinutes` to zero if you want to create an access token without expiration limit.

func GetAccessTokenSecretKey

func GetAccessTokenSecretKey() []byte

Function returns the `secret key` used by our web service for signing our JWT standard claims.

func HashPassword

func HashPassword(password string) (string, error)

Types

type AccessTokenClaims

type AccessTokenClaims struct {
	UserId  int64 `json:"user_id"`
	ThingId int64 `json:"ThingId"`
	jwt.StandardClaims
}

The user claim embedded with the JWT standard claim.

func VerifyAccessTokenString

func VerifyAccessTokenString(tokenString string) (*AccessTokenClaims, error)

Function returns the verified claims if the JWT claim was verified, else return the error.

Jump to

Keyboard shortcuts

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