Documentation
¶
Overview ¶
Package studiosign is the request-signing scheme shared by the studio proxy client (internal/studio) and the API's /admin/studio middleware.
X-Signature = "sha256=" + hex(HMAC-SHA256(secret,
"<unix-ts>.<nonce>.<METHOD>.<request-uri>.<body>"))
The timestamp bounds how long a captured request stays valid, the nonce makes every request single-use, and binding the method and URI stops a signature from being replayed against another endpoint.
Index ¶
Constants ¶
const ( HeaderSignature = "X-Signature" HeaderTimestamp = "X-Timestamp" HeaderNonce = "X-Nonce" // MaxSkew is the accepted clock difference between client and server. MaxSkew = 5 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
func ValidNonce ¶
ValidNonce reports whether n has the shape NewNonce produces.
Types ¶
type NonceCache ¶
type NonceCache struct {
// contains filtered or unexported fields
}
NonceCache remembers nonces for twice MaxSkew (a timestamp is accepted up to MaxSkew in either direction), so each signed request is accepted once.
func NewNonceCache ¶
func NewNonceCache() *NonceCache