Page MenuHomePhabricator

Upload iOS notification payload to blob service if its size exceeds limits
AbandonedPublic

Authored by marcin on Aug 1 2023, 7:04 AM.
Tags
None
Referenced Files
F1718453: D8698.id29484.diff
Wed, May 8, 7:28 PM
F1718452: D8698.id.diff
Wed, May 8, 7:28 PM
Unknown Object (File)
Tue, May 7, 10:16 PM
Unknown Object (File)
Mon, May 6, 12:27 PM
Unknown Object (File)
Sat, May 4, 5:06 PM
Unknown Object (File)
Sat, May 4, 5:05 PM
Unknown Object (File)
Sat, May 4, 5:05 PM
Unknown Object (File)
Apr 8 2024, 5:11 AM
Subscribers

Details

Reviewers
tomek
bartek
atul
Summary

This differential upload iOS notification to blob service if its size exceeds APNs limits.

Test Plan
  1. Build iOS app.
  2. Background or kill the app.
  3. Send large notifications to the app. I used 16000 character notifications for testing.
  4. Ensure notification is displayed shortly after it was sent.
  5. Kill your local keyserver
  6. Open the app. Ensure that (entire!!!) message content is available in the thread.

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

marcin requested review of this revision.Aug 1 2023, 9:03 AM
atul added 1 blocking reviewer(s): bartek.
atul added inline comments.
keyserver/src/push/send.js
763–776 ↗(On Diff #29439)

Should these maybe be inside the if (canQueryBlobService) condition?

keyserver/src/push/send.js
770 ↗(On Diff #29439)

Is it possible that blobUploadError isn't present but blobHash or encryptionKey is null?

keyserver/src/push/send.js
763–776 ↗(On Diff #29439)

As explained in D8589 I wanted to avoid indentation.

770 ↗(On Diff #29439)

It is impossible.

  1. Typing of blobServiceUpload returns either non-null blobUploadError or the pair of non-null blobHash and encryptionKey.
  2. encryptionKey is generated by awaiting this function:
async function generateKeyCommon(commonCrypto: Crypto): Promise<Uint8Array> {
  const algorithm = { name: 'AES-GCM', length: 256 };
  const key = await commonCrypto.subtle.generateKey(algorithm, true, [
    'encrypt',
    'decrypt',
  ]);
  const keyData = await commonCrypto.subtle.exportKey('raw', key);
  return new Uint8Array(keyData);
}

it cannot return null.

  1. blobHash is calculated by this function: https://nodejs.org/api/crypto.html#cryptocreatehashalgorithm-options. It cannot return null.

Rename payloadSizeViolated to payloadSizeExceeded and devicesWithSizeViolation to devicesWithExcessiveSize

This revision is now accepted and ready to land.Aug 3 2023, 12:57 AM

Implement WIP of comm access token authentication on iOS

Code from this differential was updated and added to the parent differential.