diff --git a/lib/push/crypto.js b/lib/push/crypto.js --- a/lib/push/crypto.js +++ b/lib/push/crypto.js @@ -19,6 +19,7 @@ APNsVisualNotification, APNsNotificationRescind, APNsBadgeOnlyNotification, + UnecryptedAPNsVisualNotification, } from '../types/notif-types.js'; import { toBase64URL } from '../utils/base64.js'; @@ -105,7 +106,7 @@ encryptedNotifUtilsAPI: EncryptedNotifUtilsAPI, cryptoID: string, senderDeviceDescriptor: SenderDeviceDescriptor, - notification: APNsVisualNotification, + notification: UnecryptedAPNsVisualNotification, isNotificationSizeValid?: APNsVisualNotification => boolean, codeVersion?: ?number, blobHolder?: ?string, @@ -450,7 +451,7 @@ encryptedNotifUtilsAPI: EncryptedNotifUtilsAPI, senderDeviceDescriptor: SenderDeviceDescriptor, devices: $ReadOnlyArray, - notification: APNsVisualNotification, + notification: UnecryptedAPNsVisualNotification, codeVersion?: ?number, isNotificationSizeValid?: APNsVisualNotification => boolean, ): Promise< diff --git a/lib/types/notif-types.js b/lib/types/notif-types.js --- a/lib/types/notif-types.js +++ b/lib/types/notif-types.js @@ -268,14 +268,14 @@ +encryptionKey: string, }>; +export type UnecryptedAPNsVisualNotification = $ReadOnly<{ + +headers: APNsNotificationHeaders, + +id: string, + ...APNsSmallVisualNotificationPayload | APNsLargeVisualNotificationPayload, +}>; + export type APNsVisualNotification = - | $ReadOnly<{ - +headers: APNsNotificationHeaders, - +id: string, - ... - | APNsSmallVisualNotificationPayload - | APNsLargeVisualNotificationPayload, - }> + | UnecryptedAPNsVisualNotification | EncryptedAPNsVisualNotification; type APNsLegacyRescindPayload = {