caphttp

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package caphttp is the compatibility facade for the target-oriented HTTP adapter.

Deprecated: use github.com/faustbrian/go-capability/v2/adapters/http. This package remains supported through the documented compatibility interval.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GrantFromContext

func GrantFromContext(ctx context.Context) (capability.Grant, bool)

GrantFromContext returns the verified grant carried by Middleware.

func SignRequest

func SignRequest(
	ctx context.Context,
	request *http.Request,
	payload capability.Payload,
	profile capability.URLProfile,
	signer capability.Signer,
	limits capability.Limits,
	bodyDigest []byte,
) error

SignRequest signs request.URL after complete successful issuance.

Types

type BodyDigest

type BodyDigest func(*http.Request) ([]byte, error)

BodyDigest obtains an already computed SHA-256 digest. It must not consume a request body unless it also restores it for the application.

type Clock

type Clock interface {
	Now() time.Time
}

Clock supplies request-time wall clock values.

type ErrorHandler

type ErrorHandler func(http.ResponseWriter, *http.Request, error)

ErrorHandler writes a secret-safe verification failure response.

type Verifier

type Verifier struct {
	// contains filtered or unexported fields
}

Verifier preserves the released compatibility-path type identity while delegating all behavior to the canonical adapter.

func NewVerifier

func NewVerifier(options VerifierOptions) (*Verifier, error)

NewVerifier validates an HTTP integration.

func (*Verifier) Middleware

func (verifier *Verifier) Middleware(next http.Handler) http.Handler

Middleware verifies and carries a Grant. The next handler remains responsible for authorization, consumption, and protected side-effect ordering.

func (*Verifier) VerifyRequest

func (verifier *Verifier) VerifyRequest(request *http.Request) (capability.Grant, error)

VerifyRequest verifies a request but does not authorize or consume its grant.

type VerifierOptions

type VerifierOptions struct {
	// Issuer is the required trusted namespace, never inferred from the request.
	Issuer       string
	Profile      capability.URLProfile
	Resolver     capability.Resolver
	Origin       string
	Clock        Clock
	Skew         time.Duration
	Limits       capability.Limits
	Revocations  capability.RevocationChecker
	BodyDigest   BodyDigest
	ErrorHandler ErrorHandler
}

VerifierOptions configures signed-URL verification for one immutable profile.

Jump to

Keyboard shortcuts

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