utils

package
v0.0.156 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateJWT

func GenerateJWT(signingKey string, userID uint) (string, error)

func HTTPRequest

func HTTPRequest(ctx context.Context, method string, url string, body io.Reader, headers map[string]string) (*http.Response, error)

func LuhnValid

func LuhnValid(number int) bool

func VerifyDeviceJWT

func VerifyDeviceJWT(did string, signingKey string, tokenString string) error

func VerifyJWT

func VerifyJWT(signingKey string, tokenString string) (uint, error)

Types

type DeviceJWT

type DeviceJWT struct {
	jwt.RegisteredClaims
	Identity string `json:"identity"`
}

type UserJWT

type UserJWT struct {
	jwt.RegisteredClaims
	Identity uint `json:"identity"`
}

func (UserJWT) GetAudience

func (u UserJWT) GetAudience() (jwt.ClaimStrings, error)

func (UserJWT) GetExpirationTime

func (u UserJWT) GetExpirationTime() (*jwt.NumericDate, error)

func (UserJWT) GetIssuedAt

func (u UserJWT) GetIssuedAt() (*jwt.NumericDate, error)

func (UserJWT) GetIssuer

func (u UserJWT) GetIssuer() (string, error)

func (UserJWT) GetNotBefore

func (u UserJWT) GetNotBefore() (*jwt.NumericDate, error)

func (UserJWT) GetSubject

func (u UserJWT) GetSubject() (string, error)

Jump to

Keyboard shortcuts

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