jwt

package
v0.0.0-...-179e57f Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

* @Description: * @Author: gphper * @Date: 2021-12-22 14:43:08

* @Description: * @Author: gphper * @Date: 2021-12-22 13:19:04

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(alg string, payload Payload) (string, error)

func HmacSha256

func HmacSha256(message string, secret string) string

func Signature

func Signature(header string, payload string, hashType string) (string, error)

Types

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

func (*Header) Gen

func (header *Header) Gen() (string, error)

type Payload

type Payload struct {
	Exp  time.Time
	Name string
	Uid  uint
}

func Check

func Check(jtoken string) (payload Payload, err error)

* * 校验jtoken

func (*Payload) Gen

func (payload *Payload) Gen() (string, error)

Jump to

Keyboard shortcuts

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