Direct messages
One-to-one chats use Olm from the vodozemac library, a double ratchet. Every message gets a fresh key, so one stolen key can't unlock past messages (forward secrecy) and the chat heals itself after a compromise (break-in recovery).
Groups
Groups use MLS, the IETF standard for group messaging (RFC 9420), through OpenMLS. Each device is a member, and adding or removing someone changes the group's keys.
One core for every platform
The encryption is written once, in Rust, and runs on the web through WebAssembly and on Android and iPhone through native bindings. A shared set of test messages, made by the native build, must open on every platform, which proves a phone and a browser can always talk to each other.
What the server sees
The server stores and relays encrypted data only. It never has the keys to read messages, photos or voice notes.