FreeSpeech logoFreeSpeech

Technical documentation

For anyone who wants to check how FreeSpeech works, or reimplement it. The full documents are in the code repository, in French and English. For a plain-language explanation, see the How it works page.

The documents

DocumentWhat it contains
sources/doc/en/PROTOCOL.en.mdThe protocol: identity, contacts, messages, attachments, groups, multi-server, push, WebSocket transport.
sources/doc/en/ARCHITECTURE.en.mdThe parts of the software, how messages are protected, encrypted storage on the device, the database layout, and above all security and its known limits.
sources/doc/en/INSTALL_RELAY.en.mdSetting up your own server, public or private (Ubuntu guide: ASP.NET Core 10, nginx, automatic start with systemd).
sources/doc/en/ADMINISTRATION.en.mdAdministering a relay or a push gateway without a restart: invitations, bans, sibling servers, logs, tracing.
sources/doc/en/INSTALL_PUSH.en.mdInstalling the push gateway (one key per relay, maintenance, limits).
sources/doc/en/INSTALL_DIRECTORY.en.mdSetting up a server directory (signed list, reporting of linked servers).
sources/doc/diagrams/14 explanatory diagrams, in French and English.

Every document exists in French (.md) and in English (.en.md).

How messages are protected, in brief

These technical names will mostly matter to specialists. The last column summarises what each item is for.

UseTechniqueWhat it does, in plain words
Identity (keys made from 3 phrases)Argon2id (32 MiB, t = 3), then HKDF-SHA256Derives your keys from the three phrases, using a deliberately slow calculation to discourage any attempt to guess them.
Key of a messageEphemeral X25519 per message, then HKDF-SHA256Generates a brand-new key for every message, which only the sender and the recipient can compute.
Encrypting the messageChaCha20-Poly1305Makes the message unreadable to others and detects any change.
SignatureEd25519, tied to the sender, the recipient and the message typeProves who wrote the message and that it was not altered on the way.
GroupsKey shared per period, renewed whenever the members changeOne key common to the group, changed as soon as someone joins or leaves.
Attached files48 KiB pieces, SHA-256 Merkle treeLets you check every piece of a received file.
Data on the deviceSQLite, content encrypted field by field, key derived from the phrasesYour data stays encrypted on your device.
Between serversHMAC-SHA256 signed requests, 120 s window, one-time codeServers identify themselves to each other, and an intercepted request cannot be replayed later.

These mechanisms are implemented with the BouncyCastle library (managed code, usable on Android as well as iOS) and verified against fixed test vectors.

What FreeSpeech protects, and what it does not

What is protected

What is not (known limits)

To report a security flaw: contact@rebisway.com.

Hosting your server

A relay is an ASP.NET Core 10 application behind an HTTPS web server (nginx for us; any other will do), on Linux, Windows or macOS. It stores no message. A private relay needs no declaration: give its address in your contact card. A public relay can team up with other public relays by exchanging a shared secret (an allow-list administered by hand). A private relay can also receive only the people it has invited. The step-by-step guide is in sources/doc/en/INSTALL_RELAY.en.md; day-to-day management is in sources/doc/en/ADMINISTRATION.en.md.

Example server address: https://relay.example.org (in the app: Settings → Servers → add).

A client moving to a sibling server
A client moving to a sibling server.
Notifications through several gateways
Notifications: several gateways and a circuit breaker.

Licence

FreeSpeech is free software. The code is published under the GNU AGPL v3 or later: you may study, modify and redistribute it under its terms. Since a server is a network service, anyone who runs a modified version must provide its source code to its users. A separate commercial licence is available on request, to embed FreeSpeech in a product that cannot comply with the AGPL: contact@rebisway.com.