package
0.4.8
Repository: https://github.com/coralproject/shelf.git
Documentation: pkg.go.dev

# README

auth

import "github.com/coralproject/shelf/internal/platform/auth"

Overview

Index

Package files

keys.go signer.go

func DecodePrivateKey

func DecodePrivateKey(privateKeyBase64Str string) (*ecdsa.PrivateKey, error)

DecodePrivateKey pulls the private key out of the string passed by first decoding from base64 and parsing the PEM encoding.

func DecodePublicKey

func DecodePublicKey(publicKeyBase64Str string) (*ecdsa.PublicKey, error)

DecodePublicKey pulls the public key out of the string passed by first decoding from base64 and parsing the PEM encoding.

func SignRequest

func SignRequest(context interface{}, signer Signer, claims map[string]interface{}, r *http.Request) error

SignRequest will take a given signer, and adds a Authorization header with the token that is generated from the signer.

type Signer

type Signer func(claims map[string]interface{}) (string, error)

Signer is a function that can be used to sign claims with and generate a signed JWT token from them.

func NewSigner

func NewSigner(privateKeyBase64Str string) (Signer, error)

NewSigner will return a signer that can be used to sign tokens for a given set of claims.


Generated by godoc2md

# Functions

DecodePrivateKey pulls the private key out of the string passed by first decoding from base64 and parsing the PEM encoding.
DecodePublicKey pulls the public key out of the string passed by first decoding from base64 and parsing the PEM encoding.
NewSigner will return a signer that can be used to sign tokens for a given set of claims.
SignRequest will take a given signer, and adds a Authorization header with the token that is generated from the signer.

# Type aliases

Signer is a function that can be used to sign claims with and generate a signed JWT token from them.