Documentation
¶
Overview ¶
Package httpsign provides utilities for signing and verifying HTTP requests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrVerification represents a failure to verify a signature. ErrVerification = errors.New("signature verification error") )
Functions ¶
func DefaultErrorHandler ¶
func DefaultErrorHandler(w http.ResponseWriter, r *http.Request, err error)
DefaultErrorHandler handles errors as follows:
- If the error is ErrVerification, it sends a 401 Unauthorized response.
- For any other errors, it defaults to sending a 500 Internal Server Error response.
Types ¶
type Middleware ¶
type Middleware struct {
// ErrorHandler is used to handle errors that occur during signature verification.
// If not provided, DefaultErrorHandler is used.
ErrorHandler func(w http.ResponseWriter, r *http.Request, err error)
// contains filtered or unexported fields
}
func NewMiddleware ¶
func NewMiddleware(verifier Verifier) *Middleware
NewMiddleware returns a new Middleware given a Verifier.
type Transport ¶
type Transport struct {
// Base is the base http.RoundTripper used to make HTTP requests.
// By default, http.DefaultTransport is used.
Base http.RoundTripper
// contains filtered or unexported fields
}
Transport is an HTTP http.RoundTripper which signs outgoing HTTP requests.
func NewTransport ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package ecdsa provides utilities for signing and verifying messages using ECDSA.
|
Package ecdsa provides utilities for signing and verifying messages using ECDSA. |
|
Package ed25519 provides utilities for signing and verifying messages using Ed25519.
|
Package ed25519 provides utilities for signing and verifying messages using Ed25519. |
|
Package hmac provides utilities for signing and verifying messages using HMAC.
|
Package hmac provides utilities for signing and verifying messages using HMAC. |
|
Package rsa provides utilities for signing and verifying messages using RSA.
|
Package rsa provides utilities for signing and verifying messages using RSA. |
Click to show internal directories.
Click to hide internal directories.