How the comparison stays private.

Two Envelopes compares two people’s numbers without either person, the relay or the developer ever holding both. This page explains how, in plain words, and where the protection ends.

The problem

Comparing two numbers usually means someone sees both. A website that takes each side’s figure, compares them and then deletes them still held both numbers, if only for a moment, and you’d have to trust that it really forgot them.

Two Envelopes is built so that nobody holds both numbers: not the other side, not you, not the relay that carries the messages, not the developer. The two phones do the comparison between themselves, on numbers that stay encrypted.

What happens when you seal

Before anyone seals, both sides see the same terms: what is being priced, the range of prices and the step between them, the number of rounds and the price rule. Every possible price sits on that grid.

When you hold to seal, your phone encrypts your number. The number is never saved: it exists only in memory while the comparison runs, and the app never shows it again. What leaves your phone is encrypted.

How two phones compare numbers they can’t read

The comparison uses homomorphic encryption, a kind of encryption that lets a device compute with numbers it can’t read. Two Envelopes uses Apple’s open-source homomorphic encryption library.

The phone that starts the check makes its own keys and encrypts its number with them. That encrypted message goes to the other phone, which can’t decrypt it. Instead, the second phone combines it with its own number, working only on encrypted values, to produce the answer: whether the two limits overlap and, if they do, the price. Before replying, it hides everything else in the result, so the reply carries the answer and nothing more.

Only the first phone can open the reply. It learns the answer, "Deal at" a price or "No deal", and passes it to the other side. Neither phone ever sees the other’s number.

Before it uses its own number, the second phone checks that the message was made under the rules both people agreed to, and refuses it if they differ. With the default fair draw, the price comes from randomness that both phones contribute and neither sees alone.

Rounds

With rounds, each of you seals once: a limit and, if you like, a start. Each round is one run of the same comparison, with each side’s position for that round. The first phone prepares one encrypted message per round, and the other phone answers them all at once with its own positions. The first phone then opens the replies in order and stops at the first deal. The rounds after it are never opened, and nobody can change a number after seeing an answer.

What travels, and who can see it

Over a link, the two phones exchange messages through a small relay on Cloudflare. Every message is encrypted on the phone with a key carried in the part of the link after the # sign, which is never sent to any server, so the relay can’t read the numbers or even the terms. It holds the encrypted messages, an invite id, their sizes and times, and hashes of two access keys. It deletes all of it when the check is answered or cancelled, and 72 hours after the link was made at the latest.

Because the link carries that key, treat it as the invitation itself: anyone who has it can read the terms, and the first phone to join is the one that seals. If someone else joins first, the person you meant to invite sees that it’s already sealed and needs a new link.

Across the table, two phones nearby talk directly over the local network, and nothing goes through the internet or the relay. When you pass one phone, the relay isn’t used either.

There is no account, no sign-in, no advertising, no analytics and no tracking. The receipt both phones sign records the terms, the answer, its round and when; it never holds either number. The privacy policy lists everything the app keeps and where.

Where the protection ends

The answer itself says something. A deal at a price tells the seller that the buyer’s limit is at least the price, and tells the buyer that the seller’s is at most the price. In a single round with the fair draw, that is all either side can work out for certain; with rounds, the round of a deal also says a little about where each side started. If you both choose the midpoint instead, a deal lets each side work out the other’s exact number, and the app warns you before you seal. If you seal first, the draw the other side sees is very slightly uneven: one price can be up to 1.25 times as likely as another. That can tilt a guess a little; it never narrows what can be worked out. Before every check, the app shows what each answer would give away, with your own numbers.

The comparison also assumes that the app on each side follows the protocol. Someone who changes their app could learn more than the answer. With rounds, the phone that starts the check is the one that opens the answers; a changed app there could open every round instead of stopping at the first deal, and learn where the other side stood in each. So seal with people you’d deal with anyway.

Questions

Can the developer see my number?

No. Your number is encrypted on your phone when you seal and is never saved. Over a link, the relay carries only encrypted messages it can’t read and deletes them when the check is answered or cancelled, or after 72 hours at the latest. Across the table, nothing goes through the internet.

Can the other side ever learn my number?

The answer always says something, and the app tells you what before you seal. With the default fair draw and apps that follow the protocol, a deal tells the other side only which side of the price your limit is on, plus a little about your start if you used rounds. With the midpoint, a deal lets them work out your exact number. Someone who changes their app could learn more than the answer.

What does the relay keep after the check?

Nothing. It deletes the encrypted messages and the invite’s record when the check is answered or cancelled, and 72 hours after the link was made at the latest. It never held a number, or even the terms, in a form it could read.

Coming soon to the App StoreSee what each answer reveals