This repository contains the code for a Rust implementation of the MIMI message content draft.
The crate implements the message container and the message ID derivation of draft-ietf-mimi-content-10, and the message status report format of draft-mahy-mimi-message-status-02.
MimiContent::deserialize rejects indefinite-length encoding and duplicate map keys, as the draft requires of receivers. The serde implementation rejects duplicate map keys too, but it can't see how its input was encoded. Both decoders enforce the draft's limits on NestedParts: a depth of at most four with the message body at level one, and at most 1024 NestedParts in a message. Beyond that, decoding is lenient. Salts of any length, single-part multiparts, floats of any width and extension names outside the draft's data model are accepted, so that messages from older or non-conforming implementations still decode. Re-serializing decoded content reproduces its bytes, except for input that wasn't in shortest form.
Encoding is deterministic in the sense of RFC 8949 section 4.2.1 for everything the draft's examples use: shortest-form integers and lengths, definite lengths, and extension keys sorted bytewise on their encoding. Floats are always encoded as 64-bit values, which keeps re-serialization byte-stable but is not the shortest form. The data model rules on extension names are enforced by MimiContent::with_extension, not by the encoder, and the rules on nested map keys and on the nesting depth of extension values beyond with_extension are not enforced.
All crates in this repository are licensed under the AGPL 3.0. This README file is licensed under CC-BY 4.0.