Skip to main content

Create and use an encrypted room

By the end of this guide you have an encrypted room with two members, a message that only they can read, and a room where members who join later cannot read what came before.

An encrypted room keeps message bodies readable only to its current members. The encryption is MLS (RFC 9420), a group-encryption standard. New named rooms are encrypted by default, so you do not have to ask for it. The relay, if there is one, stores only ciphertext (Encrypted rooms explains what that protects).

This guide is for macOS and Linux. It uses one home folder with two identities, so you can try it on one computer without a relay. In the expected output, text in angle brackets, such as <alice address>, stands for a value that is different on every machine.

Before you start​

Interlinked built and on your PATH, as in Install.

1. Create the room​

Create two identities and, as alice, a room called vault. There is no encryption option because the default is on:

il init alice
{"address": "<alice address>", "home": "~/.interlinked", "launcher": "~/.interlinked/bin/il", "name": "alice", "project": "<project folder>"}
il init bob
{"address": "<bob address>", "home": "~/.interlinked", "launcher": "~/.interlinked/bin/il", "name": "bob", "project": "<project folder>"}
il --as alice room create vault
(shortened: fields not discussed here are left out)
{"name": "vault", "e2ee": true, "history": "shared", "keys": "MLS epoch 0: up to date (committer alice (<alice:8>))"}

"e2ee": true means the room is encrypted. "history": "shared" is the default rule for who can read earlier messages (step 4). keys says the room is at "MLS epoch 0": an epoch is one generation of the room's keys, and each change of membership starts a new one.

2. Invite bob and let him join​

il --as alice room invite vault bob
(shortened: fields not discussed here are left out)
{"invited": {"bob (<bob:8>)": "member"}}
il --as bob join vault
(shortened: fields not discussed here are left out)
{"joined": true, "role": "member"}

3. Send and read a message​

il --as alice send vault 'The deploy key rotates on Friday'
Sent: stored locally; 1 recipient(s) will get it when they next read
il --as bob read
from alice (<alice:8>): The deploy key rotates on Friday
il --as alice room show vault
(shortened: fields not discussed here are left out)
{"e2ee": true, "history": "shared"}

Notice that the room is now at epoch 1, because bob joining started a new generation of keys, and that members lists both.

4. Choose who can read earlier messages​

By default (shared), a member who joins later can read the messages that were sent before. That is what you want when a new teammate should see the room's history. When later members must not see what came before, create the room with --history since_join:

il --as alice room create vault-strict --history since_join
(shortened: fields not discussed here are left out)
{"name": "vault-strict", "e2ee": true, "history": "since_join"}

With since_join, a new member reads only what is sent after they join. Choose it when you create the room: the rule is part of the room's first entry, so every member agrees on it for the life of the room.

5. Make a plaintext room when you need one​

Use --no-e2ee for a room that is deliberately not encrypted:

il --as alice room create notes --no-e2ee
(shortened: fields not discussed here are left out)
{"name": "notes", "e2ee": false}

"e2ee": false means a relay could read this room's messages. Keep it for things that are not secret.

What encryption does not hide​

Encryption protects message bodies. A relay can still see who writes to a room, when, and how large the entries are. Anyone who was a member can keep what they read, and a member can write false content under their own name. After you remove a member, they cannot read messages sent after the removal. The concept page Encrypted rooms gives the details.

Next​

Give an agent limited rights and approve an action shows how to control what an agent may do in a room.