Package imf implements useful routines for dealing with the Internet Message Format as used by Katzenpost.
const ( // SenderIdentityHeader is the mail header containing the Base64 // representation of the sender's public key, set by the recipient upon // successfully receiving a message. SenderIdentityHeader = "X-Katzenpost-Sender" // UnreliableDeliveryHeader is the mail header signifying that the message // should be transmitted without the SURB-ACK functionality. The expected // value is "true" (case insensitive). UnreliableDeliveryHeader = "X-Katzenpost-Unreliable" // LocalName is the common hostname used by mail proxy instances. LocalName = "katzenpost.localhost" )
AddMessageID sets the `Message-ID` header if one is not already present in the Entity's header block.
AddReceived prepends a `Received` header entry based on the supplied position and protocol.
BytesToEntity de-serializes a byte buffer to a message.Entity.
EntityToBytes re-serializes a message.Entity into a byte slice suitable for storage or presentation to the user. It assumes that e.Body points to an io.Reader containing the entire flattened body.
Note: Unique message header fields will get reordered due to the backing implementation being a map. This is spec compliant (RFC 5322 3.6), though the RFC strongly recommends against doing so at a `SHOULD NOT` level.
IsUnreliable examines the headers of an IMF message to see if the non-standard UnreliableDeliveryHeader is set.
KeyLookupSuccess is used to notify the user that a successful unverified key lookup was completed and that they should verify the key out-of-band.
NewBounce creates a new multipart/report message to be used to indicate a failure to deliver a mail.
NewDecryptionFailure creates a new mutipart/report message to be used to indicate a receiver side decryption failure.
NewEnqueueFailure creates a new multipart/report message to be used to indicate one or more failures in enqueueing a mail.
NewForbiddenHeaders creates a new multipart/report message to be used to indicate a receiver side header validation failure.
NewMalformedIMF creates a new multipart/report message to be used to indicate a receiver side IMF de-serialization failure.
NewReceiveTimeout creates a new multipart/report message to be used to indicate a failure to receive a mail.
NewReserializationFailure creates a new multipart/report message to be used to indicate a receiver side re-serialization failure.
ToCRLF attempts to canonicalize the buffer to have the IMF CRLF line endings by converting `\n` octets not immediately preceeded by a `\r` to `\r\n`.
ValidateHeaders sanity checks an IMF message to ensure that none of the proscribed headers are defined.