{"_id":"@anyone-dev/apns2","_rev":"5-215176d684e1f2ce2847febad946283f","name":"@anyone-dev/apns2","dist-tags":{"latest":"11.4.5"},"versions":{"11.4.0":{"name":"@anyone-dev/apns2","private":false,"version":"11.4.0","description":"Node client for connecting to Apple's Push Notification Service using the new HTTP/2 protocol with JSON web tokens.","author":{"name":"Andrew Barba","email":"barba@hey.com"},"main":"dist/index.js","types":"dist/index.d.ts","license":"MIT","engines":{"node":">=16"},"repository":{"url":"git+https://github.com/AndrewBarba/apns2.git"},"keywords":["apn","apns","apns2","push","notification","http2","jwt","apple","ios","macos","tvos","watchos"],"dependencies":{"jose":"^5.2.0"},"devDependencies":{"@biomejs/biome":"^1.2.2","@tsconfig/node16":"^16.1.1","@types/jsonwebtoken":"^9.0.3","@types/node":"^20.8.2","chai":"^4.3.10","typescript":"^5.2.2","vitest":"^0.34.6"},"scripts":{"build":"tsc","lint":"biome ci src test","test":"vitest --run --dir test"},"_id":"@anyone-dev/apns2@11.4.0","gitHead":"44e0983a3f650499c2b49f7e461b08e2249f1e60","bugs":{"url":"https://github.com/AndrewBarba/apns2/issues"},"homepage":"https://github.com/AndrewBarba/apns2#readme","_nodeVersion":"18.18.2","_npmVersion":"9.8.1","dist":{"integrity":"sha512-vE5XYb4tEs603vJMHteBfhrfJt3qf6oFfJBwMdvYWJW53uZEklhPGEt+vb68VDdg/KoJjVZ/TFNyvuUIusNcfw==","shasum":"1999509b3fd694fcfaf16ccef09af57a12da34cc","tarball":"https://registry.npmjs.org/@anyone-dev/apns2/-/apns2-11.4.0.tgz","fileCount":17,"unpackedSize":22127,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEeOhJq8cU+ysutCQM/pt1avfPmhG4G20teDtANoHoiOAiEAhveGnMdAeZJvnSFtZtIJO+Rd4J4juxWPxchBmPF4Bqw="}]},"_npmUser":{"name":"vlaoff","email":"vlaoff@gmail.com"},"directories":{},"maintainers":[{"name":"vlaoff","email":"vlaoff@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/apns2_11.4.0_1703518327695_0.3337408681996785"},"_hasShrinkwrap":false},"11.4.1":{"name":"@anyone-dev/apns2","private":false,"version":"11.4.1","description":"Node client for connecting to Apple's Push Notification Service using the new HTTP/2 protocol with JSON web tokens.","author":{"name":"Andrew Barba","email":"barba@hey.com"},"main":"dist/index.js","types":"dist/index.d.ts","license":"MIT","engines":{"node":">=16"},"repository":{"url":"git+https://github.com/AndrewBarba/apns2.git"},"keywords":["apn","apns","apns2","push","notification","http2","jwt","apple","ios","macos","tvos","watchos"],"dependencies":{"jose":"^5.2.0"},"devDependencies":{"@biomejs/biome":"^1.2.2","@tsconfig/node16":"^16.1.1","@types/jsonwebtoken":"^9.0.3","@types/node":"^20.8.2","chai":"^4.3.10","typescript":"^5.2.2","vitest":"^0.34.6"},"scripts":{"build":"tsc","lint":"biome ci src test","test":"vitest --run --dir test"},"_id":"@anyone-dev/apns2@11.4.1","gitHead":"44e0983a3f650499c2b49f7e461b08e2249f1e60","bugs":{"url":"https://github.com/AndrewBarba/apns2/issues"},"homepage":"https://github.com/AndrewBarba/apns2#readme","_nodeVersion":"18.18.2","_npmVersion":"9.8.1","dist":{"integrity":"sha512-DBv6cLAV9NslS3M7aGLFMz3NEjcQb0rztKdwztck9/b3C5W5/OplSugp5dGrPT30W+kCw6p/8H35kByjyZGhQw==","shasum":"07a647d4259e18c6298967130c265f01fd1a1746","tarball":"https://registry.npmjs.org/@anyone-dev/apns2/-/apns2-11.4.1.tgz","fileCount":17,"unpackedSize":22127,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDwElg93OgJMzU3nB0rAxT4mbPxTiGgncOrsyuVMhQVlAIgXQKNQef2I+YOyyocl27vDlQURhE15Pi4OB9xZzrCcVE="}]},"_npmUser":{"name":"vlaoff","email":"vlaoff@gmail.com"},"directories":{},"maintainers":[{"name":"vlaoff","email":"vlaoff@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/apns2_11.4.1_1703520592622_0.5733275165890002"},"_hasShrinkwrap":false},"11.4.2":{"name":"@anyone-dev/apns2","private":false,"version":"11.4.2","description":"Node client for connecting to Apple's Push Notification Service using the new HTTP/2 protocol with JSON web tokens.","author":{"name":"Andrew Barba","email":"barba@hey.com"},"main":"dist/index.js","types":"dist/index.d.ts","license":"MIT","engines":{"node":">=16"},"repository":{"url":"git+https://github.com/AndrewBarba/apns2.git"},"keywords":["apn","apns","apns2","push","notification","http2","jwt","apple","ios","macos","tvos","watchos"],"dependencies":{"jose":"^5.2.0"},"devDependencies":{"@biomejs/biome":"^1.2.2","@tsconfig/node16":"^16.1.1","@types/jsonwebtoken":"^9.0.3","@types/node":"^20.8.2","chai":"^4.3.10","typescript":"^5.2.2","vitest":"^0.34.6"},"scripts":{"build":"tsc","lint":"biome ci src test","test":"vitest --run --dir test","prepublish":"npm run build"},"_id":"@anyone-dev/apns2@11.4.2","gitHead":"44e0983a3f650499c2b49f7e461b08e2249f1e60","bugs":{"url":"https://github.com/AndrewBarba/apns2/issues"},"homepage":"https://github.com/AndrewBarba/apns2#readme","_nodeVersion":"18.18.2","_npmVersion":"9.8.1","dist":{"integrity":"sha512-lZPMfmUxtLJM6DTyFtUh9Lp8teoHp/c5zDnPE3CW/4n11JdW2k+q7EhB8ap8ZFKt1+DCpIrQx2uVClNB73Rftw==","shasum":"366bb5f00c6e89c936700103920efa74781bb74d","tarball":"https://registry.npmjs.org/@anyone-dev/apns2/-/apns2-11.4.2.tgz","fileCount":17,"unpackedSize":22168,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHZSPjAIiGr+lRhcESg4EAS0WWqz6kPOpzjaGOt3k//zAiBJsFWYfmmyzzhMGV1c7itAn1rsx1NR6SB9N+6RYQywHw=="}]},"_npmUser":{"name":"vlaoff","email":"vlaoff@gmail.com"},"directories":{},"maintainers":[{"name":"vlaoff","email":"vlaoff@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/apns2_11.4.2_1703522387024_0.9539332705517447"},"_hasShrinkwrap":false},"11.4.3":{"name":"@anyone-dev/apns2","private":false,"version":"11.4.3","description":"Node client for connecting to Apple's Push Notification Service using the new HTTP/2 protocol with JSON web tokens.","author":{"name":"Andrew Barba","email":"barba@hey.com"},"main":"dist/index.js","types":"dist/index.d.ts","license":"MIT","engines":{"node":">=16"},"repository":{"url":"git+https://github.com/AndrewBarba/apns2.git"},"keywords":["apn","apns","apns2","push","notification","http2","jwt","apple","ios","macos","tvos","watchos"],"dependencies":{"jose":"^5.2.0"},"devDependencies":{"@biomejs/biome":"^1.2.2","@tsconfig/node16":"^16.1.1","@types/jsonwebtoken":"^9.0.3","@types/node":"^20.8.2","chai":"^4.3.10","typescript":"^5.2.2","vitest":"^0.34.6"},"scripts":{"build":"tsc","lint":"biome ci src test","test":"vitest --run --dir test","prepublish":"npm run build"},"_id":"@anyone-dev/apns2@11.4.3","gitHead":"44e0983a3f650499c2b49f7e461b08e2249f1e60","bugs":{"url":"https://github.com/AndrewBarba/apns2/issues"},"homepage":"https://github.com/AndrewBarba/apns2#readme","_nodeVersion":"18.18.2","_npmVersion":"9.8.1","dist":{"integrity":"sha512-mreJh+9gTIRFbfiyL5V5brc8I4sAh3GPM+tZK7kUeYFjKJgDzEF3dtEeZPFBYYxDNuQyrKZ2eURMRK/9X0kchg==","shasum":"acc095bab921894c119e0f2d165ac29670466608","tarball":"https://registry.npmjs.org/@anyone-dev/apns2/-/apns2-11.4.3.tgz","fileCount":17,"unpackedSize":22336,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDo52mkDNEwwjFJr8JetLZmntQnoSMegZK4VhQhn8lfMAIhANgb/J3MkJDda5fjwG+6jX6yLEGL5PD8QO1fU5Ths9ZU"}]},"_npmUser":{"name":"vlaoff","email":"vlaoff@gmail.com"},"directories":{},"maintainers":[{"name":"vlaoff","email":"vlaoff@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/apns2_11.4.3_1706217076176_0.006571722545066994"},"_hasShrinkwrap":false},"11.4.4":{"name":"@anyone-dev/apns2","private":false,"version":"11.4.4","description":"Node client for connecting to Apple's Push Notification Service using the new HTTP/2 protocol with JSON web tokens.","author":{"name":"Andrew Barba","email":"barba@hey.com"},"main":"dist/index.js","types":"dist/index.d.ts","license":"MIT","engines":{"node":">=16"},"repository":{"url":"git+https://github.com/AndrewBarba/apns2.git"},"keywords":["apn","apns","apns2","push","notification","http2","jwt","apple","ios","macos","tvos","watchos"],"dependencies":{"jose":"^5.2.0"},"devDependencies":{"@biomejs/biome":"^1.2.2","@tsconfig/node16":"^16.1.1","@types/jsonwebtoken":"^9.0.3","@types/node":"^20.8.2","chai":"^4.3.10","typescript":"^5.2.2","vitest":"^0.34.6"},"scripts":{"build":"tsc","lint":"biome ci src test","test":"vitest --run --dir test","prepublish":"npm run build"},"_id":"@anyone-dev/apns2@11.4.4","gitHead":"44e0983a3f650499c2b49f7e461b08e2249f1e60","bugs":{"url":"https://github.com/AndrewBarba/apns2/issues"},"homepage":"https://github.com/AndrewBarba/apns2#readme","_nodeVersion":"18.18.2","_npmVersion":"9.8.1","dist":{"integrity":"sha512-zxiWmco6QaHyMdWsmMKYzjZ3nCJR7hrfnoFNBI1E74ilxm4n7oRLXePLoopPhXV+iA9G1myF3TqgJDYt0Ee3Bg==","shasum":"5217cfd543f86c68a798d7840d50441c4c6853e6","tarball":"https://registry.npmjs.org/@anyone-dev/apns2/-/apns2-11.4.4.tgz","fileCount":17,"unpackedSize":22336,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICcz5XLF9iiLFs2SqVTZsf11AVIwzi5Zf+YpIbJAO2ayAiAKBrwfOd9Iwa4HwIKH5JA2L/jPp/JKJcSpctWlmUOPuw=="}]},"_npmUser":{"name":"vlaoff","email":"vlaoff@gmail.com"},"directories":{},"maintainers":[{"name":"vlaoff","email":"vlaoff@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/apns2_11.4.4_1706217251845_0.8204410328905005"},"_hasShrinkwrap":false},"11.4.5":{"name":"@anyone-dev/apns2","private":false,"version":"11.4.5","description":"Node client for connecting to Apple's Push Notification Service using the new HTTP/2 protocol with JSON web tokens.","author":{"name":"Andrew Barba","email":"barba@hey.com"},"main":"dist/index.js","types":"dist/index.d.ts","license":"MIT","engines":{"node":">=16"},"repository":{"url":"git+https://github.com/AndrewBarba/apns2.git"},"keywords":["apn","apns","apns2","push","notification","http2","jwt","apple","ios","macos","tvos","watchos"],"dependencies":{"jose":"^5.2.0"},"devDependencies":{"@biomejs/biome":"^1.2.2","@tsconfig/node16":"^16.1.1","@types/jsonwebtoken":"^9.0.3","@types/node":"^20.8.2","chai":"^4.3.10","typescript":"^5.2.2","vitest":"^0.34.6"},"scripts":{"build":"tsc","lint":"biome ci src test","test":"vitest --run --dir test","prepublish":"npm run build"},"_id":"@anyone-dev/apns2@11.4.5","gitHead":"44e0983a3f650499c2b49f7e461b08e2249f1e60","bugs":{"url":"https://github.com/AndrewBarba/apns2/issues"},"homepage":"https://github.com/AndrewBarba/apns2#readme","_nodeVersion":"18.18.2","_npmVersion":"9.8.1","dist":{"integrity":"sha512-a1upEl0apEYw2GjNevj5H8MJShFdTdqEN/t86CFe9kLq4Ch5SXEq9bGfe7mXvjKPcNJ+Ee1Zw0B2jb3HgacGSQ==","shasum":"2273ebcf280eeb88866e60939a545b2062f1414c","tarball":"https://registry.npmjs.org/@anyone-dev/apns2/-/apns2-11.4.5.tgz","fileCount":17,"unpackedSize":22423,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCz6caJqEFGZSGKjArLMA71DKNFrKAifE0lkl/r2QJ1ywIhAKaJaxC3oeovTjiCIiGv6/vGpKAc03aiV+PW5t6mTAeG"}]},"_npmUser":{"name":"vlaoff","email":"vlaoff@gmail.com"},"directories":{},"maintainers":[{"name":"vlaoff","email":"vlaoff@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/apns2_11.4.5_1706217277823_0.5761803533040042"},"_hasShrinkwrap":false}},"time":{"created":"2023-12-25T15:32:07.627Z","11.4.0":"2023-12-25T15:32:07.892Z","modified":"2024-01-25T21:14:38.166Z","11.4.1":"2023-12-25T16:09:52.802Z","11.4.2":"2023-12-25T16:39:47.257Z","11.4.3":"2024-01-25T21:11:16.383Z","11.4.4":"2024-01-25T21:14:11.993Z","11.4.5":"2024-01-25T21:14:37.991Z"},"maintainers":[{"name":"vlaoff","email":"vlaoff@gmail.com"}],"description":"Node client for connecting to Apple's Push Notification Service using the new HTTP/2 protocol with JSON web tokens.","homepage":"https://github.com/AndrewBarba/apns2#readme","keywords":["apn","apns","apns2","push","notification","http2","jwt","apple","ios","macos","tvos","watchos"],"repository":{"url":"git+https://github.com/AndrewBarba/apns2.git"},"author":{"name":"Andrew Barba","email":"barba@hey.com"},"bugs":{"url":"https://github.com/AndrewBarba/apns2/issues"},"license":"MIT","readme":"# apns2\n\n[![npm version](https://badge.fury.io/js/apns2.svg)](https://badge.fury.io/js/apns2)\n[![Twitter](https://img.shields.io/badge/twitter-@andrew_barba-blue.svg?style=flat)](http://twitter.com/andrew_barba)\n\nNode client for connecting to Apple's Push Notification Service using the new HTTP/2 protocol with JSON web tokens.\n\n---\n\n## Create Client\n\nCreate an APNS client using a signing key:\n\n```typescript\nimport { ApnsClient } from 'apns2'\n\nconst client = new ApnsClient({\n  team: `TFLP87PW54`,\n  keyId: `123ABC456`,\n  signingKey: fs.readFileSync(`${__dirname}/path/to/auth.p8`),\n  defaultTopic: `com.tablelist.Tablelist`,\n  requestTimeout: 0, // optional, Default: 0 (without timeout)\n  pingInterval: 5000, // optional, Default: 5000\n})\n```\n\n## Sending Notifications\n\n#### Basic\n\nSend a basic notification with message:\n\n```typescript\nimport { Notification } from 'apns2'\n\nconst bn = new Notification(deviceToken, { alert: 'Hello, World' })\n\ntry {\n  await client.send(bn)\n} catch (err) {\n  console.error(err.reason)\n}\n```\n\nSend a basic notification with message and options:\n\n```typescript\nimport { Notification } from 'apns2'\n\nconst bn = new Notification(deviceToken, {\n  alert: 'Hello, World',\n  badge: 4,\n  data: {\n    userId: user.getUserId\n  }\n})\n\ntry {\n  await client.send(bn)\n} catch (err) {\n  console.error(err.reason)\n}\n```\n\n#### Silent\n\nSend a silent notification using `content-available` key:\n\n```typescript\nimport { SilentNotification } from 'apns2'\n\nconst sn = new SilentNotification(deviceToken)\n\ntry {\n  await client.send(sn)\n} catch (err) {\n  console.error(err.reason)\n}\n```\n\nNote: [Apple recommends](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/pushing_background_updates_to_your_app#2980040) that no options other than the `content-available` flag be sent in order for a notification to truly be silent and wake up your app in the background. Therefore this class does not accept any additional options in the constructor.\n\n#### Many\n\nSend multiple notifications concurrently:\n\n```typescript\nimport { Notification } from 'apns2'\n\nconst notifications = [\n  new Notification(deviceToken1, { alert: 'Hello, World' }),\n  new Notification(deviceToken2, { alert: 'Hello, World' })\n]\n\ntry {\n  await client.sendMany(notifications)\n} catch (err) {\n  console.error(err.reason)\n}\n```\n\n#### Advanced\n\nFor complete control over the push notification packet use the base `Notification` class:\n\n```typescript\nimport { Notification } from 'apns2'\n\nconst notification = new Notification(deviceToken, {\n  aps: { ... }\n})\n\ntry {\n  await client.send(notification)\n} catch(err) {\n  console.error(err.reason)\n}\n```\n\nAvailable options can be found at [APNS Payload Options](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/generating_a_remote_notification#2943363)\n\n## Error Handling\n\nAll errors are defined in `./lib/errors.js` and come directly from [APNS Table 4](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/handling_notification_responses_from_apns#3394535)\n\nYou can easily listen for these errors by attaching an error handler to the APNS client:\n\n```typescript\nimport { Errors } from 'apns2'\n\n// Listen for a specific error\nclient.on(Errors.badDeviceToken, (err) => {\n  // Handle accordingly...\n  // Perhaps delete token from your database\n  console.error(err.reason, err.statusCode, err.notification.deviceToken)\n})\n\n// Listen for any error\nclient.on(Errors.error, (err) => {\n  console.error(err.reason, err.statusCode, err.notification.deviceToken)\n})\n```\n## Environments\n\nBy default the APNS client connects to the production push notification server. This is identical to passing in the options:\n\n```typescript\nconst client = new ApnsClient({\n  host: 'api.push.apple.com'\n  ...\n})\n```\n\nTo connect to the development push notification server, pass the options:\n\n```typescript\nconst client = new ApnsClient({\n  host: 'api.sandbox.push.apple.com'\n  ...\n})\n```\n\n## Requirements\n\n`apns2` requires Node.js v16 or later\n","readmeFilename":"README.md"}