SDK/Core/Credential/SharedKey.pm

filter: Statementstmt 100% 35 / 35 Branchbran 50.0% 2 / 4 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 12 / 12 Podpod 100% 3 / 3 totaltotal 84.3% 54 / 64 CC 5 SCAR 11.0
CC
5
Cov
87%
__ANON__
7.5
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« SDK/Core/Error.pm ↑ Summary SDK/Core/Page.pm »
1 14 ▶use v5.36;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 14 ▶use feature 'class';
Subroutine BEGIN: called CC=1 SCAR=0.0
3 14 ▶no warnings 'experimental::class';
Subroutine BEGIN: called CC=1 SCAR=0.0
4
5 14 ▶use Azure::SDK::Core::Credential;
Subroutine BEGIN: called CC=1 SCAR=0.0
6
7 class Azure::SDK::Core::Credential::SharedKey
8 14 :isa(Azure::SDK::Core::Credential) {
9 14 ▶ use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 14 ▶ use Digest::SHA qw(hmac_sha256);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 14 ▶ use MIME::Base64 qw(decode_base64 encode_base64);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 14 ▶ use Azure::SDK::Core::SecretString;
Subroutine BEGIN: called CC=1 SCAR=0.0
13
14 14 field $account_name :param :reader = undef;
15 14 field $account_key :param = undef;
16
17 54 ▶ ADJUST {
Subroutine __ANON__: called CC=5 SCAR=20.1
18 54 ▶ croak 'Azure::SDK::Core::Credential::SharedKey requires an account_name'
Branch: 1 branch
BranchTrueFalseTotal
unless defined $account_name and length $account_name 0 54 54
Condition33%1/3
defined $account_name and length $account_name
!ll&&!rl&&r
0054
MC/DC0%0/2
defined $account_name and length $account_name
defined $account_name length $account_name
Truth table33%1/3
A and B
A= defined $account_nameB= length $account_name
ABresult
0X0
100
111
19 unless defined $account_name && length $account_name;
20 54 ▶ croak 'Azure::SDK::Core::Credential::SharedKey requires an account_key'
Branch: 1 branch
BranchTrueFalseTotal
unless defined $account_key and length $account_key 0 54 54
Condition33%1/3
defined $account_key and length $account_key
!ll&&!rl&&r
0054
MC/DC0%0/2
defined $account_key and length $account_key
defined $account_key length $account_key
Truth table33%1/3
A and B
A= defined $account_keyB= length $account_key
ABresult
0X0
100
111
21 unless defined $account_key && length $account_key;
22
23 54 $account_key = Azure::SDK::Core::SecretString->new(value => $account_key);
24 }
25
26 72 ▶ method sign ($string_to_sign) {
Subroutine sign: called CC=1 SCAR=0.0
Pod documented
27 72 my $key = decode_base64($account_key->reveal);
28 72 my $signature = encode_base64( hmac_sha256($string_to_sign, $key), '' );
29 72 return $signature;
30 }
31
32 71 ▶ method authorization_header ($string_to_sign) {
Subroutine authorization_header: called CC=1 SCAR=0.0
Pod documented
33 71 return "SharedKey $account_name:" . $self->sign($string_to_sign);
34 }
35
36 1 ▶ method apply ($request) {
Subroutine apply: called CC=1 SCAR=0.0
Pod documented
37 1 croak 'Azure::SDK::Core::Credential::SharedKey cannot canonicalize a '
38 . 'request on its own; the service client builds the string to sign '
39 . 'and calls authorization_header()';
40 }
41 }
42
43 14 1;
44
45 __END__
« SDK/Core/Error.pm ↑ Summary SDK/Core/Page.pm »