Chats that live on your devices, not on a server

A PeerChat room called Granite Lake trip on Alice's desktop and on Sam's phone, with replies, a mention and a photo of the lake

PeerChat is the chat app in PeerSky, on your computer and on your phone. There's no account, no phone number and no server. Pick a name, make a room and send its invite link in any app, or as a QR code from peersky.p2plabs.xyz/peerchat. The invite carries the room's key, so send it only to the people you want in the room.

It's for anyone who'd rather their conversations didn't go through a company: friends planning a trip, families, communities, classrooms, journalists and organizers. You don't give a phone number, so nothing ties the chat to it. Messages travel encrypted and straight between devices, a bit like a private tunnel between you and the people in the room, and no company keeps a copy to leak, sell or hand over. When the internet goes down, people on the same Wi-Fi keep talking.

One thing to know: devices connect to each other directly, so people in a room can see your IP address, as in any peer-to-peer app. If you'd rather they didn't, turn on a VPN that allows peer-to-peer connections.

Most chat apps run through a server. It delivers every message, keeps the history, knows who's who and enforces the rules. PeerChat has no server, so the devices in a room do all of that between themselves.

You need PeerSky on each device. Get it for your computer and your phone at peersky.p2plabs.xyz.

The room's info on Alice's desktop with its invite link, rules and members, and Sam's phone asking Join this chat?
The room's info has its invite link and its rules. PeerSky asks before it joins.

What a server does, and what PeerChat does instead

Take the server out of a chat app and its jobs don't go away. Someone still has to find people, let them in, carry the messages and keep the history. In PeerChat, the devices in the room share those jobs.

Finding each other

With a serverIt knows who's online and connects them.

In PeerChatDevices find each other on HyperDHT, a public peer-to-peer network, by a code made from the room's key that opens nothing, then connect directly. On the same Wi-Fi, they find each other with mDNS, no internet needed.

Letting people in

With a serverIt checks your password.

In PeerChatA device proves it holds the room's key before it gets anything. The proof only works on that one connection, so it can't be copied.

Delivering messages

With a serverEvery message goes up to it, then down to everyone.

In PeerChatMessages go straight between devices. In a big room, each device passes new messages on, so they reach people the writer never connected to.

Proving who wrote it

With a serverIt vouches for the sender, because they logged in.

In PeerChatEvery message is signed with its writer's key, and every device checks the signature. Nobody can fake a message, or change one they pass on.

Keeping the history

With a serverIt stores everyone's messages.

In PeerChatThe devices in a room keep its history, sealed, and share it with each other. In new rooms, someone who joins reads from the hour they joined.

Moderation

With a serverIt bans people and filters messages for everyone.

In PeerChatEvery device runs the room's filters and limits itself. A removal signed by the room's creator is passed on until it reaches everyone.

Staying up

With a serverWhen it goes down, nobody can chat.

In PeerChatA room works as long as two people in it are online. On the same Wi-Fi, it works without internet.

How a message crosses a big room

Say Sam writes to a room that Bob and Alice are in. The message is sealed on Sam's phone before it goes anywhere, and it's only opened on the devices of the people in the room.

A device opens up to 64 connections itself, and others can connect to it too, so in a big room it ends up with about a hundred. A room has no limit on how many people it holds. In a room of hundreds or thousands, most people still aren't connected to each other. Each device passes every new message on once, to the others it's connected to in the room. A copy it has already seen stops there, so a message crosses the whole room in a few steps.

Every message carries its writer's signature. Alice's laptop checks it before it shows Sam's message, so it knows Sam wrote it and that nobody changed it on the way, whoever passed it on.

Limits count per writer, not per connection. Each person gets the room's spam limit wherever their messages come from, so a device passing on a busy room is never blamed for what others wrote.

A new key every hour

New rooms change their lock every hour. Each hour's messages are sealed with a new key, made from the one before it, and there's no way to work back to an earlier one.

So someone who joins later, or gets hold of a forwarded invite, can't read anything from the hours before they arrived. If a phone is lost, move to a new room, since a key still opens every hour after its own.

New rooms are the ones made with PeerSky Mobile 0.1.2 and the desktop release that comes with it. Older versions can't open them, so update PeerSky on every device. Rooms made before, P2P Republic among them, keep one key, so every version can still read them.

Moderation

With no server to do it, every device enforces the room's rules itself. Whoever makes a room picks them: an abuse filter, a filter for profanity and slurs, and a spam limit. Links to adult sites are always blocked. They show in the room's info, and only the person who made the room can change them, or the room's name, description, link and picture. Those details are signed with their key too, so every device can tell they came from them.

Each device checks what it sends and what it receives. A message that breaks the rules is stopped before it's sent, and checked again on every device that receives it. Pictures are checked the same way, on the device that sends them and on every device that gets them. Someone who keeps breaking the rules gets a warning, then is shut out of the room for a while.

The person who made the room can remove someone. The removal is signed with their key and passed on like a message, so it reaches every device in the room, even ones that never connected to them, and every device refuses that person's messages from then on. The room also moves to a new key that everyone still in it follows on their own, so the person removed is left behind with the old one. If they've linked several devices with Link Device, removing one removes them all, along with any of theirs that shows up later. Anyone can also block someone, or report them.

One person, several devices

With Link Device, the same profile runs on your phone and your desktops. Each device keeps its own key and joins your rooms as itself, so each one gets every message straight from the room, with no device in the middle. On the device where you picked your name, it shows as just ada. Your other devices add a label, ada@mobile on your phone and ada@desktop1, ada@desktop2 on more desktops, so people can tell which device a message came from.

Your devices know each other by a secret only they share, from Link Device. Rename yourself on one and the others follow. Join a room on one and it shows up on the rest. And there's a chat with yourself, called You, for sending a page or a note from your phone to your laptop.

No internet, same Wi-Fi

Every room is joined twice: on HyperDHT across the internet, and on a separate swarm on your local network that devices find with mDNS, using our hyperdht-mdns. The local one needs no public server to start from, so with the internet down, everyone on the same Wi-Fi keeps chatting. It needs a network, not an internet connection. We tried it by pulling the cable out of our modem, and the chat on our Wi-Fi kept going.

For the technical details, read:

Try it with the people you already talk to. Get PeerSky at peersky.p2plabs.xyz, then come say hi in P2P Republic, our public room.