Skip to content

Emoji verification shows the wrong emojis if the method is selected by the remote device #2292

Description

@AlexDicy

Checklist

  • I could not find a solution in the documentation, the existing issues or discussions.
  • I already asked for help in the chat

In which Project did the bug appear?

Matrix Dart SDK

On which platform did the bug appear?

All

SDK Version

6.1.1

Describe the problem caused by this bug

Suppose this Flutter device started the verification, and a remote device (Element web) accepts it.

When the user reaches the KeyVerificationState.askChoice stage, the "Emoji / SAS" verification method can be chosen.

If the user (this device) chooses the emoji method, the sas bytes are calculated correctly and the emojis correspond with the remote device.
However, if the remote device chooses the emoji method first, the emoji will be completely wrong and not correspond anymore.

This is caused by makeSas(int bytes) using the wrong order of users info, because this device started the verification, request.startedVerification will be true. However, because the remote device chose the emoji method instead, request.startedVerification should be false. (The opposite also applies).

If I manually set request.startedVerification to false in this Flutter device, the emoji will display correctly.

Client-side pseudo code:
_continuedVerification is set to true if this device chose the emoji method.

  @override
  bool shouldPopOnState(KeyVerificationState state) {
    if (state == KeyVerificationState.askSas) {
      verificationRequest.startedVerification = _continuedVerification; // FIX
    }
    return super.shouldPopOnState(state) || state == KeyVerificationState.askSas;
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions