NAME
Mail::DKIM2::Reflector - verify-and-reflect DKIM2 demonstration logic for dkim2.com
DESCRIPTION
The logic behind the dkim2.com reflector addresses: verify an incoming message's DKIM2 chain, apply a per-mode transformation, and return the message to send back to the sender. A reflector DKIM2-Signature is added only when the incoming chain verified. This is demonstration glue, not part of the library API, and its functions take lowercase named arguments. See docs/superpowers/specs/2026-06-18-dkim2-reflector-design.md.
FUNCTIONS
reflect(%args)
Verifies and transforms message per mode, signing as domain / selector with key or keyfile. When it originates the message (no DKIM2 chain to continue: the message starts again at m=1) or changes it (any mode but raw), the From becomes "<sender's name> via DKIM2 reflector" <reflector-<mode>@<domain>>, with the sender's From kept as Reply-To if there is none (-07 section 11). Returns a hashref with message, auth, dkim1, basis, signed and mode.
generate(%args)
A fresh signed message to sender.
generate_dsn(%args)
A signed DSN returning message to sender, via Mail::DKIM2::DSN: only for a Provisionally Verified message whose top mf= is not <> (-07 section 16); otherwise undef, or (undef, $why) in list context.
generate_brand(%args)
A two-signature brand demonstration message, or an explanatory one when the sender's domain has not delegated a key.
sign_dkim1($text, @specs)
Adds classic DKIM signatures, one per { domain, selector, key }.
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.