jwt

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ALG = "HS256"
	JWT = "JWT"
)

Variables

This section is empty.

Functions

func Create

func Create(id string) string

func Creates

func Creates(id string, other map[string]any) string

func Verify

func Verify(token string) bool

Types

type Header struct {
	Alg string `json:"alg,omitempty"`
	Typ string `json:"ptr,omitempty"`
}

type Payload

type Payload struct {
	Id        string         `json:"jti,omitempty"`
	Subject   string         `json:"sub,omitempty"`
	Issuer    string         `json:"iss,omitempty"`
	IssuedAt  int64          `json:"iat,omitempty"`
	Audience  string         `json:"aud,omitempty"`
	ExpiresAt int64          `json:"exp,omitempty"`
	NotBefore int64          `json:"nbf,omitempty"`
	Other     map[string]any `json:"oth,omitempty"`
}

func GetPayload

func GetPayload(token string) *Payload

type Signature

type Signature struct {
	// contains filtered or unexported fields
}

func (*Signature) Sign

func (s *Signature) Sign(secret string)

func (*Signature) String

func (s *Signature) String() string

Jump to

Keyboard shortcuts

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