Amazon-Signature4-Lite
view release on metacpan or search on metacpan
share/README.md view on Meta::CPAN
- headers
Optional hash reference containing additional request headers to include
in the signature.
- payload
The request body. The SHA-256 hash used in the canonical request is
calculated from this value.
If neither `payload` nor `payload_hash` is supplied, the payload is
treated as an empty string.
- payload\_hash
An optional precomputed SHA-256 hash of the request body.
When supplied, `payload_hash` is used directly in the canonical request
and, by default, as the value of the `x-amz-content-sha256` header. The
`payload` value is not hashed.
This is useful when the request body will be streamed and holding the
complete payload in memory solely for signing would be undesirable. The
caller is responsible for ensuring that `payload_hash` corresponds
exactly to the content that will be transmitted.
my $headers = $signer->sign(
method => 'PUT',
url => $url,
headers => %extra\_headers,
payload\_hash => $sha256,
);
- add\_sha256\_header
Controls whether `x-amz-content-sha256` is included in the returned
headers. Defaults to true.
- time
Optional Unix timestamp used when generating the signing timestamp.
When omitted, the current time is used. This is primarily useful for
testing or applications that need to control the signing time.
The returned hash reference includes `Authorization`, `x-amz-date`,
`host`, and, by default, `x-amz-content-sha256`. It also includes
`x-amz-security-token` when the signer was constructed with a session
token.
The returned hash reference can be passed directly as the headers for an
[HTTP::Tiny](https://metacpan.org/pod/HTTP%3A%3ATiny) request.
## parse\_service\_url(%args)
my ($host, $service, $region) = Amazon::Signature4::Lite->parse_service_url(
host => 's3.us-east-2.amazonaws.com',
default_region => 'us-east-1',
);
Extracts service name and region from an AWS endpoint URL. Can be
called as a class or instance method.
_Note: The patterns used for parsing are S3/AWS endpoint focused, not
a general URL parser._
# DEPENDENCIES
All dependencies are Perl core modules (since 5.10) or already
required by distributions in the Amazon::\* toolchain:
- [Digest::SHA](https://metacpan.org/pod/Digest%3A%3ASHA) (core since 5.10)
- [MIME::Base64](https://metacpan.org/pod/MIME%3A%3ABase64) (core)
- [POSIX](https://metacpan.org/pod/POSIX) (core)
- [URI::Escape](https://metacpan.org/pod/URI%3A%3AEscape)
# SEE ALSO
[AWS::Signature4](https://metacpan.org/pod/AWS%3A%3ASignature4), [Signer::AWSv4](https://metacpan.org/pod/Signer%3A%3AAWSv4), [Amazon::S3::Lite](https://metacpan.org/pod/Amazon%3A%3AS3%3A%3ALite)
( run in 0.472 second using v1.01-cache-2.11-cpan-7e1922ba9f2 )