Karta. Outbound. Signing behaviour
(Karta v1.0.0)
DKIM signing of outgoing messages at delivery time.
The keys come from a key source: a module implementing this behaviour,
configured as config :karta, Karta.Outbound, signing: MyKeySource. It
returns the Karta.Auth.DKIM.Signer specifications (key, domain,
selector, ...) for a message; an empty list means the message is sent
unsigned. Without a key source nothing is signed.
A message that cannot be signed (for example, it has no From field) is sent unsigned and the reason is logged: refusing it would turn a signing problem into lost mail.
Summary
Callbacks
The signing specifications for message (one per signature).
Functions
raw with DKIM-Signature fields in front, or unchanged: the message a
server personalises for one recipient is held whole, and signed from the
same facts a stored message is signed from.
What is put in front of the body, and how many of its first bytes that replaces: with signatures, the DKIM-Signature fields then the header block the signature covers, replacing that header block; unsigned, nothing at all, which sends the message as stored.
The specifications source gives for message; none without a key
source or when it has no key for the message, which sends it unsigned.
Callbacks
@callback specifications(Karta.Messages.Message.t()) :: [keyword()]
The signing specifications for message (one per signature).
Functions
@spec sign(binary(), Karta.Messages.Message.t(), module() | nil) :: binary()
raw with DKIM-Signature fields in front, or unchanged: the message a
server personalises for one recipient is held whole, and signed from the
same facts a stored message is signed from.
@spec sign_body(Karta.Outbound.Body.t(), Karta.Messages.Message.t(), [keyword()]) :: {iodata(), non_neg_integer()}
What is put in front of the body, and how many of its first bytes that replaces: with signatures, the DKIM-Signature fields then the header block the signature covers, replacing that header block; unsigned, nothing at all, which sends the message as stored.
The body hashes the signatures need are the ones Karta.Auth.DKIM.Signer.body_algorithms/1
named when the body was read (Karta.Outbound.Body.scan/2).
@spec specifications(Karta.Messages.Message.t(), module() | nil) :: [keyword()]
The specifications source gives for message; none without a key
source or when it has no key for the message, which sends it unsigned.