NAME

Mail::DKIM2::RecipeJSON - The base64 JSON of a Message-Instance r= tag

SYNOPSIS

use Mail::DKIM2::RecipeJSON qw(encode_tag_json decode_tag_json);

my $r    = encode_tag_json({ b => [ { c => [1, 4] } ] });
my $data = decode_tag_json($r);

DESCRIPTION

Encoding and strict decoding of the JSON object a Message-Instance carries in its r= tag (-09 section 5). Mail::DKIM2::MessageInstance checks the Recipes themselves; this is the document they arrive in. Nothing is exported by default; Mail::DKIM2::Common exports these too, as it did before they moved here in 0.31.

See "CONVENTIONS" in Mail::DKIM2 for the conventions every module follows.

FUNCTIONS

encode_tag_json($data), decode_tag_json($base64)

Canonical JSON in base64, the encoding of the r= Recipe tag. decode_tag_json dies on invalid JSON, including JSON text that is not UTF-8 and an object that gives the same key twice, compared without regard to case (parsers disagree on which value wins). Every string it returns, object keys included, is UTF-8 octets.

is_utf8_octets($octets)

True if $octets is valid UTF-8 (ASCII included), strictly: no surrogate, nothing above U+10FFFF, no overlong form. A Recipe literal that is goes in a d step; one that is not, in a u step (-09 section 5).

AUTHOR

Bron Gondwana <brong@fastmailteam.com>

COPYRIGHT AND LICENSE

Copyright (c) 2025-2026 Fastmail Pty Ltd. This is free software; you can redistribute it and/or modify it under the same terms as Perl itself.