knownVerificationMethods property

List<String> get knownVerificationMethods

Implementation

List<String> get knownVerificationMethods {
  final methods = <String>{};
  if (client.verificationMethods.contains(KeyVerificationMethod.numbers) ||
      client.verificationMethods.contains(KeyVerificationMethod.emoji)) {
    methods.add(EventTypes.Sas);
  }

  /// `qrCanWork` -  qr cannot work if we are verifying another master key but our own is unverified
  final qrCanWork = (userId != client.userID)
      ? ((client.userDeviceKeys[client.userID]?.masterKey?.verified ?? false)
          ? true
          : false)
      : true;

  if (client.verificationMethods.contains(KeyVerificationMethod.qrShow) &&
      qrCanWork) {
    methods.add(EventTypes.QRShow);
    methods.add(EventTypes.Reciprocate);
  }
  if (client.verificationMethods.contains(KeyVerificationMethod.qrScan) &&
      qrCanWork) {
    methods.add(EventTypes.QRScan);
    methods.add(EventTypes.Reciprocate);
  }

  return methods.toList();
}