userOwnsEncryptionKeys method

Future<bool> userOwnsEncryptionKeys(
  1. String userId
)

Checks if the given user has encryption keys. May query keys from the server to answer this.

Implementation

Future<bool> userOwnsEncryptionKeys(String userId) async {
  if (userId == userID) return encryptionEnabled;
  if (_userDeviceKeys.containsKey(userId)) {
    return true;
  }
  final keys = await queryKeys({userId: []});
  return keys.deviceKeys?[userId]?.isNotEmpty ?? false;
}