The Mojo::DOM object of the decoded data, in the case the MagicEnvelope contains XML.

This attribute is experimental and may change without warnings!

encoding

my $encoding = $me->encoding;

The encoding of the MagicEnvelope. Defaults to base64url, which is the only encoding supported.

signature

my $sig = $me->signature;
my $sig = $me->signature('key-01');

A signature of the MagicEnvelope. For retrieving a specific signature, pass a key id, otherwise a default signature will be returned.

If a matching signature is found, the signature is returned as a hash reference, containing base64url encoded data for value and possibly a key_id. If no matching signature is found, a false value is returned.

For adding a signature, the private key with an optional prepended key id has to be given. The private key can be a Crypt::MagicSignatures::Key object, a MagicKey in compact notation or a hash reference containing the non-generation parameters accepted by the Crypt::MagicSignatures::Key constructor. Optionally a flag -data can be passed, that will sign the data payload instead of the signature base string (this is implemented for compatibility with non-standard implementations).

On success, the method returns the MagicEnvelope, otherwise it returns a false value.

For referring to a certain key, an array reference can be passed, containing the key (defined as described above) with an optional prepended key id and an optional flag appended, referring to the data to be verified. Conforming with the specification the default value is -base, referring to the signature base string of the MagicEnvelope. -data will verify against the data only, -compatible will first try to verify against the base signature string and then will verify against the data on failure (this is implemented for compatibility with non-standard implementations).