RoomEncryptedContent.fromJson constructor

RoomEncryptedContent.fromJson(
  1. Map<String, Object?> json
)

Implementation

RoomEncryptedContent.fromJson(Map<String, Object?> json)
    : algorithm = json.tryGet('algorithm', TryGet.required) ?? '',
      senderKey = json.tryGet('sender_key', TryGet.required) ?? '',
      deviceId = json.tryGet('device_id'),
      sessionId = json.tryGet('session_id'),
      ciphertextMegolm = json.tryGet('ciphertext', TryGet.silent),
      // filter out invalid/incomplete CiphertextInfos
      ciphertextOlm = json
          .tryGet<Map<String, Object?>>('ciphertext', TryGet.silent)
          ?.catchMap(
            (k, v) => MapEntry(
              k,
              CiphertextInfo.fromJson(v as Map<String, Object?>),
            ),
          );