Security codes

Compare a security code with someone to be sure their keys are really theirs: how to compare, what verified means, and the difference between a warning and the change after a reset.

3 min read

Your Flaq server hands out everyone's public keys. A dishonest or compromised server could try to hand out keys of its own instead, and read what is sent to them. Your app watches for that by itself, and a security code lets two people check it for certain: if your codes match, the keys are really each other's.

What a security code is#

A security code is made from both people's current keys: twelve groups of five digits, the same on both sides. Each person's half is the same in every code they are part of. If the server swapped anyone's keys, the code on one side would differ from the code on the other.

Compare codes#

  1. Open the security code: in your direct message with the person, or in the members list of a channel or group (the member count in the conversation's bar), where each member has theirs.
  2. Compare the twelve groups with the other person in person or on a call, somewhere the server can't stand in between. Comparing over a Flaq message proves nothing, since that message goes through the same server.
  3. If every group matches, choose Mark as verified. The dialog then says that you and that person compared the code and it matched.

The other person does the same on their side.

What verified means#

The record of a verification holds the code itself, so it lapses by itself when either person's keys change. A verified mark always means the keys you see now are the ones you compared.

When someone's code changes#

Your app remembers each person's keys the first time it sees them, and compares every later answer from the server. There are two kinds of change, and the app shows them differently:

What happened What the app shows
A newer identity, after a password reset A quiet notice in your direct message with them: their security code changed, usually because their password was reset. You can dismiss it
The same identity with different keys A warning over the conversation, in its bar and in the security code, until the two of you compare codes again. In the members list, they are marked

The expected change. A password reset gives a person new keys, because only their old password opens their old ones. Their next sign-in makes a new identity with a higher version, and your app shows the quiet notice. If you had verified them, compare codes again when it suits you.

The warning. Keys that changed without a new identity are not expected. Don't send anything sensitive to that person until you have compared codes with them, in person or on a call. Verifying after a warning accepts the keys the server lists now, so do it only once the codes match.

One code on every server#

Your security code is made from your account id, which your account keeps on every server, and your keys, which are the same on every server. So two people have one code wherever they meet: verify Ana once, and she is verified on every server you share.

Codes compared before accounts across servers existed changed once with it, and need comparing again. A person with a separate account on another server, with keys of its own, has a different code there.

What your app checks without you#

  • It pins every identity version of each person the first time it sees them, in a file for each server and account, and forgets them when you sign out.
  • When a direct message opens, it asks for the other person's keys and compares them with what it pinned.
  • It checks that the keys the server lists for you are the ones your app holds.

See How encryption works for the rest of the picture.