How FreeSpeech works
The app does almost all the work. The server, called a relay, simply relays: it puts two devices in touch so the message gets through, then it forgets.
1. An identity without an account
When the identity is created, the app draws three phrases at random. From them it computes (Argon2id, then HKDF) a key pair for encrypting and a key pair for signing. Your identifier is the fingerprint of your public keys.
- Nothing is sent to a server to “create” the identity: it exists as soon as you have your phrases.
- Typing the same phrases on another phone gives the same identity: that is how you change device or use several.
- The phrases are never kept in the app. Back them up (on paper, or in a password-protected file): without them, the identity cannot be recovered.
2. Becoming contacts
Two people swap a contact card (public keys, nickname, list of servers), by QR code when they are together, or by a copied message from a distance. The card is protected by a single-use code, valid for 10 minutes for a QR code and 30 days for a copied card. You can then compare a safety number, identical on both sides, to make sure nobody slipped into the exchange.
3. Sending a message
- The app signs the message with your key, then encrypts it for the recipient with an ephemeral key, new for every message.
- It sends it to a relay over a WebSocket connection (a connection that stays open between the app and the relay). The relay reads only the envelope (sender and recipient).
- If the recipient is connected, the relay passes the message on immediately.
- If they are offline, the relay stores nothing. The message stays in your device's send queue and a notification wakes the recipient up; as soon as they reconnect, the message is sent.
- The recipient checks the signature and decrypts the message.
Notifications never contain the message: they only ask the app to connect.
4. Several relays
A relay is not a central point. Your contact card lists your relays in order of preference; your device connects to all of yours simultaneously and, to send a message, tries your contact's relays in that order.
- Public relays can recognise each other (a list of accepted relays, signed requests) and pass a message on when the recipient is connected elsewhere.
- A private relay (company, association, family) is listed nowhere: only the people you give your card to know its address.
- If a relay goes down, sending goes through another one. If a relay is overloaded, it can redirect you to a sibling relay; the app then tells your contacts your new address.
5. Groups
The members of a group share a key, renewed on every addition, removal or departure: a removed member cannot read what follows. There is no group server: each message is sent to every member, and an absent member retrieves what they missed from the other members, even if the author has left the group. An invitation only counts once the invited person has accepted it.
6. Photos and files
The message only announces that a file exists. The recipient requests it, and the file arrives in 48 KiB pieces, each with a proof that allows its authenticity to be checked (a Merkle tree). In a group, any member who already has the file can supply part of it, which relieves the sender. Images are shrunk before sending and videos are recompressed.
7. Inside the app
All the logic (identity, encryption, servers, groups, files, storage) lives in a library with no interface; the mobile app is limited to display. Data is kept in an encrypted local database.
FreeSpeech