Auth/SecretKey.pm

filter: Statementstmt 30.7% 8 / 26 Branchbran n/a Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 28.5% 2 / 7 Podpod 0.0% 0 / 4 totaltotal 23.8% 10 / 42 CC 2 SCAR 10.1
CC
2
Cov
28%
new
6.0
as_string
2.0
encryption_key
2.0
CRAP 2.8
« Auth/ApplicationToken.pm ↑ Summary
1 package WWW::Live::Auth::SecretKey;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 require Digest::SHA;
7  
8 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
9 0 my ( $proto, $raw ) = @_;
10 0 ▶ my $class = ref $proto || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
11
12 0 my $self = bless {
13 'string' => $raw,
14 }, $class;
15 0 $self->_process( $raw );
16
17 0 return $self;
18 }
19  
20 0 ▶sub as_string {
Subroutine as_string: not called CC=1 SCAR=6.9
Pod undocumented
21 0 my $self = shift;
22 0 return $self->{'string'};
23 }
24  
25 0 ▶sub encryption_key {
Subroutine encryption_key: not called CC=1 SCAR=6.9
Pod undocumented
26 0 my $self = shift;
27 0 return $self->{'encryption_key'};
28 }
29  
30 0 ▶sub signature_key {
Subroutine signature_key: not called CC=1 SCAR=6.9
Pod undocumented
31 0 my $self = shift;
32 0 return $self->{'signature_key'};
33 }
34  
35 0 ▶sub _process {
Subroutine _process: not called CC=1 SCAR=6.9
36 0 my ( $self, $secret_key ) = @_;
37 0 my $encryption_key = Digest::SHA::sha256( "ENCRYPTION$secret_key" );
38 0 my $signature_key = Digest::SHA::sha256( "SIGNATURE$secret_key" );
39 0 $encryption_key = substr( $encryption_key, 0, 16);
40 0 $signature_key = substr( $signature_key, 0, 16);
41 0 $self->{'encryption_key'} = $encryption_key;
42 0 $self->{'signature_key'} = $signature_key;
43 }
44  
45 1 1;
46 __END__
« Auth/ApplicationToken.pm ↑ Summary