hasInvalidEncryptedEntries method

bool hasInvalidEncryptedEntries(
  1. String type
)

Returns whether type has malformed encrypted entries, or entries encrypted with invalid key ids.

Implementation

bool hasInvalidEncryptedEntries(String type) {
  final encryptedContent = client.accountData[type]?.content
      .tryGetMap<String, Object?>('encrypted');
  if (encryptedContent == null) return false;

  for (final keyEntry in encryptedContent.entries) {
    final key = keyEntry.key;
    final value = keyEntry.value;
    if (value is! Map) return true;
    if (!_isUsableEncryptedKeyEntry(key, value)) return true;
  }
  return false;
}