mimihubd

Architecture - Haven Interop#

Purpose#

A spec-conformant implementation of the MIMI (More Instant Messaging Interoperability) and MLS (RFC 9420) protocol logic - the layer that lets another service interoperate with Haven. Native Rust, no UI, no platform bindings; a clean protocol library.

Scope#

Boundary (open vs. closed)#

Open (here): the protocol/interoperability library (mimi-core, the repo root) and a reference hub daemon (mimihubd/) that runs it. Closed (by design): Haven's own production deployment of a hub is closed by design, along with the rest of Haven's operational infrastructure. Across federation the Haven client is the cryptographic endpoint; hubs and relays carry ciphertext only and hold no decryption capability.

Conformance#

This crate tracks the relevant IETF drafts/RFCs. Known divergences from the drafts are in DIVERGENCES.md.

Module map#

mimihubd/ (the reference hub daemon) consumes these modules and adds the HTTP transport, mTLS termination, and durable storage. All library modules are dependency-free of FRB and the app; each module's tests are self-contained.

Enforcement direction#

Several wire types decode into public fields with validation as a separate, skippable call - a ConsentEntry that decoded successfully but was never passed to validate_consent_entry looks identical, at the type level, to one that was checked. The crate is moving toward decoders that either return a validated value or an error, with no path to an unvalidated-but-constructed instance. Two further seams the same discipline targets: one canonical principal type for mimi:// identifiers (today protocol_wire::IdentifierUri is a second, unvalidated wrapper that can diverge from uri::MimiUri's parsed-and-canonicalized form), and binding the authenticated participant-list payload to the MLS Add/Remove it accompanies, so role authorization, membership limits, and the roster mutation land as one step instead of three independently-ordered calls. Changes toward this shape land incrementally; today's decoders stay available and correct throughout.

Wire-format conformance#

mimihubd's v1 started as a JSON-only compatibility lane. As of the routes in mimihubd/src/http.rs, the directory endpoint plus 14 /mimi/v1/* JSON routes are live, and 6 of them (keyMaterial, submitMessage, notify, identifierQuery, requestConsent, updateConsent) also have a /mimi/pl/* route speaking draft-ietf-mimi-protocol's TLS presentation-language (TLS-PL) framing directly. Both lanes read and write the same underlying store. The remaining JSON-only routes (room policy, member role, participant, sender authorization) are local hub-administration RPCs without a spec wire equivalent.

One known nuance: on the JSON lane, the consent endpoints (requestConsent/updateConsent) return HTTP 422 rather than the documented always-201 response when the request body fails to deserialize. The TLS-PL wire lane answers 202, and 422 only for an entry whose consentOperation is not one the endpoint takes (protocol-07 §5.7). The JSON 422 is an artifact of the framework's body extractor, not a protocol divergence.