File Coverage

blib/lib/Net/ACME/Challenge/Pending/http_01.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 0 1 0.0
total 19 20 95.0


line stmt bran cond sub pod time code
1             package Net::ACME::Challenge::Pending::http_01;
2              
3             =encoding utf-8
4              
5             =head1 NAME
6              
7             Net::ACME::Challenge::Pending::http_01 - unhandled http-01 challenge
8              
9             =head1 SYNOPSIS
10              
11             use Net::ACME::Challenge::Pending::http_01 ();
12              
13             my $challenge = Net::ACME::Challenge::Pending::http_01->new(
14              
15             #i.e., from the ACME new-authz call
16             uri => 'https://post/url/for/challenge',
17             token => 'sdgflih4we',
18             );
19              
20             {
21             my $handler = $challenge->create_handler(
22             '/path/to/docroot',
23             $jwk, #public
24             );
25              
26             #Suggest verification that the URI matches content.
27             #cf. docs for Net::ACME
28              
29             my $acme = Net::ACME::SomeService->new();
30             $acme->do_challenge($challenge);
31              
32             #wait until the challenge’s authz is resolved
33             }
34              
35             #Once $handler goes out of scope, the filesystem preparation is undone.
36              
37             =head1 DESCRIPTION
38              
39             This class handles responses to C challenges, specifically by
40             facilitating easy setup and teardown of proper domain control validation (DCV)
41             files within a given document root.
42              
43             To work with challenges that have been handled (successfully or not),
44             see C.
45              
46             =cut
47              
48 5     5   233002 use strict;
  5         7  
  5         117  
49 5     5   14 use warnings;
  5         5  
  5         105  
50              
51 5         16 use parent qw(
52             Net::ACME::Challenge::Pending
53 5     5   24 );
  5         5  
54              
55 5     5   1872 use Net::ACME::Challenge::Pending::http_01::Handler ();
  5         9  
  5         288  
56              
57             sub create_handler {
58 3     3 0 776827 my ( $self, $docroot, $jwk ) = @_;
59              
60 3         21 return Net::ACME::Challenge::Pending::http_01::Handler->new(
61             token => $self->token(),
62             key_authz => $self->make_key_authz($jwk),
63             docroot => $docroot,
64             );
65             }
66              
67             1;