jwt

package
v0.0.0-...-bbcb6ed Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateJWKS

func CreateJWKS(key *rsa.PrivateKey) *jose.JSONWebKeySet

CreateJWKS creates a JWKS from the given private key

Types

type Signer

type Signer struct {
	PrivateKey *rsa.PrivateKey
}

Signer is used to sign tokens

func NewSigner

func NewSigner(key *rsa.PrivateKey) *Signer

NewSigner ...

func (*Signer) Sign

func (s *Signer) Sign(t *Token) string

Sign will add a signature to the given payload

type Token

type Token struct {
	Body map[string]interface{}
	// contains filtered or unexported fields
}

Token represents a JWT

func CreateToken

func CreateToken() *Token

CreateToken prepares a new Token

type Verifier

type Verifier struct {
	PublicKey *rsa.PublicKey
}

Verifier is used to verify token

func NewVerifier

func NewVerifier(k interface{}) (*Verifier, error)

NewVerifier creates a verifier from an RSA key. This can be a public key or private key

func (*Verifier) Decode

func (v *Verifier) Decode(jwtStr string) (*Token, error)

Decode will decode the payload without verifying the signature

func (*Verifier) Verify

func (v *Verifier) Verify(jwtStr string) (*Token, error)

Verify decodes a token and checks whether the given signature is valid

Jump to

Keyboard shortcuts

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