ts MagicEnvelopes in the
L<JSON notation|http://salmon-protocol.googlecode.com/svn/trunk/draft-panzer-magicsig-01.html#anchor5>
or defined by the same attributes as the JSON notation
(but with the dat
tter is the common way to fold new envelopes.
$me = Crypt::MagicSignatures::Envelope->new(<<'MEJSON');
{
"data_type": "text\/plain",
"data":"U29tZSBhcmJpdHJhcnkgc3RyaW5nLg==",
"alg":"
{ "key_id": "my-01",
"value":"S1VqYVlIWFpuRGVTX3l4S09CcWdjRV..."
}
]
}
MEJSON
$me = Crypt::MagicSignatures::Envelope->new(
data => 'Some arbitrary string.',
da
b64url_decode/;
use Carp 'carp';
use strict;
use warnings;
use Mojo::DOM;
use Mojo::JSON qw/encode_json decode_json/;
use Mojo::Util qw/trim/;
use v5.10.1;
our $VERSION = '0.15';
our @CARP_NOT;
#
ig );
});
}
# Message is me-json
elsif (index($string, '{') == 0) {
my $env;
# Parse json object
$env = decode_json $string;
unless (defined $env) {
b64url_encode( $sig->{value} ),
$self->signature_base
);
};
# Return em-json string
sub to_json {
my $self = shift;
# Empty envelope
return '{}' unless $self->data;
# Create