Documentation
¶
Overview ¶
Package auth implements static bearer API keys with two roles. Keys are compared as SHA-256 digests in constant time.
Index ¶
- Constants
- func Sign(secret, msgID string, ts time.Time, payload []byte) (string, error)
- func SignedHeaders(secret, msgID string, ts time.Time, payload []byte) (map[string]string, error)
- func VerifySignature(secret, msgID string, ts time.Time, payload []byte, header string, ...) error
- type Auth
- type Role
Constants ¶
View Source
const SecretPrefix = "whsec_"
Variables ¶
This section is empty.
Functions ¶
func SignedHeaders ¶
SignedHeaders returns the three Standard Webhooks headers for a delivery.
func VerifySignature ¶
func VerifySignature(secret, msgID string, ts time.Time, payload []byte, header string, tolerance time.Duration, now time.Time) error
VerifySignature checks a webhook-signature header (space-separated list of "v1,<sig>" entries) in constant time. Used by tests and by receiver-side tooling.
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
func (*Auth) Authenticate ¶
Authenticate resolves the request's role. With no keys configured every request is admin.
Click to show internal directories.
Click to hide internal directories.