jwt

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: BSD-3-Clause Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	AlgHS256 = "HS256"
	AlgHS384 = "HS384"
	AlgHS512 = "HS512"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ID        string `yaml:"id"`
	Key       string `yaml:"key"`
	Algorithm string `yaml:"alg"`
}
type Header struct {
	Kid       string `json:"kid"`
	Alg       string `json:"alg"`
	IssuedAt  int64  `json:"iat"`
	ExpiresAt int64  `json:"eat"`
}

func (Header) MarshalEasyJSON

func (v Header) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Header) MarshalJSON

func (v Header) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Header) UnmarshalEasyJSON

func (v *Header) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Header) UnmarshalJSON

func (v *Header) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type JWT

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

func New

func New(conf []Config) (*JWT, error)

func (*JWT) Sign

func (v *JWT) Sign(payload interface{}, ttl time.Duration) (string, error)

func (*JWT) Verify

func (v *JWT) Verify(token string, payload interface{}) (*Header, error)

type Pool

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

Jump to

Keyboard shortcuts

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