jwt

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 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, data map[string]any) string

func Verify

func Verify(token string) bool

Types

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

type Payload

type Payload struct {
	JwtId     string         `json:"jti,omitempty"`
	Issuer    string         `json:"iss,omitempty"`
	Subject   string         `json:"sub,omitempty"`
	IssuedAt  int64          `json:"iat,omitempty"`
	Audience  string         `json:"aud,omitempty"`
	ExpiresAt int64          `json:"exp,omitempty"`
	NotBefore int64          `json:"nbf,omitempty"`
	Data      map[string]any `json:"dat,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