httpsignatureutils

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

TODO ts client has key and jwk files. everything ehre is unused so far but dumping for preservation purposes. need to split these out if i actually end up using them.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidSignature      = errors.New("invalid signature")
	ErrMissingSignature      = errors.New("missing signature")
	ErrMissingSignatureInput = errors.New("missing signature input")
)
View Source
var (
	ErrMissingRequiredHeader = errors.New("missing required header")
)

Functions

func GenerateNewPrivateKey

func GenerateNewPrivateKey() (string, error)

func LoadBase64Key

func LoadBase64Key(base64Key string) (ed25519.PrivateKey, error)

func LoadKey

func LoadKey(input string) (ed25519.PrivateKey, error)

func LoadKeyFromFile

func LoadKeyFromFile(path string) (ed25519.PrivateKey, error)

func LoadPEMKey

func LoadPEMKey(pemString string) (ed25519.PrivateKey, error)

func ValidateSignature

func ValidateSignature(opts *ValidationOptions) error

Types

type ContentHeaders

type ContentHeaders struct {
	ContentDigest string
	ContentLength string
	ContentType   string
}

func CreateContentHeaders

func CreateContentHeaders(body []byte) ContentHeaders

type JWK

type JWK struct {
	Kid string `json:"kid"`
	X   string `json:"x"`
	Alg string `json:"alg"`
	Kty string `json:"kty"`
	Crv string `json:"crv"`
}

type SignOptions

type SignOptions struct {
	Request    *http.Request
	PrivateKey ed25519.PrivateKey
	KeyID      string
}

type SignatureHeaders

type SignatureHeaders struct {
	Signature      string
	SignatureInput string
}

func CreateSignatureHeaders

func CreateSignatureHeaders(opts SignOptions) (*SignatureHeaders, error)

type ValidationOptions

type ValidationOptions struct {
	Request   *http.Request
	Headers   http.Header
	PublicKey ed25519.PublicKey
}

func NewValidationOptions

func NewValidationOptions(r *http.Request, headers http.Header, publicKey ed25519.PublicKey) *ValidationOptions

Jump to

Keyboard shortcuts

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