Page MenuHomePhabricator

[native] Calculate SHA256 of encrypted blob
ClosedPublic

Authored by bartek on Apr 27 2023, 3:53 AM.
Tags
None
Referenced Files
F3392184: D7647.id26176.diff
Sat, Nov 30, 7:23 AM
Unknown Object (File)
Wed, Nov 27, 8:45 AM
Unknown Object (File)
Wed, Nov 27, 8:36 AM
Unknown Object (File)
Wed, Nov 27, 5:38 AM
Unknown Object (File)
Mon, Nov 25, 8:46 PM
Unknown Object (File)
Mon, Nov 25, 8:46 PM
Unknown Object (File)
Mon, Nov 25, 8:46 PM
Unknown Object (File)
Mon, Nov 18, 9:03 PM
Subscribers

Details

Summary

We need the blob hash in order to upload the encrypted blob to Blob service.
According to whitepaper, we use SHA256 to calculate the hash of encrypted blob.

Exposed the calculated SHA256 within encryption result payload.

Test Plan

Added console.log and sent encrypted video message. Verified that both video and thumbnail have blobHash field.

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

bartek held this revision as a draft.
bartek published this revision for review.Apr 27 2023, 4:36 AM
bartek added inline comments.
web/media/encryption-utils.js
72

This will be set in one of the web-part stack diffs

atul added inline comments.
lib/types/media-types.js
270

We need the blob hash in order to upload the encrypted blob to Blob service.

Should sha256 be string instead of ?string?

EDIT: Looks like we can make this string after web/media/encryption-utils.js is updated?

native/media/encryption-utils.js
110–115

Would it make sense to have a different reason instead of "encryption_failed" if computing sha256 fails (not sure in what scenario this would happen)?

185–189

We could destructure these fields from encryptionResult, but whatever you prefer

This revision is now accepted and ready to land.May 3 2023, 10:45 AM
lib/types/media-types.js
270

Yes, I'll do that in the web diff for this

native/media/encryption-utils.js
110–115

Sure, will do

native/media/encryption-utils.js
185–189

In this case, I'd prefer not to because this function is already too long and this wouldn't improve readability IMO