What's an "unverified device"? What's "cross device verification"?

published Feb 14, 2022

Matrix goes to great lengths to keep your conversations private. Here is a primer on how that works.

If you use Matrix, you might have seen onscreen something to the effect of unverified device or encrypted message at some point.  Here's what this means.

The Matrix network can't see the contents of your messages.  It accomplishes that with the following trick: when you talk to someone, a shared key is generated and stored in your device, and your conversation partner's device.  This key unlocks the messages — without this key, a snooper can't read them.

If you sign into Matrix using only one device, you don't need to know anything — everything just works.  There is only one key per conversation, it's stored in your device, end of story.  You can stop reading here.  If you are curious to know what those onscreen messages are, just jump to the end of this article, and read what they are.

How Matrix supports two or more devices of yours

However, if you have more than one device signed in, things get a bit more complicated.

Matrix uses per-device and per-conversation encryption keys.  There is a good reason for this.

The practical result of this decision, however, is that messages you typed in your phone would not be readable in your desktop computer, because they used different encryption keys.  Same with your conversation partners — if they sent you a message and their device only knew about your phone at the time, you would not be able to read this message in your desktop computer.  The message just appears as "message encrypted", and you can't read the contents.

To solve this issue, Matrix has a technology called cross-verification.  It's relatively complex to explain, but the key takeaway is this: nowadays, cross verification just works.  Here it is:

When trying to unlock encrypted messages, your device will request those encryption keys from other devices you own.  This happens whether the messages being shown are yours, or from someone else.

However, this opens the door for someone who steals your password to log in as you, and see and decrypt every single conversation from you, ever. This is obviously very bad in the context of wanting your conversations private.  And that's why Matrix does not do that without verification.

To solve this "your other device is legit" problem, cross-device verification is used.  When you sign in on a new device, your other devices are alerted that someone signed in as you (note how this is exactly what other service providers like Google do — they alert you to sign-ins from other places).  Before your other devices share encryption keys with your new device, you must complete cross-device verification, which is a super easy thing to do — you complete the cross-device verification process by checking that both devices see the same emojis.

This verification ensures two things:

  1. You know that there is another device logged in as you.
  2. Both devices haven't had their communications tampered or seen by a snooper.

The exact same process is used to verify other people's devices.   The first time you verify someone's Matrix name, this establishes mutual trust between your device and that someone's device.  Once that trust is established, all conversations with that person can in principle be unlocked going forward — if you talk on your phone with someone on their desktop, and you previously talked to him on your desktop with him being on his phone, and encryption keys to see past conversation messages are missing, then their desktop will fetch keys from their phone, and your phone will fetch keys from your desktop.

It's complex, but it just works nowadays. All you see onscreen by default is whether your conversation party is verified or not, and "encrypted message" for any messages in the conversation sent from other devices whose keys you do not yet have.

Knowing that background, we can explain what those onscreen messages are:

  • An "unverified device" is a device (phone, laptop, et cetera) that your other logged-in devices haven't yet verified as authorized.  Verify the device (if it's really you) and the message will go away.
  • An "encrypted message" is a message from a conversation that you haven't yet gotten keys to unlock.  Push the button onscreen to fetch the encryption keys, and — assuming your other device is connected to Matrix — they will shortly be decrypted.