jwt

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenType = "JWT"
	TokenAlg  = "ES256"
)

Variables

View Source
var (
	ErrorInvalidHeader    = errors.New("invalid header")
	ErrorInvalidSignature = errors.New("invalid signature")
	ErrorInvalidToken     = errors.New("")
	ErrorMalformedToken   = errors.New("malformed token")
)

Functions

func GenerateToken

func GenerateToken(key *ecdsa.PrivateKey, claims Claims) (string, error)

func Verify

func Verify(key *ecdsa.PublicKey, token string) error

Types

type Claims

type Claims struct {
	ExpiresAt time.Time `json:"exp"`
	IssuedAt  time.Time `json:"iat"`
	Issuer    int64     `json:"iss"`
	DeviceID  int64     `json:"did,omitempty"`
	Subject   string    `json:"sub,omitempty"`
}

func Parse

func Parse(token string) (*Claims, error)
type Header struct {
	Type string `json:"typ"`
	Alg  string `json:"alg"`
}

Jump to

Keyboard shortcuts

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