antikythera_aws v0.1.4 AntikytheraAws.Signer.V4 View Source

Signing with Signature Version 4.

Link to this section Summary

Functions

From given creds and request informations, returns headers ready for AWS request.

Link to this section Functions

Link to this function

prepare_headers(creds, region, service, method, path, payload, headers, params)

View Source

From given creds and request informations, returns headers ready for AWS request.

Arguments are mostly Antikythera.Httpc.request/5 compatible, with some extra treatments:

  • creds, region, service must be supplied

  • path must not include query string. Relative/redundant path must be resolved beforehand

    • Any characters in segments except RFC3986 "Unreserved Characters", will be encoded
    • Escape chars ("%") in segments will be encoded to "%25"
  • payload serialization must be done beforehand, since it will be hashed in signature and compared on AWS
  • headers must have "host" field, which is a hard-requirement for signature

    • "x-amz-date" or "date" field value will be used as signature date. "x-amz-date" will be prioritized
    • If neither exist, "x-amz-date" will be generated with current date
  • params must be decoded query strings, in a list of tuple-2