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
F3375941: D8698.id29484.diff
Tue, Nov 26, 9:31 PM
Unknown Object (File)
Sat, Nov 23, 2:39 PM
Unknown Object (File)
Sat, Nov 23, 1:56 PM
Unknown Object (File)
Sat, Nov 23, 12:56 PM
Unknown Object (File)
Sat, Nov 23, 6:39 AM
Unknown Object (File)
Sun, Nov 10, 7:30 PM
Unknown Object (File)
Sun, Nov 10, 5:59 PM
Unknown Object (File)
Sun, Nov 10, 11:42 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
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

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

keyserver/src/push/send.js
770

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

keyserver/src/push/send.js
763–776

As explained in D8589 I wanted to avoid indentation.

770

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.