jwt

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: MIT Imports: 3 Imported by: 1

README

jwt

jwt generator

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(c IClaim, d time.Duration) (string, error)

Generate JWT Token for claim

func Init

func Init(s string)

Init Initialize JWT JWT should be initialized in main, before any JWT operation or behaviour will be undefined

func SetExpiresAtFunc

func SetExpiresAtFunc(fn func(d time.Duration) time.Time) error

SetExpiresAtFunc set expiresAtFunc

Types

type CustomClaim

type CustomClaim struct {
	Id   int    `json:"id"`
	Name string `json:"name"`
	Type string `json:"type"`
	jwt.RegisteredClaims
}

CustomClaim jwt claim

func Parse added in v0.0.2

func Parse(tokenString string) (*CustomClaim, error)

Parse JWT Token with CustomClaim

type IClaim

type IClaim interface {
	GetID() int
	GetName() string
	GetType() string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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