Documentation
¶
Overview ¶
Package sigv implements SynCloud access-key request signing (§7.1), shared by the controller (verify) and synctl/SDKs (sign). Modeled on AWS SigV4, simplified: the secret never travels on the wire, the body is covered by a hash, and requests older than MaxSkew are rejected.
Signed requests carry:
X-Syn-Date: 20261006T101500Z X-Syn-Content-Sha256: <hex sha256 of body> Authorization: SYN1-HMAC-SHA256 Credential=<key id>, Signature=<hex>
Signature = hex(HMAC-SHA256(secret, StringToSign)), where StringToSign is the algorithm, date, method, escaped path, canonical query, host and body hash, each on its own line.
Index ¶
- Constants
- func BodyHash(body []byte) string
- func CanonicalQuery(rawQuery string) string
- func IsSigned(authz string) bool
- func ParseAuthorization(authz string) (keyID, sig string, err error)
- func Sign(req *http.Request, keyID, secret string, body []byte, now time.Time)
- func StringToSign(method, escapedPath, rawQuery, host, date, bodyHash string) string
- func Verify(req *http.Request, secret, sig string, body []byte, now time.Time) error
Constants ¶
const ( Algorithm = "SYN1-HMAC-SHA256" HeaderDate = "X-Syn-Date" HeaderContentHash = "X-Syn-Content-Sha256" DateFormat = "20060102T150405Z" // MaxSkew is how far a request's date may be from the server clock. MaxSkew = 5 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
func CanonicalQuery ¶
CanonicalQuery sorts keys and values so client and server agree.
func ParseAuthorization ¶
ParseAuthorization extracts the key ID and signature.
func StringToSign ¶
Types ¶
This section is empty.