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
Unknown Object (File)
Fri, Dec 27, 9:44 AM
Unknown Object (File)
Fri, Dec 27, 9:44 AM
Unknown Object (File)
Fri, Dec 27, 9:44 AM
Unknown Object (File)
Fri, Dec 27, 9:44 AM
Unknown Object (File)
Fri, Dec 27, 9:43 AM
Unknown Object (File)
Fri, Dec 27, 9:33 AM
Unknown Object (File)
Thu, Dec 26, 2:48 AM
Unknown Object (File)
Fri, Dec 13, 5:41 PM
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
Branch
marcin/eng-4247
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.