famedly / matrix-dart-sdk

Matrix SDK written in pure Dart.
GNU Affero General Public License v3.0
59 stars 31 forks source link

#64 ⁃ Ensure direct chats don't have more than two accounts before sending E2EE verification messages #248

Open famedly-bot opened 2 years ago

famedly-bot commented 2 years ago

In GitLab by @Mikaela on Nov 13, 2021, 11:42

Soru requested me to report that verification messages should ensure direct chat doesn't have more than two users as it just kept failing due to sending messages to room of more users with other devices sending reject messages. I commonly have three or more accounts in direct chats and consider private rooms between just a few people as direct chats.

famedly-bot commented 2 years ago

In GitLab by @h.carnot on Apr 6, 2022, 17:48

This was discussed but for record:

The spec doesn't specify the number of user that are allowed in a room where we send a E2EE verification message. The only problem is that you are going to verify the first user who accept the user verification request.

Mar-Ga commented 1 year ago

@famedly/instant-messaging is this still an issue or can we close this

nico-famedly commented 11 months ago

No, this is still an issue: https://github.com/famedly/matrix-dart-sdk/blob/31a52cb463b404b7a7ade3e3657f09770185a573/lib/src/utils/device_keys_list.dart#L80

That call to startDirectChat might return an existing DM where someone else got invited to.

krille-chan commented 8 months ago

So to fix this I would suggest that we change the method startDirectChat() with a new optional parameter like this:

  /// Returns an existing direct room ID with this user or creates a new one.
  /// By default encryption will be enabled if the client supports encryption
  /// and the other user has uploaded any encryption keys.
  Future<String> startDirectChat(
    String mxid, {
    bool? enableEncryption,
    List<StateEvent>? initialState,
    bool waitForSync = true,
    Map<String, dynamic>? powerLevelContentOverride,
    CreateRoomPreset? preset = CreateRoomPreset.trustedPrivateChat,

    /// Does not return existing DM rooms which have more than two members.
    bool ensureIsOnlyTwoMembers = false,
  })

and then set ensureIsOnlyTwoMembers: true when using this method in startVerification() method.