blib/lib/Net/Amazon/Signature/V3.pm

filter: Statementstmt 73.1% 30 / 41 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 8 / 12 Podpod 100% 1 / 1 totaltotal 72.2% 39 / 54 CC 1 SCAR 2.0
CC
1
Cov
73%
_time_string
2.0
signed_headers
2.0
__ANON__
1.3
CRAP 1.2
↑ Summary
1 #
2 # This file is part of Net-Amazon-Signature-V3
3 #
4 # This software is Copyright (c) 2018, 2012 by Chris Weyl.
5 #
6 # This is free software, licensed under:
7 #
8 # The GNU Lesser General Public License, Version 2.1, February 1999
9 #
10 package Net::Amazon::Signature::V3;
11 2 our $AUTHORITY = 'cpan:RSRCHBOY';
12 # git description: 0.002-1-g73b0d20
13 2 $Net::Amazon::Signature::V3::VERSION = '0.003';
14  
15 # ABSTRACT: Sign AWS requests -- V3
16  
17 2 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 2 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 2 ▶use MooseX::AttributeShortcuts 0.015;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 2 ▶use MooseX::Types::Common::String ':all';
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 2 ▶use HTTP::Date;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 2 ▶use Digest::HMAC_SHA1;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 2 ▶use MIME::Base64;
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 has $_ => (is => 'ro', isa => NonEmptySimpleStr, required => 1)
29 2 for qw{ id key };
30  
31 0 ▶has trust_local_time => (is => 'ro', isa => 'Bool', builder => sub { 0 });
Subroutine _build_trust_local_time: not called CC=1 SCAR=2.6
Subroutine __ANON__: not called CC=1 SCAR=2.6
32  
33 # see route53-dg-20120229.pdf, page 98
34 0 ▶sub _time_string { time2str time }
Subroutine _time_string: not called CC=1 SCAR=6.9
35  
36  
37 0 ▶sub signed_headers {
Subroutine signed_headers: not called CC=1 SCAR=6.9
Pod documented
38 0 my $self = shift @_;
39  
40 0 my $hmac = Digest::HMAC_SHA1->new($self->key);
41 0 my $date = $self->_time_string;
42  
43 0 $hmac->add($date);
44 0 my $signature = encode_base64($hmac->digest, '');
45  
46 0 my $auth_string
47 = 'AWS3-HTTPS '
48 . 'AWSAccessKeyId=' . $self->id . ','
49 . 'Algorithm=HmacSHA1,'
50 . 'Signature=' . $signature
51 ;
52  
53 0 my %options = (
54 'x-amz-date' => $date,
55 'X-Amzn-Authorization' => $auth_string,
56 );
57  
58 ### %options
59 0 return %options;
60 }
61  
62 2 __PACKAGE__->meta->make_immutable;
63 2 !!42;
64  
65 __END__
↑ Summary