Encryption
This page is for you as the person who runs the site. After reading it you know which parts of your site are encrypted, against whom, and what you can and cannot promise your viewers.
"Encrypted" means three different things on your site, and each protects against different people:
| Kind | Protects | Against | Covers |
|---|---|---|---|
| End-to-end encryption | Message contents | Everyone except the people in the conversation, including you, your server and Cloudflare | Direct messages started on the site, and any room where someone switched encryption on |
| Encryption in transit (TLS) | Everything a browser sends and receives | People on the network between the visitor and your front door | Every page, in both front door modes |
| Encryption at rest | Stored tokens, saved API keys, backups | Someone who gets a copy of the database or a backup without the keys | See Tokens and keys at rest |
End-to-end encryption
Your community rooms and direct messages run on Matrix, which has end-to-end encryption built in. In an encrypted conversation, each message is locked on the sender's device with keys that only the members' devices hold. The homeserver stores and passes on the locked message but cannot open it. The scheme is Matrix's standard one (Olm and Megolm), explained in Matrix.org: end-to-end encryption.
What is encrypted and what is not
| Part of the site | End-to-end encrypted? | Why |
|---|---|---|
| Direct messages started on the site | Yes. The site creates each one as a private room with encryption on from the first message. | A conversation between two people is nobody else's business, the operator's included |
| Direct messages started from another Matrix app | Whatever that app chose. Element switches it on by default. On the site, an unencrypted one shows Not encrypted with a button to switch encryption on. | The site did not create the room, so it did not choose |
| Community rooms, private or public | Off by default. The site creates rooms unencrypted, and this release has no room-encryption switch on the site; anyone allowed to change the room can switch it on from a Matrix app such as Element. An encrypted room shows a 🔒 beside its name. | Whoever creates a room decides. Element usually switches it on for private rooms it creates. |
The community space, #general and #forum |
No | They are public on purpose: anyone can join and read, and forum posts must be readable by signed-out visitors. The installer creates them unencrypted. |
| Forums | No | The site's server reads a forum for signed-out visitors, which it could not do if posts were locked |
| Site chat | No | It is a public stream chat. Messages are stored as typed, shown to mods and the stream overlays, and often cross-posted to platforms. |
| Platform chat (Twitch, Kick, YouTube, Streamplace) | No | It comes from the platforms, which are public chats |
| Supporter hidden messages | No. The real text is kept on the server. Supporters, mods and the author can reveal it. | It is a perk that hides text from people who are not supporters, not cryptography |
Once a room has encryption switched on, Matrix does not let anyone switch it off again.
What the server still knows
End-to-end encryption hides what is said, not that something was said. For encrypted conversations too, your homeserver knows:
- who is in each room and who talks to whom;
- when each message was sent, and roughly how long it is;
- display names, profile pictures and room names;
- which devices each account signs in from.
This is how Matrix works on every server.
What it means for you as the operator
- You cannot read encrypted direct messages or encrypted rooms. Nobody on your server can, and neither could anyone who broke into it.
- Mods cannot review an encrypted conversation. Moderating one relies on reports from the people in it.
- The chat bot, automod and the help desk never see encrypted messages.
- You cannot recover a viewer's encrypted messages for them. Not from the database, not from a backup, not with your backup passphrase.
The site's own Terms & Privacy page tells viewers the same: direct messages started on the site are end-to-end encrypted, and other rooms only if encryption was switched on for them.
Key backup and recovery keys
A viewer's keys live on their devices. So that a new phone or browser can read old messages, each account can keep a key backup on the homeserver: a copy of the keys, locked with that viewer's recovery key. The recovery key is made and shown in the viewer's own browser, and is never sent to the server. The server therefore holds only locked keys it cannot open.
How viewers set this up, verify devices and recover is on Encryption and your recovery key.
| Thing | Where it lives | Who can open it |
|---|---|---|
| Your recovery sheet (the backup passphrase) | With you, off the server, and in .env |
The install's backups. Nothing else: it is not anyone's chat key. |
| A viewer's recovery key | With the viewer only, ideally in a password manager. The site offers no place to store one. | The viewer |
| Their key backup | In the homeserver's database, locked with the recovery key | Only the recovery key, or one of their verified devices |
| Encrypted messages | In the homeserver's database, locked | Only the members' devices |
Your nightly backups include the homeserver's database, so they include every key backup and every encrypted message, still locked. What no backup contains, anywhere, is a key to open them. After a restore, encrypted messages come back still locked. Each viewer reads their old ones again with a device that still holds the keys, or with their recovery key. A viewer who has lost every signed-in device and their recovery key cannot read their earlier encrypted messages again, and no restore changes that. They can start fresh from their encryption settings, and new messages work as before. See Backups and restore.
There is no option to store viewers' recovery keys anywhere else, such as a bucket, and that is on purpose. Anything the server could reach to unlock messages would let the server read them, which is exactly what end-to-end encryption prevents.
Recommended: remind your community, for example in
#general, to save their recovery key in a password manager when they set up encryption. A viewer who loses every device and their recovery key loses their encrypted history for good, and you cannot help them get it back.
Encryption in transit
Every connection to your site is HTTPS. Where that encryption ends depends on your front door:
| Front door | The visitor's encrypted connection ends at | Who in between can read the traffic |
|---|---|---|
| Cloudflare tunnel (default) | Cloudflare | Cloudflare can. It unlocks each request and sends it to your server through the tunnel, which is itself encrypted. |
| Direct | Your server | Nobody between the visitor and your server |
In tunnel mode, Cloudflare can see pages opened, forms filled in, sign-ins and site chat messages as they pass. It cannot read card numbers (they go straight to Stripe or PayPal) or end-to-end encrypted messages (they are locked before they leave the device). Details and Cloudflare's privacy policy are on Cloudflare. If you would rather nobody sat in the middle, use direct mode.
Inside your server, the services talk to each other on a private network that cannot be reached from outside, without a second layer of encryption.
Next: Security for owners