jwt

package
v0.0.0-...-7b45942 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IssueClaims

func IssueClaims(claims *CustomClaims, secret string) (tokenString string, err error)

Types

type CustomClaims

type CustomClaims struct {
	KeyID     string `json:"kid,omitempty"`
	Id        string `json:"jti,omitempty"`
	Type      string `json:"typ,omitempty"`
	Subject   string `json:"sub,omitempty"`
	Audience  string `json:"aud,omitempty"`
	Issuer    string `json:"iss,omitempty"`
	IssuedAt  int64  `json:"iat,omitempty"`
	NotBefore int64  `json:"nbf,omitempty"`
	ExpiresAt int64  `json:"exp,omitempty"`
}

func Check

func Check(tokenString string, secret string) (claims *CustomClaims, err error)

func Issue

func Issue(
	claimType string,
	subject string,
	duration time.Duration,
	secret string,
) (
	claims *CustomClaims,
	tokenString string,
	err error,
)

func (CustomClaims) GetExpiresAtSeconds

func (c CustomClaims) GetExpiresAtSeconds() (expiresAtInSeconds int)

func (CustomClaims) Valid

func (c CustomClaims) Valid() (err error)

Jump to

Keyboard shortcuts

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