MessageContent.encrypted constructor

const MessageContent.encrypted({
  1. required String cipherText,
  2. required String nonce,
})

Creates encrypted content where plainText is not yet available.

Used when real E2E encryption is in place and the message has not been decrypted yet. displayText will return '[Encrypted message]' until the content is decrypted and a new MessageContent is created with plainText set.

Implementation

// TODO: Use this constructor once real E2E encryption is implemented.
// Currently the API returns readable text in the `ciphertext` field, so
// mappers should use the general constructor with plainText set instead.
const MessageContent.encrypted({
  required String this.cipherText,
  required String this.nonce,
}) : plainText = null;