jwt

package module
v0.0.0-...-21c30ad Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Jwt

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

func New

func New() *Jwt

New jwt instance.

func Parse

func Parse(token string, secret string) *Jwt

Parse a jwt token.

func ParseByRSA

func ParseByRSA(token string, publicKey string) *Jwt

Parse a jwt token by RSA public key.

func UnverifiedParse

func UnverifiedParse(token string) *Jwt

Parse a token without secret or pem.

func (*Jwt) Encode

func (j *Jwt) Encode(secret string, expiredAfter time.Duration) (string, error)

Encode by secret.

func (*Jwt) EncodeByRSA

func (j *Jwt) EncodeByRSA(privateKey string, expiredAfter time.Duration) (string, error)

Encode by RSA private key.

func (*Jwt) Get

func (j *Jwt) Get(key string) any

Get a claim.

func (*Jwt) Set

func (j *Jwt) Set(key string, value any)

Set a claim.

type RSAKeyPair

type RSAKeyPair struct {
	Private string
	Public  string
}

func CreateRSAKeyPair

func CreateRSAKeyPair() (*RSAKeyPair, error)

Create a RSA key pair.

Jump to

Keyboard shortcuts

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