AWS-Signature-V4

 view release on metacpan or  search on metacpan

CLAUDE.md  view on Meta::CPAN

## Layout

- `lib/AWS/Signature/V4.pm` is the signing core; `Chunker.pm`,
  `Checksum.pm`, `Credentials.pm`, `X509.pm` and `Error.pm` sit under
  `lib/AWS/Signature/V4/`.
- **The documentation lives in separate `.pod` files** next to the
  modules, not in the `.pm`. A change in behaviour usually needs the
  matching `.pod`, the tests and often an example updated with it.
- `eg/` holds numbered, self-contained example programs, described in
  `eg/README.md`.
- `t/` uses `Test2::V0`.
- `local/` (carton) and `tmp/` (review notes) are git-ignored, as are
  vim's `*.sw*` swap files.

## Conventions

- `unless` is used **only as a statement modifier**. Write the block form
  as `if (!$x) { ... }`: the negated block is harder to read and ages
  badly when an `else` has to be added later.
- Errors are raised with `fail` from `AWS::Signature::V4::Error`, which
  throws an `Ouch`. Code **400** means the caller got the input wrong.

META.json  view on Meta::CPAN

   "prereqs" : {
      "configure" : {
         "requires" : {
            "Module::Build::Tiny" : "0.034"
         }
      },
      "develop" : {
         "requires" : {
            "Dist::Milla" : "v1.0.22",
            "Template::Perlish" : "1.64",
            "Test::Pod" : "1.41"
         }
      },
      "runtime" : {
         "recommends" : {
            "String::CRC32C" : "0"
         },
         "requires" : {
            "Carp" : "0",
            "CryptX" : "0.091",
            "Digest::SHA" : "0",

META.json  view on Meta::CPAN

            "Ouch" : "0.0501",
            "POSIX" : "0",
            "experimental" : "0",
            "namespace::clean" : "0.27",
            "perl" : "5.024"
         }
      },
      "test" : {
         "requires" : {
            "File::Temp" : "0",
            "Test2::V0" : "0",
            "Test::Pod" : "0"
         }
      }
   },
   "release_status" : "stable",
   "version" : "0.004",
   "x_contributors" : [
      "Flavio Poletti <flavio@polettix.it>"
   ],
   "x_generated_by_perl" : "v5.40.1",
   "x_serialization_backend" : "Cpanel::JSON::XS version 4.40",

META.yml  view on Meta::CPAN

---
abstract: 'User-Agent agnostic AWS Signatures V4 for credentials and X509'
author:
  - 'Flavio Poletti (flavio@polettix.it)'
build_requires:
  File::Temp: '0'
  Test2::V0: '0'
  Test::Pod: '0'
configure_requires:
  Module::Build::Tiny: '0.034'
dynamic_config: 0
generated_by: 'Dist::Milla version v1.0.22, Dist::Zilla version 6.037, CPAN::Meta::Converter version 2.150010'
license: apache
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: '1.4'
name: AWS-Signature-V4
no_index:

cpanfile  view on Meta::CPAN

requires 'Ouch', '0.0501';

# Much faster crc32c checksums, used when installed
recommends 'String::CRC32C';

on develop => sub {
   requires 'Template::Perlish', '1.64';
};

on test => sub {
   requires 'Test2::V0';
   requires 'File::Temp';
   requires 'Test::Pod';
};

t/author-pod-syntax.t  view on Meta::CPAN

#!perl

BEGIN {
  unless ($ENV{AUTHOR_TESTING}) {
    print qq{1..0 # SKIP these tests are for testing by the author\n};
    exit
  }
}

# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests
use strict; use warnings;
use Test::More;
use Test::Pod 1.41;

all_pod_files_ok();

t/basic.t  view on Meta::CPAN

use v5.24;
use experimental 'signatures';
use Test2::V0;
use FindBin '$Bin';
use lib "$Bin/../lib";
use AWS::Signature::V4;
use File::Temp qw< tempdir >;
use Math::BigInt;

# Example from the AWS SigV4 documentation (IAM ListUsers)
my $s = AWS::Signature::V4->new(
   service => 'iam', region => 'us-east-1',
   credentials => {

t/canonical.t  view on Meta::CPAN

use v5.24;
use utf8;
use experimental 'signatures';
use Test2::V0;
use FindBin '$Bin';
use lib "$Bin/../lib";
use AWS::Signature::V4;
use Digest::SHA qw< sha256_hex >;

my %cred = (access_key_id => 'AKID', secret_access_key => 'SECRET');
my $std = AWS::Signature::V4->new(service => 'service', region => 'us-east-1', credentials => {%cred});
my $s3  = AWS::Signature::V4->new(service => 's3',      region => 'us-east-1', credentials => {%cred});

sub canon ($signer, $url, %rest) {

t/chain.t  view on Meta::CPAN

use v5.24;
use experimental 'signatures';
use Test2::V0;
use FindBin '$Bin';
use lib "$Bin/../lib";
use AWS::Signature::V4;
use MIME::Base64 qw< encode_base64 >;
use File::Temp qw< tempdir >;

# chain items only need to be well-formed DER SEQUENCEs, tiny ones will do
my @der = map { "\x30\x03\x02\x01" . chr($_) } 1 .. 3;
my @b64 = map { encode_base64($_, '') } @der;
sub pem ($der) {

t/error.t  view on Meta::CPAN

use v5.24;
use Test2::V0;
use FindBin '$Bin';
use experimental 'signatures';
use lib "$Bin/../lib";
use AWS::Signature::V4::Error qw< fail >;

my $secret = 'S3CR3T-value';

sub thrown (@args) { my $e = dies { fail(@args) }; $e }

subtest 'code and message' => sub {

t/errors.t  view on Meta::CPAN

use v5.24;
use Test2::V0;
use FindBin '$Bin';
use lib "$Bin/../lib";
use experimental 'signatures';
use Digest::SHA qw< sha256 >;
use MIME::Base64 qw< encode_base64 >;
use AWS::Signature::V4;
use AWS::Signature::V4::Chunker;

my %cred = (credentials => {access_key_id => 'a', secret_access_key => 'b'});
my $s = AWS::Signature::V4->new(service => 's3', region => 'r', %cred);

t/presign.t  view on Meta::CPAN

use v5.24;
use experimental 'signatures';
use Test2::V0;
use FindBin '$Bin';
use lib "$Bin/../lib";
use AWS::Signature::V4;
use Digest::SHA qw< sha256_hex >;
use MIME::Base64 qw< encode_base64 >;

sub bad ($re = qr/./) {
   object { prop blessed => 'Ouch'; call code => 400; call message => match $re };
}

t/security.t  view on Meta::CPAN

use v5.24;
use Test2::V0;
use FindBin '$Bin';
use lib "$Bin/../lib";
use experimental 'signatures';
use Data::Dumper ();
use File::Temp ();
use AWS::Signature::V4;

my %cred = (access_key_id => 'AKID', secret_access_key => 'SECRET');
my $s3  = AWS::Signature::V4->new(service => 's3', region => 'r', credentials => {%cred});
my $url = 'https://b.s3.amazonaws.com/k';

t/streaming.t  view on Meta::CPAN

use v5.24;
use experimental 'signatures';
use Test2::V0;
use FindBin '$Bin';
use lib "$Bin/../lib";
use AWS::Signature::V4;
use Digest::SHA qw< sha256_hex >;
use File::Temp qw< tempfile >;

my $s3 = AWS::Signature::V4->new(
   service => 's3', region => 'us-east-1',
   credentials => {
      access_key_id     => 'AKIAIOSFODNN7EXAMPLE',

t/trailer.t  view on Meta::CPAN

use v5.24;
use experimental 'signatures';
use Test2::V0;
use FindBin '$Bin';
use lib "$Bin/../lib";
use AWS::Signature::V4;
use Digest::SHA qw< sha1 sha256 sha256_hex hmac_sha256 hmac_sha256_hex >;
use MIME::Base64 qw< encode_base64 >;

my $s3 = AWS::Signature::V4->new(service => 's3', region => 'us-east-1', credentials => {
      access_key_id => 'AKIAIOSFODNN7EXAMPLE',
      secret_access_key => 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'});
my $x = AWS::Signature::V4->new(service => 's3', region => 'r', x509 => {

t/variants.t  view on Meta::CPAN

use v5.24;
use Test2::V0;
use FindBin '$Bin';
use lib "$Bin/../lib";
use experimental 'signatures';
use MIME::Base64 qw< encode_base64 >;
use AWS::Signature::V4;
use AWS::Signature::V4::Credentials;
use AWS::Signature::V4::X509;

sub bad_request ($name) {
   object { prop blessed => 'Ouch'; call code => 400; call message => match qr/\Q$name\E/ };



( run in 1.984 second using v1.01-cache-2.11-cpan-234fa220139 )