line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::BIMI::Result; |
2
|
|
|
|
|
|
|
# ABSTRACT: Class to model a BIMI result |
3
|
|
|
|
|
|
|
our $VERSION = '3.20210301'; # VERSION |
4
|
30
|
|
|
30
|
|
547
|
use 5.20.0; |
|
30
|
|
|
|
|
109
|
|
5
|
30
|
|
|
30
|
|
177
|
use Moose; |
|
30
|
|
|
|
|
67
|
|
|
30
|
|
|
|
|
238
|
|
6
|
30
|
|
|
30
|
|
192387
|
use Mail::BIMI::Prelude; |
|
30
|
|
|
|
|
80
|
|
|
30
|
|
|
|
|
264
|
|
7
|
30
|
|
|
30
|
|
24164
|
use Mail::AuthenticationResults::Header::Entry; |
|
30
|
|
|
|
|
335470
|
|
|
30
|
|
|
|
|
1033
|
|
8
|
30
|
|
|
30
|
|
14181
|
use Mail::AuthenticationResults::Header::SubEntry; |
|
30
|
|
|
|
|
10415
|
|
|
30
|
|
|
|
|
915
|
|
9
|
30
|
|
|
30
|
|
12827
|
use Mail::AuthenticationResults::Header::Comment; |
|
30
|
|
|
|
|
21909
|
|
|
30
|
|
|
|
|
18713
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
extends 'Mail::BIMI::Base'; |
12
|
|
|
|
|
|
|
has result => ( is => 'rw', isa => 'Str', |
13
|
|
|
|
|
|
|
documentation => 'Text result' ); |
14
|
|
|
|
|
|
|
has comment => ( is => 'rw', isa => 'Str', |
15
|
|
|
|
|
|
|
documentation => 'Text comment' ); |
16
|
|
|
|
|
|
|
has error => ( is => 'rw', |
17
|
|
|
|
|
|
|
documentation => 'Optional Mail::BIMI::Error object detailing failure' ); |
18
|
|
|
|
|
|
|
has headers => ( is => 'rw', isa => 'HashRef', |
19
|
|
|
|
|
|
|
documentation => 'Hashref of headers to add to message' ); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
5
|
|
|
5
|
1
|
9920
|
sub domain($self) { |
|
5
|
|
|
|
|
16
|
|
|
5
|
|
|
|
|
11
|
|
24
|
5
|
|
|
|
|
191
|
return $self->bimi_object->domain; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
5
|
|
|
5
|
1
|
12
|
sub selector($self) { |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
10
|
|
29
|
5
|
|
|
|
|
168
|
return $self->bimi_object->selector; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
20
|
|
|
20
|
1
|
2369
|
sub set_result($self,$result) { |
|
20
|
|
|
|
|
61
|
|
|
20
|
|
|
|
|
43
|
|
|
20
|
|
|
|
|
38
|
|
34
|
20
|
100
|
|
|
|
92
|
if ( ref $result eq 'Mail::BIMI::Error' ) { |
35
|
13
|
|
|
|
|
69
|
$self->result($result->result); |
36
|
13
|
|
|
|
|
53
|
$self->comment($result->description); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
else { |
39
|
7
|
|
|
|
|
203
|
$self->result($result); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
20
|
|
|
20
|
1
|
43
|
sub get_authentication_results_object($self) { |
|
20
|
|
|
|
|
36
|
|
|
20
|
|
|
|
|
33
|
|
45
|
20
|
|
|
|
|
319
|
my $header = Mail::AuthenticationResults::Header::Entry->new()->set_key( 'bimi' )->safe_set_value( $self->result ); |
46
|
20
|
100
|
|
|
|
1444
|
if ( $self->comment ) { |
47
|
13
|
|
|
|
|
125
|
$header->add_child( Mail::AuthenticationResults::Header::Comment->new()->safe_set_value( $self->comment ) ); |
48
|
|
|
|
|
|
|
} |
49
|
20
|
100
|
|
|
|
5310
|
if ( $self->result eq 'pass' ) { |
50
|
7
|
|
|
|
|
70
|
$header->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'header.d' )->safe_set_value( $self->bimi_object->record->retrieved_domain ) ); |
51
|
7
|
|
|
|
|
648
|
$header->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'header.selector' )->safe_set_value( $self->bimi_object->record->retrieved_selector ) ); |
52
|
|
|
|
|
|
|
} |
53
|
20
|
50
|
|
|
|
961
|
if ( $self->bimi_object->record->authority->is_relevant ) { |
54
|
0
|
|
|
|
|
0
|
my $vmc = $self->bimi_object->record->authority->vmc; |
55
|
0
|
0
|
|
|
|
0
|
if ( $vmc ) { |
56
|
0
|
0
|
|
|
|
0
|
$header->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'policy.authority' )->safe_set_value( $vmc->is_valid ? 'pass' : 'fail' ) ); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
else { |
59
|
0
|
|
|
|
|
0
|
$header->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'policy.authority' )->safe_set_value( 'fail' ) ); |
60
|
|
|
|
|
|
|
} |
61
|
0
|
|
|
|
|
0
|
$header->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'policy.authority-uri' )->safe_set_value( $self->bimi_object->record->authority->uri ) ); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
20
|
|
|
|
|
160
|
return $header; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
20
|
|
|
20
|
1
|
126
|
sub get_authentication_results($self) { |
|
20
|
|
|
|
|
38
|
|
|
20
|
|
|
|
|
36
|
|
69
|
20
|
|
|
|
|
77
|
return $self->get_authentication_results_object->as_string; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
__END__ |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=pod |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=encoding UTF-8 |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 NAME |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Mail::BIMI::Result - Class to model a BIMI result |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 VERSION |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
version 3.20210301 |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 DESCRIPTION |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Class for representing a BIMI result |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
These values are derived from lookups and verifications made based upon the input values, it is however possible to override these with other values should you wish to, for example, validate a record before it is published in DNS, or validate an Indicator which is only available locally |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 comment |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
is=rw |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Text comment |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head2 error |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
is=rw |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Optional Mail::BIMI::Error object detailing failure |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head2 headers |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
is=rw |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Hashref of headers to add to message |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head2 result |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
is=rw |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Text result |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 EXTENDS |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=over 4 |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=item * L<Mail::BIMI::Base> |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=back |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 METHODS |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 I<domain()> |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Return the domain of the current operation |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head2 I<selector()> |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Return the selector of the current operation |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head2 I<set_result($result)> |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Set the result text and comment for this Result object |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
If $result is a Mail::BIMI::Error object then the result will be built from |
143
|
|
|
|
|
|
|
its attributes, otherwise the result must be a string. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head2 I<get_authentication_results_object()> |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Returns a Mail::AuthenticationResults::Header::Entry object with the BIMI results set |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head2 I<get_authentication_results()> |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Return the BIMI Authentication-Results fragment as text |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 REQUIRES |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=over 4 |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=item * L<Mail::AuthenticationResults::Header::Comment|Mail::AuthenticationResults::Header::Comment> |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=item * L<Mail::AuthenticationResults::Header::Entry|Mail::AuthenticationResults::Header::Entry> |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=item * L<Mail::AuthenticationResults::Header::SubEntry|Mail::AuthenticationResults::Header::SubEntry> |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=item * L<Mail::BIMI::Prelude|Mail::BIMI::Prelude> |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=item * L<Moose|Moose> |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=back |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head1 AUTHOR |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
Marc Bradshaw <marc@marcbradshaw.net> |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
This software is copyright (c) 2020 by Marc Bradshaw. |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
178
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=cut |