jwt

package
v0.0.0-...-5c09645 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package jwt provides token-related functionality

Index

Constants

View Source
const (
	Authorization = "Authorization"
	TokenType     = "Bearer"
	Expiration    = 86400
)

JWT related constants

Variables

This section is empty.

Functions

func EncodeTokenRequest

func EncodeTokenRequest(userID, userApiSecret string) string

EncodeTokenRequest builds the token request from the user id and api secret

func FromHeaderVal

func FromHeaderVal(s string) string

FromHeaderVal will remove the JWTTokenType if it prepends the string s, but is also safe to use if s is just the token

func ToHeaderVal

func ToHeaderVal(token string) string

ToHeaderVal prepends the JWTTokenType

func VerifyTokenRequest

func VerifyTokenRequest(request, userID, userApiSecret string) bool

Verify TokenRequest vaidates the request against the user id and api secret

Types

type Claims

type Claims struct {
	Scope string `json:"scope"`
	Org   string `json:"org"`
	jwt_go.StandardClaims
}

Claims are the JWT claims for the app

func Decode

func Decode(id, token string, signingKey []byte) (*Claims, error)

Decode returns the claims from a signed string jwt

func New

func New(userID, userEmailDigest, orgID string) (*Claims, error)

New returns a new Claims instance

Jump to

Keyboard shortcuts

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