FreeSpeech logoFreeSpeech

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.

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.

Contact card exchange with a one-time code
Contact exchange with a one-time code.

3. Sending a message

  1. The app signs the message with your key, then encrypts it for the recipient with an ephemeral key, new for every message.
  2. 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).
  3. If the recipient is connected, the relay passes the message on immediately.
  4. 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.
  5. 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.

Simultaneous connection to several servers
Simultaneous connection to all your relays.

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.

Group key renewal
Renewal of the group key.

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.

Attachments and Merkle tree
Checking each piece of a file.

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.

Client architecture
Client architecture.

Technical documentation →