DocsData
End-to-end encryption
Messages and files the server stores and passes on but can’t read, with nothing for people to set up.
Sluurp can encrypt messages and files in the browser, so only the people they are for can read them: not the server, not an administrator, not anyone holding the database. People set nothing up and are asked nothing; their keys come with signing in. To encrypt and decrypt a message:
import { e2e } from "@sluurp/client/e2e";
e2e.configure(sluurp, me.id);
const body = await e2e.encryptText(`conversation:${id}`, "See you at nine", members);
const { text, verified } = await e2e.decryptText(`conversation:${id}`, body);Features include:
- Keys made and opened by signing in, with a password or a passkey
- One key per conversation or file, sealed for each reader
- Signatures, so readers know who wrote each message
- Search, from an encrypted index kept in each browser
Keys
Each person has a key pair to receive keys, and one to sign what they write, both made in their browser. The public halves are on their account, for others to use.
The private halves stay in the browser, and are kept on the account only locked with the person’s password, which the server never sees. An administrator, or anyone with a copy of the database, has the lock but not what opens it. In a swarm, the keys are on every node.
Sign in with a password
Signing in with a password does all of it:
- The first time, the keys are made.
- On a new device, they are opened with the password just typed.
- On a device that already has them, they are locked again with that password, so after a password reset the keys follow the new one.
Changing the password locks the keys with the new one, and signs the person out of every open page at once. Signing in again brings the keys back.
Sign in with a passkey
Someone who signs in without a password (with a provider such as Google, or an emailed link) uses a passkey instead:
- The first time, the keys are made, and a copy is locked with a new passkey.
- On a new device, the passkey, synced with their Google or Apple account, opens the keys after a fingerprint or face prompt. Nothing is typed.
The passkey gives a secret through WebAuthn’s PRF extension, and that secret never leaves the person’s devices, so the server can’t open this copy either. It works in Chrome, in Safari 18, and on Android 14 and later. In Safari, a passkey prompt needs a tap: if the prompt after a sign-in is refused, call e2e.unlockWithPasskey() from a button.
Someone whose keys were set up with a password can add a passkey too, so a later sign-in without the password still opens them. Both are a button away:
import { e2e } from "@sluurp/client/e2e";
import { toast } from "sonner";
import { Button } from "@/components/ui/button";
async function unlock() {
if (!(await e2e.unlockWithPasskey())) toast.error("No passkey opened your keys", { description: "Sign in with your password instead." });
}
async function addPasskey() {
if (await e2e.addPasskey()) toast.success("Passkey added", { description: "It opens your encrypted messages on your other devices." });
}
export const Encryption = () => (
<>
<Button onClick={unlock}>Unlock encryption</Button>
<Button variant="secondary" onClick={addPasskey}>Add a passkey</Button>
</>
);e2e.status() says which to show: locked asks for the first, and ready allows the second. Both throw when the browser has no passkey with PRF, or the person closes the prompt.
Passkeys in mobile apps
On Android and iOS, a passkey is tied to the site only once the site says which apps may use it. List them in apps.json, beside the app’s index.html. Sluurp serves /.well-known/assetlinks.json and /.well-known/apple-app-site-association from it:
{
"android": { "com.example.notes": "95:D1:97:28:…:73:81" },
"ios": ["ABCDE12345.com.example.notes"]
}An Android package names the SHA-256 fingerprint of the key it is signed with, or a list of them. An iOS app is its team id and bundle id. A file of the same name in the app’s own .well-known/ folder is served instead.
Someone who loses their password and their passkeys, with no device left that holds the keys, has lost what was encrypted to them. That is what end to end means.
What is encrypted together
A conversation or a file has one random key, sealed once for each person who may read it. Who wrote a message is proved by their signature, which each reader checks.
Someone may have no copy of a conversation’s key that opens: their keys were set up after it was sealed, or they made new keys. When they write, their browser asks for the key again, and the browser of anyone who holds it and has the app open seals it to their new keys. The message goes out a moment later, with nothing for your app to do. Until a holder answers, older messages show as not yet readable. The server keeps the request, and a holder’s copy may replace theirs only while it is open, so no member can swap another’s key for one of their own.
Search
The server can’t search what it can’t read. Each browser keeps its own index of what it has decrypted, itself encrypted, and e2e.search() looks there.