File Coverage

blib/lib/Mail/DKIM/ARC/Seal.pm
Criterion Covered Total %
statement 35 35 100.0
branch 11 16 68.7
condition 4 4 100.0
subroutine 8 8 100.0
pod 4 5 80.0
total 62 68 91.1


line stmt bran cond sub pod time code
1             package Mail::DKIM::ARC::Seal;
2 3     3   20 use strict;
  3         9  
  3         127  
3 3     3   17 use warnings;
  3         7  
  3         226  
4             our $VERSION = '1.20240923'; # VERSION
5             # ABSTRACT: represents a ARC-Seal header
6              
7             # Copyright 2017 FastMail Pty Ltd. All Rights Reserved.
8             # Bron Gondwana
9             #
10             # This program is free software; you can redistribute it and/or
11             # modify it under the same terms as Perl itself.
12              
13 3     3   19 use base 'Mail::DKIM::ARC::MessageSignature';
  3         9  
  3         1867  
14              
15              
16             sub new {
17 385     385 1 839 my $class = shift;
18 385         1072 my %prms = @_;
19 385         710 my $self = {};
20 385         939 bless $self, $class;
21              
22 385 100       1217 $self->instance( $prms{'Instance'} ) if exists $prms{'Instance'};
23 385   100     2955 $self->algorithm( $prms{'Algorithm'} || 'rsa-sha256' );
24 385         1939 $self->signature( $prms{'Signature'} );
25 385 50       1425 $self->canonicalization( $prms{'Method'} ) if exists $prms{'Method'};
26 385   100     2536 $self->chain( $prms{'Chain'} || 'none' );
27 385         1789 $self->domain( $prms{'Domain'} );
28 385         1994 $self->selector( $prms{'Selector'} );
29             $self->timestamp(
30 385 100       2189 defined $prms{'Timestamp'} ? $prms{'Timestamp'} : time() );
31 385 50       1023 $self->expiration( $prms{'Expiration'} ) if defined $prms{'Expiration'};
32 385 50       1169 $self->tags( $prms{'Tags'} ) if defined $prms{'Tags'};
33 385 100       1066 $self->key( $prms{'Key'} ) if defined $prms{'Key'};
34              
35 385         1184 return $self;
36             }
37              
38             sub body_hash {
39              
40             # Not defined for ARC-Seal
41 131     131 1 396 return;
42             }
43              
44             sub DEFAULT_PREFIX {
45 442     442 0 1642 return 'ARC-Seal:';
46             }
47              
48              
49             sub chain {
50 385     385 1 660 my $self = shift;
51 385 50       1039 if (@_) {
52 385         1183 my $cv = shift;
53             die "INVALID chain value $cv"
54 385 50       891 unless grep { $cv eq $_ } qw(none fail pass);
  1155         2789  
55 385         1071 $self->set_tag( 'cv', $cv );
56             }
57 385         1056 return $self->get_tag('cv');
58             }
59              
60              
61             sub canonicalization {
62 382     382 1 1502 return ( 'seal', 'seal' );
63             }
64              
65              
66             1;
67              
68             __END__