Skip to content

Implement a way to ensure SSSS setup before providing access to chats #2037

@TheOneWithTheBraid

Description

@TheOneWithTheBraid

Preflight Checklist

  • I could not find a solution in the existing issues, docs, nor discussions

Describe your problem

As a matrix client developer in healthcare, I try to make matrix clients as easy to use as possible. I want users not to notice it is technically possible to send messages from an unverified session. I therefore want to ensure a session has encryption set up, SSSS access and is cross signed before allowing the users to actually see their chats, conversations or whatever other information. I'd also expect this to seamlessly work when the user closes the application during SSSS bootstrap or key verification e.g. because they notice their other device is not right available or they're looking for the recovery key somewhere.

Describe your ideal solution

As a matrix client developer, I'd like to have a high-level stream similar to the login state I can listen on. The stream should always provide the current session bootstrap state containing the information from :

  • Client.isUnknownSession
  • CrossSigning.isCached()
  • KeyManager.isCached()

Such a class could look like :

class SessionEncryptionHealth {

  final bool crossSigningCached;
  final bool keyManagerCached;
  final bool isUnknownSession;

  const SessionEncryptionHealth({
    required this.crossSigningCached,
    required this.keyManagerCached,
    required this.isUnknownSession,
  });

  bool get isAuthorized => crossSigningCached && keyManagerCached && !isUnknownSession;
}

This stream should work a) when offline and provide the best guess about the health state, b) provide information as early as possible (likely before Client.init() eventually completes the first sync asynchronously) and c) update with every change of the corresponding information.

As a client developer, I can thereafter wait for a healthy state according to the new stream and simplify the UI logic enforcing verified sessions.

Version

matrix Dart SDK v0.38.0

Security requirements

I guess this is actually a good simplification approach for present session verification mechanisms and therefore encryption health for all matrix clients making use of it.

Additional Context

Customer: x-tention

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions