token

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ERR_INVALID_CLAIM = "Invalid claim"
	ERR_AUTORIZATION  = "Invalid autorization"
)

Variables

This section is empty.

Functions

func Generate

func Generate(clientId, name, app, kind, device string, expired time.Duration) (string, error)

* * Generate method to use in token * @param clientId string * @param name string * @param app string * @param kind string * @param device string * @param expired time.Duration * @return string * @return error *

func Key added in v0.0.3

func Key(app, device, clientId string) string

* * Key return a key * @param app string * @param device string * @param clientId string * @return string *

Types

type Claim

type Claim struct {
	ClientId string        `json:"clientId"`
	Name     string        `json:"name"`
	Iat      time.Time     `json:"iat"`
	Exp      time.Duration `json:"exp"`
	App      string        `json:"app"`
	Kind     string        `json:"kind"`
	Device   string        `json:"device"`
	jwt.StandardClaims
}

func Validate

func Validate(tokenString string) (*Claim, error)

* * Validate method to use in token * @param tokenString string * @return *Claim * @return error *

Jump to

Keyboard shortcuts

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