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
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
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
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
ally, modulo lazy fetching of references.
That means that when a parsed schema is rendered out to JSON, it should look
the same as the original document.
Probably the sane way to do this would be to
$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
(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
act;
our $VERSION = '0.025';
use Carp ();
use Data::GUID guid_string => { -as => '_guid' };
use JSON::MaybeXS ();
use Metabase::Resource;
#----------------------------------------------------------
}
sub as_json {
my ($self) = @_;
return JSON::MaybeXS->new(ascii => 1)->encode( $self->as_struct );
}
sub from_json {
my ( $class, $string ) = @_;
my $struct = eval { JSON::MaybeXS-
>new(ascii => 1)->decode($string) }
or Carp::confess "Error decoding JSON:\n$@";
return $class->from_struct($struct);
}
sub save {
my ( $self, $filename ) = @_;
my $class = ref($sel
>. The default serialization method is L<JSON>,
though one can specify any serialization format you want. L<YAML> and L<Storable> are
viable alternatives.
JSON was chosen as the default serialization
}
my $session_data = $session_object->$data_column;
# No way to check that it's valid JSON other than trying to deserialize it
my $session = try {
$self->_deserialize($session_
Dancer function, not from JSON.pm
return to_json({%$self}, { pretty => 0, convert_blessed => 1 });
}
# Default Deserialize method
sub _deserialize {
my ($self, $json) = @_;
my $settings
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 =>
e strict;
use warnings;
package Metabase::Fact::Hash;
our $VERSION = '0.025';
use Carp ();
use JSON::MaybeXS ();
use Metabase::Fact;
our @ISA = qw/Metabase::Fact/;
sub validate_content {
my (
{
my ($self) = @_;
return JSON::MaybeXS->new(ascii => 1)->encode( $self->content );
}
sub content_from_bytes {
my ( $class, $bytes ) = @_;
return JSON::MaybeXS->new(ascii => 1)->decod
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
cify anything if package is os-independent
dependencies:
- perl-YAML > 0.5
- perl-JSON
files:
bin: /usr/local/bin # directory-based mapping. RPM will install C
=> '/usr/local/bin' },
dependencies => [
'perl-YAML > 0.5',
'perl-JSON'
],
os => 'el6',
user => 'apache',
group => 'apache',
-amd64 >>.
Benchmark cloning a 10k-element array (C<< bencher -m CloneModules --include-datasets-json '["array10k"]' >>):
+------------------------+-----------+-----------+------------+---------+--
--+---------+
Benchmark cloning a 10k-pair hash (C<< bencher -m CloneModules --include-datasets-json '["hash10k"]' >>):
+------------------------+-----------+-----------+------------+---------+---
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::
ete, wip perl client to the Saucelabs REST API
use Net::HTTP::Knork;
use Carp qw/croak/;
use JSON qw/to_json/;
use Moo;
use namespace::clean;
has user => (
is => 'ro',
default => sub {
path => '/info/status',
};
my $spec = {
name => 'Saucelabs REST API',
formats => [ 'json' ],
version => '0.1',
methods => $methods
};
has _base_url => (
is => 'ro',
init
er => sub {
my ($self) = @_;
my $knork = Net::HTTP::Knork->new(
spec => to_json($self->_spec),
client => $self->_ua,
default_params => {
user =
*Net::SAMLc::zxid_find_ses;
*ses_to_ldif = *Net::SAMLc::zxid_ses_to_ldif;
*ses_to_json = *Net::SAMLc::zxid_ses_to_json;
*ses_to_qs = *Net::SAMLc::zxid_ses_to_qs;
*ses_to_pool = *Net::SAMLc::zxid_ses_t
cache
key for a Moose metaclass. That's a nice approach when you know the incoming
hash is always JSON, but doesn't work as well when you can't predict the value
type (especially if the value is a cod
warnings;
use Carp ();
use Digest::SHA qw(hmac_sha256_hex);
use Exporter qw(import);
use JSON::XS qw(decode_json);
our @EXPORT_OK = qw( create_signature is_signature_valid );
our $SIG_VALID_FOR_SEC
$time ||= time;
my $req_time = ref($params) ? $params->{time}
: decode_json($params)->{time};
return if not $req_time;
return if $req_time < ($time - $SIG_VALID_FOR
indexpageids => 1,
generator => $generator,
format => "json"
};
if(defined $namespace_key){
$a->{ $namesp
my $a = {
action => "query",
format => "json",
pageids => $pageid,
prop => "revisions"
y, and cannot be overwritten:
action = "query"
indexpageids = 1
generator = <generate>
format = "json"
Additional parameters can be set in the constructor argument 'args'.
Arguments for a generator