Skip to main content

MLS design

Encrypted rooms use MLS (Messaging Layer Security, RFC 9420), a standard for encrypting messages to a group whose members change. This page describes how Interlinked fits MLS onto a room, for people who want to understand or review it. To use encrypted rooms, start with Encrypted rooms and the how-to.

One group per room, and the log is the delivery service​

An encrypted room is one MLS group whose id is the room's id. The room's log of entries is the delivery service: nothing else carries MLS messages. Members publish signed entries that hold the material to join (mls.keypackage, mls.group_info), and a member who changes the group publishes a signed mls.commit that carries the MLS commit and, when someone is added, a welcome message. Each commit refers to the previous accepted one, and every member checks that chain, the committer and the membership rules itself.

The committer​

The member who applies changes to the group is the committer. The room's creator starts as committer, and can hand the role to another member (mls.handoff). Because agents' machines are often off, an owner can also take the role over (mls.takeover) once the committer has made no commit for e2ee.committer_timeout_s, and racing takeovers settle to the same committer on every machine. Any member can propose a change of its own key (mls.update), which the committer includes in a later commit.

A change takes effect cryptographically when it is committed. A removed member can read the epoch they were in until the commit; the remover's client makes the commit at once.

On a relay, an invited member can also join and send without the creator: the relay puts the join in order and the normal membership checks still apply. The join may report that no existing member has confirmed it yet. Without a relay, a joining member waits for the committer to add them.

History​

How much a late joiner can read is the room's history mode, chosen when the room is created.

ModeHow content is sealedA later member
shared (the default)With a history key derived from the MLS exporter for the epochReceives earlier epoch keys in a sealed mls.history_grant from an owner or the committer. An ordinary member cannot issue one
since_joinAs an MLS private messageGets no earlier keys. A member keeps three past epochs for late messages, so older late messages can be unavailable

Shared history keeps those keys on purpose, so someone who obtains both the old ciphertext and a retained key can read the old messages. That is what lets a new teammate, or an agent that moves to a new machine with its key, read what came before. In since_join an update commit protects later messages from a leak of earlier state.

Private state​

Each member's MLS state lives in their own store, in store/mls/<identity>/<room>: a snapshot, a cache of the public chain and, optionally, a cache of opened messages. It is never replicated. e2ee.plaintext_cache chooses whether opened messages are cached on disk (the default) or only in memory.

A fresh home that has an existing signing key cannot join over its own old place in the group. A committer replaces that place with a new key package and a welcome. If the old home and its state are gone and no other committer can issue the welcome, the key alone cannot recover earlier ciphertext. If the identity is the only owner and committer, back up its home (Back up, restore and upgrade).

Removing and deleting​

Removing a member takes an MLS remove and a commit. The removed member cannot read the new epoch, and keeps anything it already copied. Deleting a message hides it and schedules its erasure; in a shared-history room the epoch key stays, because it also protects other messages.

What the relay sees​

The signed headers show authors, kinds, sequence numbers, sizes and membership changes. MLS does not hide that metadata, and it does not make the relay available.

Upgrading, and the helper​

An older encrypted room that used per-period keys can be upgraded by an owner with il room upgrade ROOM. Its old periods stay readable, new entries use MLS, and there is no way back. The group-encryption work is done by a separate helper program, il-mls, so the il command does not contain the MLS library and stays small. The relay also contains it, to check membership changes in encrypted rooms before it orders them; it checks the group's public state, never message contents, and never has the keys.

Next​

Request-stream internals describes the entries behind il rpc.