Documentation
¶
Overview ¶
Package sigv4 signs a request with AWS Signature Version 4: by hand, a few dozen lines, rather than an SDK, for S3-compatible sync (davsync) and Amazon Bedrock's access keys (provider).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Signer ¶
type Signer struct {
ID, Secret string
// Token is a temporary credential's session token, sent (and signed)
// in X-Amz-Security-Token; "" for a long-term access key
Token string
Region, Service string
// Few signs host and the x-amz-* headers alone, for a request whose
// other headers may still change after it is signed (the gateway's
// anthropic-beta); every header is signed otherwise, as S3 wants
Few bool
// Twice escapes the path once more for its canonical form, as every
// service but S3 checks it (SigV4's "each path segment URI-encoded
// twice"); an S3 request's path is used as it is sent
Twice bool
}
Signer is a credential and where it is used.
func (Signer) Sign ¶
Sign sets req's X-Amz-Date, X-Amz-Security-Token when there is a token, and Authorization, over the headers req has at this point (Few: host and x-amz-* alone) and its host. payload is the body's SHA-256, in hex (Hash); an S3 server wants it in X-Amz-Content-Sha256 too, which the caller sets.