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.20210512'; # VERSION |
4
|
29
|
|
|
29
|
|
546
|
use 5.20.0; |
|
29
|
|
|
|
|
125
|
|
5
|
29
|
|
|
29
|
|
188
|
use Moose; |
|
29
|
|
|
|
|
71
|
|
|
29
|
|
|
|
|
275
|
|
6
|
29
|
|
|
29
|
|
208425
|
use Mail::BIMI::Prelude; |
|
29
|
|
|
|
|
80
|
|
|
29
|
|
|
|
|
294
|
|
7
|
29
|
|
|
29
|
|
27523
|
use Mail::AuthenticationResults::Header::Entry; |
|
29
|
|
|
|
|
364606
|
|
|
29
|
|
|
|
|
1221
|
|
8
|
29
|
|
|
29
|
|
16921
|
use Mail::AuthenticationResults::Header::SubEntry; |
|
29
|
|
|
|
|
11770
|
|
|
29
|
|
|
|
|
892
|
|
9
|
29
|
|
|
29
|
|
14409
|
use Mail::AuthenticationResults::Header::Comment; |
|
29
|
|
|
|
|
23634
|
|
|
29
|
|
|
|
|
20264
|
|
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
|
9016
|
sub domain($self) { |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
8
|
|
24
|
5
|
|
|
|
|
180
|
return $self->bimi_object->domain; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
5
|
|
|
5
|
1
|
14
|
sub selector($self) { |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
10
|
|
29
|
5
|
|
|
|
|
176
|
return $self->bimi_object->selector; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
14
|
|
|
14
|
1
|
2636
|
sub set_result($self,$result) { |
|
14
|
|
|
|
|
38
|
|
|
14
|
|
|
|
|
35
|
|
|
14
|
|
|
|
|
34
|
|
34
|
14
|
100
|
|
|
|
79
|
if ( ref $result eq 'Mail::BIMI::Error' ) { |
35
|
10
|
|
|
|
|
68
|
$self->result($result->result); |
36
|
10
|
|
|
|
|
52
|
$self->comment($result->description); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
else { |
39
|
4
|
|
|
|
|
126
|
$self->result($result); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
14
|
|
|
14
|
1
|
36
|
sub get_authentication_results_object($self) { |
|
14
|
|
|
|
|
28
|
|
|
14
|
|
|
|
|
28
|
|
45
|
14
|
|
|
|
|
275
|
my $header = Mail::AuthenticationResults::Header::Entry->new()->set_key( 'bimi' )->safe_set_value( $self->result ); |
46
|
14
|
100
|
|
|
|
1268
|
if ( $self->comment ) { |
47
|
10
|
|
|
|
|
123
|
$header->add_child( Mail::AuthenticationResults::Header::Comment->new()->safe_set_value( $self->comment ) ); |
48
|
|
|
|
|
|
|
} |
49
|
14
|
100
|
|
|
|
3931
|
if ( $self->result eq 'pass' ) { |
50
|
4
|
|
|
|
|
46
|
$header->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'header.d' )->safe_set_value( $self->bimi_object->record->retrieved_domain ) ); |
51
|
4
|
|
|
|
|
430
|
$header->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'header.selector' )->safe_set_value( $self->bimi_object->record->retrieved_selector ) ); |
52
|
|
|
|
|
|
|
} |
53
|
14
|
50
|
|
|
|
731
|
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
|
14
|
|
|
|
|
161
|
return $header; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
14
|
|
|
14
|
1
|
93
|
sub get_authentication_results($self) { |
|
14
|
|
|
|
|
29
|
|
|
14
|
|
|
|
|
32
|
|
69
|
14
|
|
|
|
|
61
|
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.20210512 |
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 |