ACME2/Challenge/dns_01.pm

filter: Statementstmt 61.9% 13 / 21 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 100% 1 / 1 totaltotal 62.0% 18 / 29 SCAR 8.5
CC
2
Cov
57%
get_record_value
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.3
« ACME2/Order.pm ↑ Summary ACME2/HTTP/Response.pm »
1 package Net::ACME2::Challenge::dns_01;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶use parent qw( Net::ACME2::Challenge );
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 =encoding utf-8
9  
10 =head1 NAME
11  
12 Net::ACME2::Challenge::dns_01
13  
14 =head1 DESCRIPTION
15  
16 This module is instantiated by L<Net::ACME2::Authorization> and is a
17 subclass of L<Net::ACME2::Challenge>.
18  
19 =head1 METHODS
20  
21 =head2 I<OBJ>->get_record_name()
22  
23 Returns the name (i.e., just the leftmost label) of the TXT record to create.
24  
25 (NB: This is always the same name, as per the ACME specification.)
26  
27 =cut
28  
29 3 ▶use constant get_record_name => '_acme-challenge';
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 #----------------------------------------------------------------------
32  
33 =head2 I<OBJ>->get_record_value( $ACME )
34  
35 Accepts a L<Net::ACME2> instance and returns the value of the TXT record
36 to create.
37  
38 Example:
39  
40 X_XMlEGlxkmqi3B8IFROXLXogCSMGo0JUC9-cJ3Y1NY
41  
42 =cut
43  
44 sub get_record_value {
45 0 ▶ my ($self, $acme) = @_;
Subroutine get_record_value: not called CC=2 SCAR=17.9
Pod documented
46  
47 # Errors for the programmer.
48 0 ▶ if (!$acme) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($acme) 0 0 0
49 0 die 'Need “Net::ACME2” instance to compute DNS record value!'
50 }
51  
52 # NB: These are probably loaded anyway.
53 0 require Digest::SHA;
54 0 require MIME::Base64;
55  
56 0 my $key_authz = $acme->make_key_authorization($self);
57  
58 0 my $sha = Digest::SHA::sha256($key_authz);
59  
60 0 return MIME::Base64::encode_base64url($sha);
61 }
62  
63 3 1;
« ACME2/Order.pm ↑ Summary ACME2/HTTP/Response.pm »