utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateJWTToken

func GenerateJWTToken(claims jwt.Claims, privateKey *rsa.PrivateKey) (string, error)

func VerifyPrivateKeyFormat

func VerifyPrivateKeyFormat(privateKey string) (*rsa.PrivateKey, error)

func VerifyPublicKeyFormat

func VerifyPublicKeyFormat(publicKey string) (*rsa.PublicKey, error)

func VerifyTokenRSA

func VerifyTokenRSA(tokenString string, publicKey *rsa.PublicKey) (*jwt.Token, error)

Types

type Config

type Config struct {
	AuthenticatedPrefix   string `yaml:"GAG_AUTHENTICATED_PREFIX"`
	UnauthenticatedPrefix string `yaml:"GAG_UNATHETICATED_PREFIX"` // 1. CHANGE THESE TO SNAKE CASE
	JwtRSAPublicKey       string `yaml:"GAG_JWT_RSA_PUBLIC_KEY"`
	JwtRSAPrivateKey      string `yaml:"GAG_JWT_RSA_PRIVATE_KEY"`
	ServerAddress         string `yaml:"SERVER_ADDRESS"`
	DestinationURL        string `yaml:"GAG_DESTINATION_URL"`
	CorsApiKey            string `yaml:"CORS_API_KEY"`
	Mode                  string `yaml:"MODE"`
}

func ParseYamlFile

func ParseYamlFile(yamlFile string) (Config, error)

type Middleware

type Middleware func(http.Handler) http.Handler

func MiddlewareStack

func MiddlewareStack(middlewares ...Middleware) Middleware

type RSAkeys

type RSAkeys struct {
	PublicKey  *rsa.PublicKey
	PrivateKey *rsa.PrivateKey
}

func VerifyAllKeys

func VerifyAllKeys(Configdata Config) (error, *RSAkeys)

Jump to

Keyboard shortcuts

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