Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
sendAPN(regIds, data) {
const message = new apn.Notification({
retryLimit: data.retries || -1,
expiry: extractExpiry(data),
priority: data.priority === 'normal' ? 5 : 10,
encoding: data.encoding,
payload: data.custom || {},
badge: data.badge,
sound: data.sound,
alert: data.alert || {
title: data.title,
body: data.body,
'title-loc-key': data.titleLocKey,
'title-loc-args': data.titleLocArgs,
'loc-key': data.locKey,
// bodyLocArgs is kept for backward compatibility
'loc-args': data.locArgs || data.bodyLocArgs,
'launch-image': data.launchImage,
static _generateNotification(coreData, headers) {
let notification = new apn.Notification();
let payload = {};
for (let key in coreData) {
switch (key) {
case 'aps':
notification.aps = coreData.aps;
break;
case 'alert':
notification.setAlert(coreData.alert);
break;
case 'title':
notification.setTitle(coreData.title);
break;
case 'badge':
notification.setBadge(coreData.badge);
break;
case 'sound':