<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<!-- generated by https://github.com/cabo/kramdown-rfc version 1.6.33 (Ruby 3.1.4) -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-ralston-mimi-matrix-transport-01" category="info" consensus="true" submissionType="IETF" tocInclude="true" sortRefs="true" symRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.17.1 -->
  <front>
    <title abbrev="Matrix Message Transport">Matrix Message Transport</title>
    <seriesInfo name="Internet-Draft" value="draft-ralston-mimi-matrix-transport-01"/>
    <author fullname="Travis Ralston">
      <organization>The Matrix.org Foundation C.I.C.</organization>
      <address>
        <email>travisr@matrix.org</email>
      </address>
    </author>
    <author fullname="Matthew Hodgson">
      <organization>The Matrix.org Foundation C.I.C.</organization>
      <address>
        <email>matthew@matrix.org</email>
      </address>
    </author>
    <date year="2023" month="May" day="09"/>
    <area>Applications and Real-Time</area>
    <workgroup>More Instant Messaging Interoperability</workgroup>
    <keyword>matrix</keyword>
    <keyword>mimi</keyword>
    <abstract>
      <?line 55?>

<t>This document describes Linearized Matrix's transport considerations.</t>
    </abstract>
    <note removeInRFC="true">
      <name>About This Document</name>
      <t>
        The latest revision of this draft can be found at <eref target="https://turt2live.github.io/ietf-mimi-matrix-transport/draft-ralston-mimi-matrix-transport.html"/>.
        Status information for this document may be found at <eref target="https://datatracker.ietf.org/doc/draft-ralston-mimi-matrix-transport/"/>.
      </t>
      <t>
        Discussion of this document takes place on the
        More Instant Messaging Interoperability Working Group mailing list (<eref target="mailto:mimi@ietf.org"/>),
        which is archived at <eref target="https://mailarchive.ietf.org/arch/browse/mimi/"/>.
        Subscribe at <eref target="https://www.ietf.org/mailman/listinfo/mimi/"/>.
      </t>
      <t>Source for this draft and an issue tracker can be found at
        <eref target="https://github.com/turt2live/ietf-mimi-matrix-transport"/>.</t>
    </note>
  </front>
  <middle>
    <?line 59?>

<section anchor="introduction">
      <name>Introduction</name>
      <t>Linearized Matrix <xref target="I-D.ralston-mimi-linearized-matrix"/> describes an API surface for accessing Matrix rooms in a simple, easy to
implement, fashion. Normally a Matrix room would be a Directed Acyclic Graph, requiring servers to implement transport functions
to fill gaps, however with Linearized Matrix's API surface the transport considerations are reduced to simply passing events (messages)
between servers.</t>
    </section>
    <section anchor="transport-requirements">
      <name>Transport Requirements</name>
      <t><strong>TODO</strong>: This section needs a lot more words.</t>
      <ul spacing="normal">
        <li>HTTPS+JSON for ease of use (or similar)</li>
        <li>Should be reliable (not require constant connection, resilient to network faults where possible)</li>
        <li>Should be simple to understand (RESTful, for example)</li>
        <li>Exact details TBD.</li>
      </ul>
    </section>
    <section anchor="interoperability">
      <name>Interoperability</name>
      <t>Matrix's split of Federation and Client-Server APIs allow homeservers to implement the API surface which is most relevant for its
application.  For interoperability, only the Federation API is relevant. The APIs have been designed to intrinsically support load
balancing and active/active horizontal scaling - for instance, it's valid for different parts of a server to race together when sending
a message in a room, avoiding the need for global locks within the server.</t>
      <t><strong>TODO</strong>: Is this still true with Linearized Matrix? Can we really avoid locks, or are we going to need both active servers to behave the same?</t>
      <t>The steps needed for an existing system to be interoperable with another over Matrix would mean implementing portions of the Federation API.</t>
      <t><strong>TODO</strong>: Define that minimized API surface (much of the Federation API is actually for DAGs, which we don't care about here).</t>
    </section>
    <section anchor="encryption">
      <name>Encryption</name>
      <t>End-to-end Encryption is deliberately layered on top of the Matrix transport (Client-Server or Federation APIs).  Currently a combination
of Double Ratchet (Olm) encryption and group ratchet encryption (Megolm) is specified in the End-to-End Encryption section of the
Client-Server API <xref target="CSEncryptionApi"/>, but Matrix over MLS <xref target="I-D.ietf-mls-protocol"/> (with minor bookkeeping to compensate for the lack
of a centralised sequencing function in Matrix) is being specified as DMLS. <xref target="DMLS"/></t>
    </section>
    <section anchor="security-considerations">
      <name>Security Considerations</name>
      <t>TODO Security. Matrix has its own threat model that needs to be described here to protect against malicious actors (at the transport level).</t>
    </section>
  </middle>
  <back>
    <references>
      <name>Informative References</name>
      <reference anchor="CSEncryptionApi" target="https://spec.matrix.org/v1.4/client-server-api/#end-to-end-encryption">
        <front>
          <title>End-to-End Encryption | Client-Server API</title>
          <author>
            <organization>The Matrix.org Foundation C.I.C.</organization>
          </author>
          <date year="2022"/>
        </front>
      </reference>
      <reference anchor="DMLS" target="https://gitlab.matrix.org/matrix-org/mls-ts/-/blob/dd57bc25f6145ddedfb6d193f6baebf5133db7ed/decentralised.org">
        <front>
          <title>Decentralised MLS</title>
          <author initials="H." surname="Chathi" fullname="Hubert Chathi">
            <organization>The Matrix.org Foundation C.I.C.</organization>
          </author>
          <date year="2021"/>
        </front>
        <seriesInfo name="Web" value="https://gitlab.matrix.org/matrix-org/mls-ts/-/blob/dd57bc25f6145ddedfb6d193f6baebf5133db7ed/decentralised.org"/>
      </reference>
      <reference anchor="I-D.ralston-mimi-linearized-matrix">
        <front>
          <title>Linearized Matrix API</title>
          <author fullname="Travis Ralston" initials="T." surname="Ralston">
            <organization>The Matrix.org Foundation C.I.C.</organization>
          </author>
          <author fullname="Matthew Hodgson" initials="M." surname="Hodgson">
            <organization>The Matrix.org Foundation C.I.C.</organization>
          </author>
          <date day="25" month="March" year="2023"/>
          <abstract>
            <t>   Matrix is an existing openly specified decentralized secure
   communications protocol able to provide a framework for instant
   messaging interoperability.  Matrix rooms (aka conversations)
   currently use a Directed Acyclic Graph (DAG) for persisting events/
   messages.  Servers broadcast their changes to the DAG to every other
   server in order to create new events.

   This model provides excellent decentralization characteristics and
   conversation history replication, but proves complex when aiming to
   use Matrix strictly for interoperability between today's existing
   messaging service providers, which often do not persist chat history
   serverside, and do not seek to replicate it between servers.

   This document explores an API surface for Matrix which optimizes for
   ease of interoperability at the expense of decentralized conversation
   history at a per-room level.  We call this API surface "Linearized
   Matrix".

            </t>
          </abstract>
        </front>
        <seriesInfo name="Internet-Draft" value="draft-ralston-mimi-linearized-matrix-00"/>
      </reference>
      <reference anchor="I-D.ietf-mls-protocol">
        <front>
          <title>The Messaging Layer Security (MLS) Protocol</title>
          <author fullname="Richard Barnes" initials="R." surname="Barnes">
            <organization>Cisco</organization>
          </author>
          <author fullname="Benjamin Beurdouche" initials="B." surname="Beurdouche">
            <organization>Inria &amp; Mozilla</organization>
          </author>
          <author fullname="Raphael Robert" initials="R." surname="Robert">
            <organization>Phoenix R&amp;D</organization>
          </author>
          <author fullname="Jon Millican" initials="J." surname="Millican">
            <organization>Meta Platforms</organization>
          </author>
          <author fullname="Emad Omara" initials="E." surname="Omara">
            <organization>Google</organization>
          </author>
          <author fullname="Katriel Cohn-Gordon" initials="K." surname="Cohn-Gordon">
            <organization>University of Oxford</organization>
          </author>
          <date day="27" month="March" year="2023"/>
          <abstract>
            <t>   Messaging applications are increasingly making use of end-to-end
   security mechanisms to ensure that messages are only accessible to
   the communicating endpoints, and not to any servers involved in
   delivering messages.  Establishing keys to provide such protections
   is challenging for group chat settings, in which more than two
   clients need to agree on a key but may not be online at the same
   time.  In this document, we specify a key establishment protocol that
   provides efficient asynchronous group key establishment with forward
   secrecy and post-compromise security for groups in size ranging from
   two to thousands.

            </t>
          </abstract>
        </front>
        <seriesInfo name="Internet-Draft" value="draft-ietf-mls-protocol-20"/>
      </reference>
    </references>
    <?line 101?>

<section numbered="false" anchor="acknowledgments">
      <name>Acknowledgments</name>
      <t>TODO acknowledge.</t>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIAAAAAAAAA8VXW2/bRhZ+n18xUB5qe02qdpoUK6BIXctJXCR1YQno85A8
EgcectiZoRQ19X/vd2YomY7dIosFdv1ginM5l+9858Isy0TQwdBMTj6q4PQn
+ZG8V2uSS6da31kXJkIVhaPNPx4pVaC1dbuZ1O3KClHZslUNxFZOrULmlPHB
tlmjG501UUoW9rezb8+E74tGe69tG3Ydrl1fLd9K+ULino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