MCPcopy Create free account
hub / github.com/CommE2E/comm / prepareEncryptedAndroidVisualNotifications

Function prepareEncryptedAndroidVisualNotifications

lib/push/crypto.js:510–541  ·  view source on GitHub ↗
(
  encryptedNotifUtilsAPI: EncryptedNotifUtilsAPI,
  senderDeviceDescriptor: SenderDeviceDescriptor,
  devices: $ReadOnlyArray<NotificationTargetDevice>,
  notification: AndroidVisualNotification,
  isNotificationSizeValid?: (
    notification: AndroidVisualNotification,
  ) => boolean,
)

Source from the content-addressed store, hash-verified

508}
509
510function prepareEncryptedAndroidVisualNotifications(
511 encryptedNotifUtilsAPI: EncryptedNotifUtilsAPI,
512 senderDeviceDescriptor: SenderDeviceDescriptor,
513 devices: $ReadOnlyArray<NotificationTargetDevice>,
514 notification: AndroidVisualNotification,
515 isNotificationSizeValid?: (
516 notification: AndroidVisualNotification,
517 ) => boolean,
518): Promise<
519 $ReadOnlyArray<{
520 +cryptoID: string,
521 +deliveryID: string,
522 +notification: AndroidVisualNotification,
523 +payloadSizeExceeded: boolean,
524 +encryptionOrder?: number,
525 }>,
526> {
527 const notificationPromises = devices.map(
528 async ({ deliveryID, cryptoID, blobHolder }) => {
529 const notif = await encryptAndroidVisualNotification(
530 encryptedNotifUtilsAPI,
531 senderDeviceDescriptor,
532 cryptoID,
533 notification,
534 isNotificationSizeValid,
535 blobHolder,
536 );
537 return { deliveryID, cryptoID, ...notif };
538 },
539 );
540 return Promise.all(notificationPromises);
541}
542
543function prepareEncryptedAndroidSilentNotifications(
544 encryptedNotifUtilsAPI: EncryptedNotifUtilsAPI,

Callers 1

Calls 1

Tested by

no test coverage detected