Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

apns2

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apns2 - npm Package Compare versions

Comparing version 11.4.0 to 11.5.0

9

dist/apns.d.ts
/// <reference types="node" />
/// <reference types="node" />
import { EventEmitter } from 'events';
import { Secret } from 'jsonwebtoken';
import { PrivateKey } from 'fast-jwt';
import { Notification } from './notifications/notification';

@@ -15,3 +16,3 @@ export declare enum Host {

team: string;
signingKey: Secret;
signingKey: string | Buffer | PrivateKey;
keyId: string;

@@ -21,2 +22,3 @@ defaultTopic?: string;

requestTimeout?: number;
keepAlive?: boolean | number;
pingInterval?: number;

@@ -28,5 +30,6 @@ }

readonly host: Host | string;
readonly signingKey: Secret;
readonly signingKey: string | Buffer | PrivateKey;
readonly defaultTopic?: string;
readonly requestTimeout?: number;
readonly keepAlive?: boolean | number;
readonly pingInterval?: number;

@@ -33,0 +36,0 @@ private _token;

@@ -5,4 +5,4 @@ "use strict";

const events_1 = require("events");
const fast_jwt_1 = require("fast-jwt");
const fetch_http2_1 = require("fetch-http2");
const jsonwebtoken_1 = require("jsonwebtoken");
const errors_1 = require("./errors");

@@ -30,2 +30,3 @@ const notification_1 = require("./notifications/notification");

this.requestTimeout = options.requestTimeout;
this.keepAlive = options.keepAlive;
this.pingInterval = options.pingInterval;

@@ -56,3 +57,3 @@ this._token = null;

timeout: this.requestTimeout,
keepAlive: this.pingInterval ?? 5000
keepAlive: this.keepAlive ?? this.pingInterval ?? 5000
};

@@ -87,3 +88,7 @@ if (notification.priority !== notification_1.Priority.immediate) {

json.notification = notification;
this.emit(json.reason, json);
// Emit specific error
if (json.reason) {
this.emit(json.reason, json);
}
// Emit generic error
this.emit(errors_1.Errors.error, json);

@@ -100,9 +105,8 @@ throw json;

};
const token = (0, jsonwebtoken_1.sign)(claims, this.signingKey, {
const signer = (0, fast_jwt_1.createSigner)({
key: this.signingKey,
algorithm: SIGNING_ALGORITHM,
header: {
alg: SIGNING_ALGORITHM,
kid: this.keyId
}
kid: this.keyId
});
const token = signer(claims);
this._token = {

@@ -109,0 +113,0 @@ value: token,

{
"name": "apns2",
"version": "11.4.0",
"version": "11.5.0",
"description": "Node client for connecting to Apple's Push Notification Service using the new HTTP/2 protocol with JSON web tokens.",

@@ -31,13 +31,12 @@ "author": "Andrew Barba <barba@hey.com>",

"dependencies": {
"fetch-http2": "^1.3.0",
"jsonwebtoken": "^9.0.2"
"fetch-http2": "^1.4.0",
"fast-jwt": "^3.3.2"
},
"devDependencies": {
"@biomejs/biome": "^1.2.2",
"@biomejs/biome": "^1.5.3",
"@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"
"@types/node": "^20.11.6",
"chai": "^5.0.3",
"typescript": "^5.3.3",
"vitest": "^1.2.1"
},

@@ -44,0 +43,0 @@ "scripts": {

@@ -1,2 +0,2 @@

# APNS2
# apns2

@@ -23,3 +23,3 @@ [![npm version](https://badge.fury.io/js/apns2.svg)](https://badge.fury.io/js/apns2)

requestTimeout: 0, // optional, Default: 0 (without timeout)
pingInterval: 5000, // optional, Default: 5000
keepAlive: true, // optional, Default: 5000
})

@@ -26,0 +26,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc