| 1 | package Net::ACME2::HTTP; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | =encoding utf-8 | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | =head1 NAME | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | Net::ACME2::HTTP - transport logic for C<Net::ACME2>. | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | This module handles communication with an ACME server at the HTTP level. | ||||||||||||||||||||||||||||
| 12 | It wraps POSTs in JWSes (JSON Web Signatures) as needed. | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | There should be no reason to interact with this class in production. | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | =cut | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 3 | ▶ | use JSON (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 3 | ▶ | use Net::ACME2::Error (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | 3 | ▶ | use Net::ACME2::HTTP_Tiny (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 25 | 3 | ▶ | use Net::ACME2::HTTP::Response (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 26 | 3 | ▶ | use Net::ACME2::X (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 3 | ▶ | use constant _CONTENT_TYPE => 'application/jose+json'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | #accessed from tests | ||||||||||||||||||||||||||||
| 31 | 3 | our $_NONCE_HEADER = 'replay-nonce'; | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | #Used in testing | ||||||||||||||||||||||||||||
| 34 | 3 | our $verify_SSL = 1; | |||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | #NB: âkeyâ isnât needed if weâre just doing GETs. | ||||||||||||||||||||||||||||
| 37 | sub new { | ||||||||||||||||||||||||||||
| 38 | 13 | ▶ | my ( $class, %opts ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 13 | ▶ | die Net::ACME2::X->create('Generic', 'need âkeyâ!') if !$opts{'key'}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 13 | my $ua = Net::ACME2::HTTP_Tiny->new( verify_SSL => $verify_SSL ); | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | my $self = bless { | ||||||||||||||||||||||||||||
| 45 | _ua => $ua, | ||||||||||||||||||||||||||||
| 46 | _acme_key => $opts{'key'}, | ||||||||||||||||||||||||||||
| 47 | 13 | _key_id => $opts{'key_id'}, | |||||||||||||||||||||||||||
| 48 | }, $class; | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 13 | return bless $self, $class; | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | sub set_key_id { | ||||||||||||||||||||||||||||
| 54 | 24 | ▶ | my ($self, $key_id) = @_; | ||||||||||||||||||||||||||
|
Subroutine
set_key_id: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 24 | $self->{'_key_id'} = $key_id; | |||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 24 | return $self; | |||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | sub set_new_nonce_url { | ||||||||||||||||||||||||||||
| 62 | 60 | ▶ | my ($self, $url) = @_; | ||||||||||||||||||||||||||
|
Subroutine
set_new_nonce_url: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 60 | $self->{'_nonce_url'} = $url; | |||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 60 | return $self; | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | #GETs submit no data and thus are not signed. | ||||||||||||||||||||||||||||
| 70 | sub get { | ||||||||||||||||||||||||||||
| 71 | 12 | ▶ | my ( $self, $url ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
get: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | 12 | return $self->_request( 'GET', $url ); | |||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | # ACME spec 6.2: for all requests not signed using an existing account, | ||||||||||||||||||||||||||||
| 77 | # e.g., newAccount | ||||||||||||||||||||||||||||
| 78 | sub post_full_jwt { | ||||||||||||||||||||||||||||
| 79 | 24 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
post_full_jwt: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 24 | return $self->_post( 'create_full_jws', @_ ); | |||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | # ACME spec 6.2: for all requests signed using an existing account | ||||||||||||||||||||||||||||
| 85 | sub post_key_id { | ||||||||||||||||||||||||||||
| 86 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
post_key_id: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 0 | return $self->_post( | |||||||||||||||||||||||||||
| 89 | 'create_key_id_jws', | ||||||||||||||||||||||||||||
| 90 | @_, | ||||||||||||||||||||||||||||
| 91 | ); | ||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | #---------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | #POSTs are signed. | ||||||||||||||||||||||||||||
| 97 | sub _post { | ||||||||||||||||||||||||||||
| 98 | 24 | ▶ | my ( $self, $jwt_method, $url, $data, $opts_hr ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_post: called CC=3 SCAR=11.8
| |||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | # Shouldnât be needed because the constructor requires âkeyâ, | ||||||||||||||||||||||||||||
| 101 | # but just in case. | ||||||||||||||||||||||||||||
| 102 | 24 | ▶ | die "Constructor needed âkeyâ to do POST! ($url)" if !$self->{'_acme_key'}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | 24 | my $jws = $self->_create_jwt( $jwt_method, $url, $data ); | |||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | 24 | local $opts_hr->{'headers'}{'Content-Type'} = 'application/jose+json'; | |||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | 24 | ▶ | return $self->_request_and_set_last_nonce( | ||||||||||||||||||||||||||
|
Condition33%1/3
$opts_hr || ()
MC/DC0%0/2
$opts_hr || ()
$opts_hr
()
Truth table33%1/3
A || B
A= $opts_hrB= ()
| |||||||||||||||||||||||||||||
| 109 | 'POST', | ||||||||||||||||||||||||||||
| 110 | $url, | ||||||||||||||||||||||||||||
| 111 | { | ||||||||||||||||||||||||||||
| 112 | content => $jws, | ||||||||||||||||||||||||||||
| 113 | headers => { | ||||||||||||||||||||||||||||
| 114 | 'content-type' => _CONTENT_TYPE, | ||||||||||||||||||||||||||||
| 115 | }, | ||||||||||||||||||||||||||||
| 116 | }, | ||||||||||||||||||||||||||||
| 117 | $opts_hr || (), | ||||||||||||||||||||||||||||
| 118 | ); | ||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | sub _ua_request { | ||||||||||||||||||||||||||||
| 122 | 48 | ▶ | my ( $self, $type, @args ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_ua_request: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | 48 | return $self->{'_ua'}->request( $type, @args ); | |||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | #overridden in tests | ||||||||||||||||||||||||||||
| 128 | sub _request { | ||||||||||||||||||||||||||||
| 129 | 48 | ▶ | my ( $self, $type, @args ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_request: called CC=6 SCAR=29.0
| |||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | 48 | my $resp; | |||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | #cf. eval_bug.readme | ||||||||||||||||||||||||||||
| 134 | 48 | my $eval_err = $@; | |||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | 48 | eval { $resp = $self->_ua_request( $type, @args ); }; | |||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | # Check ref() first to avoid potentially running overload.pmâs | ||||||||||||||||||||||||||||
| 139 | # stringification. | ||||||||||||||||||||||||||||
| 140 | 48 | ▶ | if (ref($@) || $@) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $@ or $@
MC/DC0%0/2
ref $@ or $@
ref $@
$@
Truth table33%1/3
A or B
A= ref $@B= $@
| |||||||||||||||||||||||||||||
| 141 | 0 | my $exc = $@; | |||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | 0 | ▶ | if ( eval { $exc->isa('Net::ACME2::X::HTTP::Protocol') } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 144 | 0 | my $_nonce_header_lc = $_NONCE_HEADER; | |||||||||||||||||||||||||||
| 145 | 0 | $_nonce_header_lc =~ tr<A-Z><a-z>; | |||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | 0 | my $nonce = $exc->get('headers')->{$_nonce_header_lc}; | |||||||||||||||||||||||||||
| 148 | 0 | ▶ | $self->{'_last_nonce'} = $nonce if $nonce; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | #If the exception is able to be made into a Net::ACME2::Error, | ||||||||||||||||||||||||||||
| 151 | #then do so to get a nicer error message. | ||||||||||||||||||||||||||||
| 152 | 0 | my $acme_error = eval { | |||||||||||||||||||||||||||
| 153 | Net::ACME2::Error->new( | ||||||||||||||||||||||||||||
| 154 | 0 | %{ JSON::decode_json( $exc->get('content') ) }, | |||||||||||||||||||||||||||
| 155 | ); | ||||||||||||||||||||||||||||
| 156 | }; | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | 0 | ▶ | if ($acme_error) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 159 | 0 | die Net::ACME2::X->create( | |||||||||||||||||||||||||||
| 160 | 'ACME', | ||||||||||||||||||||||||||||
| 161 | { | ||||||||||||||||||||||||||||
| 162 | http => $exc, | ||||||||||||||||||||||||||||
| 163 | acme => $acme_error, | ||||||||||||||||||||||||||||
| 164 | }, | ||||||||||||||||||||||||||||
| 165 | ); | ||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | 0 | $@ = $exc; | |||||||||||||||||||||||||||
| 170 | 0 | die; | |||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | 48 | $@ = $eval_err; | |||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | 48 | return Net::ACME2::HTTP::Response->new($resp); | |||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | sub _request_and_set_last_nonce { | ||||||||||||||||||||||||||||
| 179 | 36 | ▶ | my ( $self, $type, $url, @args ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_request_and_set_last_nonce: called CC=2 SCAR=7.4
| |||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | 36 | my $resp = $self->_request( $type, $url, @args ); | |||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | #NB: ACMEâs replay protection works thus: | ||||||||||||||||||||||||||||
| 184 | # - each server response includes a nonce | ||||||||||||||||||||||||||||
| 185 | # - each request must include ONE of the nonces that have been sent | ||||||||||||||||||||||||||||
| 186 | # - once used, a nonce canât be reused | ||||||||||||||||||||||||||||
| 187 | # | ||||||||||||||||||||||||||||
| 188 | #This is subtly different from what was originally in mind (i.e., that | ||||||||||||||||||||||||||||
| 189 | #each request must use the most recently sent nonce). It implies that GETs | ||||||||||||||||||||||||||||
| 190 | #do not need to send nonces, though each GET will *receive* a nonce that | ||||||||||||||||||||||||||||
| 191 | #may be used. | ||||||||||||||||||||||||||||
| 192 | 36 | ▶ | $self->{'_last_nonce'} = $resp->header($_NONCE_HEADER) or do { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 193 | 0 | die Net::ACME2::X->create('Generic', "Received no $_NONCE_HEADER from $url!"); | |||||||||||||||||||||||||||
| 194 | }; | ||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | 36 | return $resp; | |||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | sub _get_first_nonce { | ||||||||||||||||||||||||||||
| 200 | 12 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_get_first_nonce: called CC=2 SCAR=7.4
| |||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | 12 | ▶ | my $url = $self->{'_nonce_url'} or do { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | # Shouldnât happen unless thereâs an errant refactor. | ||||||||||||||||||||||||||||
| 205 | 0 | die Net::ACME2::X->create('Set newNonce URL first!'); | |||||||||||||||||||||||||||
| 206 | }; | ||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | 12 | $self->_request_and_set_last_nonce( 'HEAD', $url ); | |||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | 12 | return; | |||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | sub _create_jwt { | ||||||||||||||||||||||||||||
| 214 | 24 | ▶ | my ( $self, $jwt_method, $url, $data ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_create_jwt: called CC=6 SCAR=18.0
| |||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | 24 | ▶ | $self->_get_first_nonce() if !$self->{'_last_nonce'}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | 24 | ▶ | $self->{'_jwt_maker'} ||= do { | ||||||||||||||||||||||||||
|
Condition66%2/3
$self->{"_jwt_maker"} ||= do {
my $class;
my $key_type = $self->{"_acme_key"}->get_type;
if ($key_type eq "rsa") {
$class = "Net::ACME2::JWTMaker::RSA";
}
elsif ($key_type eq "ecdsa") {
$class = "Net::ACME2::JWTMaker::ECC";
}
else {
die "Net::ACME2::X"->create("Generic", "Unrecognized key type: \342\200\234$key_type\342\200\235");
};
unless ($class->can("new")) {
require Module::Load;
&Module::Load::load($class);
};
$class->new("key", $self->{"_acme_key"})
}
MC/DC0%0/2
$self->{"_jwt_maker"} ||= do {
my $class;
my $key_type = $self->{"_acme_key"}->get_type;
if ($key_type eq "rsa") {
$class = "Net::ACME2::JWTMaker::RSA";
}
elsif ($key_type eq "ecdsa") {
$class = "Net::ACME2::JWTMaker::ECC";
}
else {
die "Net::ACME2::X"->create("Generic", "Unrecognized key type: \342\200\234$key_type\342\200\235");
};
unless ($class->can("new")) {
require Module::Load;
&Module::Load::load($class);
};
$class->new("key", $self->{"_acme_key"})
}
$self->{"_jwt_maker"}
do {
my $class;
my $key_type = $self->{"_acme_key"}->get_type;
if ($key_type eq "rsa") {
$class = "Net::ACME2::JWTMaker::RSA";
}
elsif ($key_type eq "ecdsa") {
$class = "Net::ACME2::JWTMaker::ECC";
}
else {
die "Net::ACME2::X"->create("Generic", "Unrecognized key type: \342\200\234$key_type\342\200\235");
};
unless ($class->can("new")) {
require Module::Load;
&Module::Load::load($class);
};
$class->new("key", $self->{"_acme_key"})
}
Truth table66%2/3
A ||= B
A= $self->{"_jwt_maker"}B= do {
my $class;
my $key_type = $self->{"_acme_key"}->get_type;
if ($key_type eq "rsa") {
$class = "Net::ACME2::JWTMaker::RSA";
}
elsif ($key_type eq "ecdsa") {
$class = "Net::ACME2::JWTMaker::ECC";
}
else {
die "Net::ACME2::X"->create("Generic", "Unrecognized key type: \342\200\234$key_type\342\200\235");
};
unless ($class->can("new")) {
require Module::Load;
&Module::Load::load($class);
};
$class->new("key", $self->{"_acme_key"})
}
| |||||||||||||||||||||||||||||
| 219 | 12 | my $class; | |||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | 12 | my $key_type = $self->{'_acme_key'}->get_type(); | |||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | 12 | ▶ | if ($key_type eq 'rsa') { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 224 | 4 | $class = 'Net::ACME2::JWTMaker::RSA'; | |||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||
| 226 | elsif ($key_type eq 'ecdsa') { | ||||||||||||||||||||||||||||
| 227 | 8 | $class = 'Net::ACME2::JWTMaker::ECC'; | |||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||
| 229 | else { | ||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | # As of this writing, Crypt::Perl only does RSA and ECDSA keys. | ||||||||||||||||||||||||||||
| 232 | # If we get here, itâs possible that Crypt::Perl now supports | ||||||||||||||||||||||||||||
| 233 | # an additional key type that this library doesnât recognize. | ||||||||||||||||||||||||||||
| 234 | 0 | die Net::ACME2::X->create('Generic', "Unrecognized key type: â$key_typeâ"); | |||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||
| 237 | 12 | ▶ | if (!$class->can('new')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 238 | 4 | require Module::Load; | |||||||||||||||||||||||||||
| 239 | 4 | Module::Load::load($class); | |||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | $class->new( | ||||||||||||||||||||||||||||
| 243 | 12 | key => $self->{'_acme_key'}, | |||||||||||||||||||||||||||
| 244 | ); | ||||||||||||||||||||||||||||
| 245 | }; | ||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | return $self->{'_jwt_maker'}->$jwt_method( | ||||||||||||||||||||||||||||
| 248 | key_id => $self->{'_key_id'}, | ||||||||||||||||||||||||||||
| 249 | payload => $data, | ||||||||||||||||||||||||||||
| 250 | extra_headers => { | ||||||||||||||||||||||||||||
| 251 | 24 | nonce => $self->{'_last_nonce'}, | |||||||||||||||||||||||||||
| 252 | url => $url, | ||||||||||||||||||||||||||||
| 253 | }, | ||||||||||||||||||||||||||||
| 254 | ); | ||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||
| 257 | 3 | 1; | |||||||||||||||||||||||||||