Skip to content

Commit 5617322

Browse files
committed
FileMessageBuilder: Improve documentation about blob handling
1 parent 570a95f commit 5617322

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/types.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,10 @@ pub struct FileMessageBuilder {
173173
impl FileMessageBuilder {
174174
/// Create a new [`FileMessage`] builder.
175175
///
176-
/// Before calling this function, you need to symmetrically encrypt the file
177-
/// data (libsodium secretbox, random key) and upload the ciphertext to the
178-
/// blob server. Use the nonce `000...1` to encrypt the file data.
176+
/// Before calling this function, you need to symmetrically encrypt the
177+
/// file data with [`encrypt_file_data`](crate::encrypt_file_data) and
178+
/// upload the ciphertext to the blob server with
179+
/// [`blob_upload`](crate::E2eApi::blob_upload).
179180
///
180181
/// The `file_blob_id` must point to the blob id of the uploaded file data,
181182
/// encrypted with `blob_encryption_key`.
@@ -216,18 +217,18 @@ impl FileMessageBuilder {
216217

217218
/// Set a thumbnail.
218219
///
219-
/// Before calling this function, you need to symmetrically encrypt the
220-
/// thumbnail data (in JPEG format) with the same key used for the file
221-
/// data and with the nonce `000...2`.
220+
/// Before calling this function, you need to encrypt and upload the
221+
/// thumbnail data along with the file data (as described in
222+
/// [`FileMessageBuilder::new`]).
222223
pub fn thumbnail(self, blob_id: BlobId, media_type: impl Into<String>) -> Self {
223224
self.thumbnail_opt(Some((blob_id, media_type)))
224225
}
225226

226227
/// Set a thumbnail from an Option.
227228
///
228-
/// Before calling this function, you need to symmetrically encrypt the
229-
/// thumbnail data (in JPEG format) with the same key used for the file
230-
/// data and with the nonce `000...2`.
229+
/// Before calling this function, you need to encrypt and upload the
230+
/// thumbnail data along with the file data (as described in
231+
/// [`FileMessageBuilder::new`]).
231232
pub fn thumbnail_opt(mut self, blob: Option<(BlobId, impl Into<String>)>) -> Self {
232233
match blob {
233234
Some((blob_id, media_type)) => {

0 commit comments

Comments
 (0)