se strict;
use warnings;
use constant {RC_TOO_MANY_REQUESTS => 429};
use Carp qw(confess);
use JSON;
use LWP::UserAgent;
use Moose;
use Moose::Util::TypeConstraints;
use WWW::LetsEncrypt::JWS;
use
lts to the
Let's Encrypt API URL, cannot be changed once the object has been created.
=item JWK
JSON Web Key object that implements both JWK and JWA (will be passed to
a JWS object). This is require
if ($processed_response->{error} || $rate_limited) {
my $err_ref;
try {
$err_ref = decode_json($Response->content());
} catch {
$err_ref->{message} = $Response->content();
$err_ref->{f
W::LetsEncrypt::Message::Directory;
$WWW::LetsEncrypt::Message::Directory::VERSION = '0.002';
use JSON;
use Moose;
extends 'WWW::LetsEncrypt::Message';
=pod
=head1 NAME
WWW::LetsEncrypt::Message::
if ($Response->code() == 200) {
my $json_data = decode_json($Response->content());
return {
successful => 1,
finished => 1,
directory => $json_data,
};
}
return {
successful =>
sed together with WWW::LetsEncrypt::JWK as parents
will create a JSON Web Key that implements all the functions needed for signing
JSON Web Signature objects.
=head2 Attributes
'alg' a scalar attrib
qw(encode_base64url decode_base64url);
use Crypt::OpenSSL::Bignum;
use Crypt::OpenSSL::RSA;
use JSON;
use Moose;
with qw(WWW::LetsEncrypt::JWK WWW::LetsEncrypt::JWA);
sub generate_new {
my ($key_
thumbprint {
my ($self) = @_;
# RFC requires the keys to be sorted lexically.
my $JSON = JSON->new();
$JSON->canonical(1);
my %pubkey = $self->_get_public_key_components();
$pubkey{kty} = 'RS
f !$hash_method;
my $jsonified_sorted_pk = $JSON->encode(\%pubkey);
my $digested_jsonified_pk = $hash_method->($jsonified_sorted_pk);
return encode_base64url($digested_jsonified_pk);
}
sub _get
se strict;
use warnings;
use Encode qw(encode_utf8);
use MIME::Base64 qw(encode_base64url);
use JSON;
use Moose;
has 'payload' => (
is => 'rw',
isa => 'HashRef',
default => sub { return
eaders if %{$self->headers};
return encode_json($output);
}
sub _serialize_hash {
my ($hash_ref) = @_;
return encode_base64url(encode_utf8(encode_json($hash_ref)));
}
__PACKAGE__->meta->make_imm
({
item1 => 'a',
});
IOFunction($JWS->serialize());
=head1 DESCRIPTION
A (mostly) implemented JSON Web Signature object as per the RFC specification.
This object's implementation follows the JWS R
(confess);
use Digest::SHA;
use HTTP::Request;
use HTTP::Status qw(RC_CREATED RC_FORBIDDEN);
use JSON;
use MIME::Base64 qw(encode_base64url);
use Moose;
use Moose::Util::TypeConstraints;
extends qw(
esponse) = @_;
my $output_ref;
if ($Response->code == RC_CREATED) {
my $response_ref = decode_json($Response->content);
if ($response_ref->{status} eq 'pending') {
my ($challenge_ref) = grep
return {error => 1};
}
} elsif ($Response->code == RC_FORBIDDEN) {
my $response_ref = decode_json($Response->content);
if ($response_ref->{type} eq 'urn:acme:error:unauthorized') {
if ($resp
tion;
$WWW::LetsEncrypt::Message::Registration::VERSION = '0.002';
use strict;
use warnings;
use JSON;
use HTTP::Request;
use HTTP::Status qw(RC_CREATED RC_ACCEPTED RC_FORBIDDEN RC_CONFLICT);
use Moo
REATED) {
$self->_step('update') if $self->_step() eq 'new-reg';
my $server_response = decode_json($Response->content);
my $resp_ref = {%$server_response};
$resp_ref->{successful} = 1;
retu
l => 1,
finished => 1,
};
} elsif ($status_code == RC_FORBIDDEN) {
my $err_ref = decode_json($Response->content);
if ($err_ref->{type} =~ m/unauthorized$/
&& $err_ref->{detail} =~ m/^No
rtificate::VERSION = '0.002';
use HTTP::Status qw(RC_OK RC_CREATED RC_ACCEPTED RC_FORBIDDEN);
use JSON;
use Moose;
extends 'WWW::LetsEncrypt::Message';
=pod
=head1 NAME
WWW::LetsEncrypt::Message::
$WWW::LetsEncrypt::JWK::VERSION = '0.002';
use strict;
use warnings;
use Carp qw(confess);
use JSON;
use Moose::Role;
has 'key_type' => (
is => 'ro',
isa => 'Str',
required => 1,
);
ed together with WWW::LetsEncrypt::JWA as parents
will create a JSON Web Key that implements all of the functions needed for
signing JSON Web Signature objects. Specifically, this role deals with stor
blic Functions
=over 4
=item generate_new
This function, when implemented, should create a new JSON Web Key of a specific algorithm type.
Input
$number - key_length
$string - key id
Output
J