# README
auth
import "github.com/coralproject/shelf/internal/platform/auth"
Overview
Index
- func DecodePrivateKey(privateKeyBase64Str string) (*ecdsa.PrivateKey, error)
- func DecodePublicKey(publicKeyBase64Str string) (*ecdsa.PublicKey, error)
- func SignRequest(context interface{}, signer Signer, claims map[string]interface{}, r *http.Request) error
- type Signer
Package files
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