File Coverage

blib/lib/Net/ACME/Challenge/Pending/http_01.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.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 3     3   222234 use strict;
  3         4  
  3         70  
49 3     3   10 use warnings;
  3         3  
  3         67  
50              
51 3         10 use parent qw(
52             Net::ACME::Challenge::Pending
53 3     3   9 );
  3         2  
54              
55             use Net::ACME::Challenge::Pending::http_01::Handler ();
56              
57             sub create_handler {
58             my ( $self, $docroot, $jwk ) = @_;
59              
60             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;