Page MenuHomePhabricator

[native] Add support for saving encrypted media
ClosedPublic

Authored by bartek on Jan 28 2024, 7:40 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 23, 4:19 AM
Unknown Object (File)
Sat, Nov 23, 3:43 AM
Unknown Object (File)
Thu, Oct 31, 6:43 PM
Unknown Object (File)
Thu, Oct 31, 6:43 PM
Unknown Object (File)
Thu, Oct 31, 6:43 PM
Unknown Object (File)
Thu, Oct 31, 6:43 PM
Unknown Object (File)
Thu, Oct 31, 6:43 PM
Unknown Object (File)
Oct 1 2024, 1:23 AM
Subscribers

Details

Summary
  • Passed through encryptionKey and blobURI down to the saveRemoteMediaToDisk() function
  • In that function, added a separate flow for encrypted media. Basically, it has two steps:
    1. Download and decrypt media (decryptMedia()).
    2. Fetch MIME type

Depends on D10853

Test Plan
  • Tested on both Android and iOS
  • Tested on both images and videos
  • Also tested on prod keyserver inside Comm community, where prod app is crashing

Diff Detail

Repository
rCOMM Comm
Branch
barthap/media-save
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

bartek held this revision as a draft.
bartek published this revision for review.Jan 28 2024, 11:44 PM
ashoat added 1 blocking reviewer(s): atul.

Looks good to me, but I'd like @atul to take a look as well

native/media/image-modal.react.js
45–51 ↗(On Diff #36222)

Should we just remove the invariant? It wasn't needed prior to D7168. I think the typesystem should protect us if somebody adds a new type

53 ↗(On Diff #36222)

Nit: since we're only assigning one variable now, I think this is more readable

native/media/save-media.js
70 ↗(On Diff #36222)

Can you explain why all three of these need to be checked?

  • I guess mediaURI is the URI in the old system, before we had encryption
  • blobURI is the URI in the blob-service hosted system
  • I have some vague memory that holder is necessary because we changed names but never completed a full client migration of the types. Is that right?
This revision is now accepted and ready to land.Jan 29 2024, 9:55 PM
native/media/save-media.js
70 ↗(On Diff #36222)

Yes, basically you're all right:

  • mediaURI is a URI for non-encrypted media
  • blobURI is a URI for encrypted media
  • holder is an old name for blobURI. We did a rename some time ago but there can be some old multimedia messages that still use this field

Remove invariant and simplify destructuring uploadID