httpclient

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package httpclient provides optional net/http convenience wrappers around github.com/oarkflow/fh/pkg/httpsignature's RFC 9421 response-signature verification.

It is kept out of the core httpsignature package deliberately: callers that already have the response fields extracted (most notably a WASM browser client using the Fetch API instead of net/http) can call httpsignature.Verifier.VerifyMessage directly and never import net/http at all. Merely importing net/http — even unused — pulls in its dependency graph (crypto/tls, crypto/x509, compress/gzip, and more) and adds several megabytes to a compiled Go/WASM binary. Use this package only when you have a real *http.Request/*http.Response pair from net/http.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Verify

func Verify(v httpsignature.Verifier, request *http.Request, response *http.Response, body []byte, expectedNonce string) error

Verify checks a native net/http response against the given RFC 9421 verifier profile.

Types

type Client

type Client struct {
	HTTPClient  *http.Client
	Verifier    httpsignature.Verifier
	MaxBodySize int64
}

Client wraps an *http.Client, verifying each response's RFC 9421 signature against a fresh nonce before returning it to the caller.

func (Client) Do

func (c Client) Do(request *http.Request) (*http.Response, error)

Do requests a fresh nonce-bound RFC 9421 response signature, reads and verifies the exact response content, then restores Body for the caller.

Jump to

Keyboard shortcuts

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