jwt

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2022 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTokenRSA

func CreateTokenRSA(key *rsa.PrivateKey, name string, b *badges.Badge) (string, error)

CreateTokenRSA creates a JWT with the badge information, and authorizing the badge to be saved with the public key and name.

func DecodeColor

func DecodeColor(clr uint32) color.RGBA

DecodeColor decodes a uint32 back to a color.

func EncodeColor

func EncodeColor(c color.Color) uint32

EncodeColor encodes a color as a uint32 for transport.

func LoadKey

func LoadKey(filename string) (*rsa.PrivateKey, error)

LoadKey loads an RSA private key from a file.

func ParseToken

func ParseToken(token string) (*rsa.PublicKey, string, *badges.Badge, error)

ParseToken decodes a JWT to extract the badge and authorization.

func ReadKey

func ReadKey(r io.Reader) (*rsa.PrivateKey, error)

ReadKey reads an RSA private key from a reader.

Types

type Claims

type Claims struct {
	Name     string `json:"name"`
	Caption  string `json:"caption"`
	Text     string `json:"text"`
	Color    uint32 `json:"color"`
	Height   int    `json:"height,omitempty"`
	MinWidth int    `json:"minwidth,omitempty"`

	rsa.PublicKey
	jwt.StandardClaims
}

Claims are the JWT claims required to transmit and authorize the badge.

func (*Claims) Valid

func (c *Claims) Valid() error

Valid returns an error if the claims are invalid.

Jump to

Keyboard shortcuts

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