@digipair/skill-push-notification 0.136.3 → 0.136.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js
CHANGED
|
@@ -1949,10 +1949,6 @@ bn.exports;
|
|
|
1949
1949
|
var mask = 0x3ffffff ^ 0x3ffffff >>> r << r;
|
|
1950
1950
|
this.words[this.length - 1] &= mask;
|
|
1951
1951
|
}
|
|
1952
|
-
if (this.length === 0) {
|
|
1953
|
-
this.words[0] = 0;
|
|
1954
|
-
this.length = 1;
|
|
1955
|
-
}
|
|
1956
1952
|
return this.strip();
|
|
1957
1953
|
};
|
|
1958
1954
|
// Return only lowers bits of number
|
|
@@ -5144,12 +5140,7 @@ function jwsSign(opts) {
|
|
|
5144
5140
|
return util$1.format('%s.%s', securedInput, signature);
|
|
5145
5141
|
}
|
|
5146
5142
|
function SignStream$1(opts) {
|
|
5147
|
-
var secret = opts.secret;
|
|
5148
|
-
secret = secret == null ? opts.privateKey : secret;
|
|
5149
|
-
secret = secret == null ? opts.key : secret;
|
|
5150
|
-
if (/^hs/i.test(opts.header.alg) === true && secret == null) {
|
|
5151
|
-
throw new TypeError('secret must be a string or buffer or a KeyObject');
|
|
5152
|
-
}
|
|
5143
|
+
var secret = opts.secret || opts.privateKey || opts.key;
|
|
5153
5144
|
var secretStream = new DataStream$1(secret);
|
|
5154
5145
|
this.readable = true;
|
|
5155
5146
|
this.header = opts.header;
|
|
@@ -5252,12 +5243,7 @@ function jwsDecode(jwsSig, opts) {
|
|
|
5252
5243
|
}
|
|
5253
5244
|
function VerifyStream$1(opts) {
|
|
5254
5245
|
opts = opts || {};
|
|
5255
|
-
var secretOrKey = opts.secret;
|
|
5256
|
-
secretOrKey = secretOrKey == null ? opts.publicKey : secretOrKey;
|
|
5257
|
-
secretOrKey = secretOrKey == null ? opts.key : secretOrKey;
|
|
5258
|
-
if (/^hs/i.test(opts.algorithm) === true && secretOrKey == null) {
|
|
5259
|
-
throw new TypeError('secret must be a string or buffer or a KeyObject');
|
|
5260
|
-
}
|
|
5246
|
+
var secretOrKey = opts.secret || opts.publicKey || opts.key;
|
|
5261
5247
|
var secretStream = new DataStream(secretOrKey);
|
|
5262
5248
|
this.readable = true;
|
|
5263
5249
|
this.algorithm = opts.algorithm;
|
|
@@ -5322,18 +5308,18 @@ jws$1.createVerify = function createVerify(opts) {
|
|
|
5322
5308
|
return new VerifyStream(opts);
|
|
5323
5309
|
};
|
|
5324
5310
|
|
|
5325
|
-
var WebPushConstants$
|
|
5326
|
-
WebPushConstants$
|
|
5311
|
+
var WebPushConstants$2 = {};
|
|
5312
|
+
WebPushConstants$2.supportedContentEncodings = {
|
|
5327
5313
|
AES_GCM: 'aesgcm',
|
|
5328
5314
|
AES_128_GCM: 'aes128gcm'
|
|
5329
5315
|
};
|
|
5330
|
-
WebPushConstants$
|
|
5316
|
+
WebPushConstants$2.supportedUrgency = {
|
|
5331
5317
|
VERY_LOW: 'very-low',
|
|
5332
5318
|
LOW: 'low',
|
|
5333
5319
|
NORMAL: 'normal',
|
|
5334
5320
|
HIGH: 'high'
|
|
5335
5321
|
};
|
|
5336
|
-
var webPushConstants$1 = WebPushConstants$
|
|
5322
|
+
var webPushConstants$1 = WebPushConstants$2;
|
|
5337
5323
|
|
|
5338
5324
|
/**
|
|
5339
5325
|
* @param {string} base64
|
|
@@ -5349,7 +5335,7 @@ var crypto$2 = require$$0$1;
|
|
|
5349
5335
|
var asn1 = asn1$1;
|
|
5350
5336
|
var jws = jws$1;
|
|
5351
5337
|
var URL = require$$3$1.URL;
|
|
5352
|
-
var WebPushConstants = webPushConstants$1;
|
|
5338
|
+
var WebPushConstants$1 = webPushConstants$1;
|
|
5353
5339
|
var urlBase64Helper$1 = urlsafeBase64Helper;
|
|
5354
5340
|
/**
|
|
5355
5341
|
* DEFAULT_EXPIRATION is set to seconds in 12 hours
|
|
@@ -5536,12 +5522,12 @@ function validatePrivateKey(privateKey) {
|
|
|
5536
5522
|
payload: jwtPayload,
|
|
5537
5523
|
privateKey: toPEM(privateKey)
|
|
5538
5524
|
});
|
|
5539
|
-
if (contentEncoding === WebPushConstants.supportedContentEncodings.AES_128_GCM) {
|
|
5525
|
+
if (contentEncoding === WebPushConstants$1.supportedContentEncodings.AES_128_GCM) {
|
|
5540
5526
|
return {
|
|
5541
5527
|
Authorization: 'vapid t=' + jwt + ', k=' + publicKey
|
|
5542
5528
|
};
|
|
5543
5529
|
}
|
|
5544
|
-
if (contentEncoding === WebPushConstants.supportedContentEncodings.AES_GCM) {
|
|
5530
|
+
if (contentEncoding === WebPushConstants$1.supportedContentEncodings.AES_GCM) {
|
|
5545
5531
|
return {
|
|
5546
5532
|
Authorization: 'WebPush ' + jwt,
|
|
5547
5533
|
'Crypto-Key': 'p256ecdsa=' + publicKey
|
|
@@ -5549,7 +5535,7 @@ function validatePrivateKey(privateKey) {
|
|
|
5549
5535
|
}
|
|
5550
5536
|
throw new Error('Unsupported encoding type specified.');
|
|
5551
5537
|
}
|
|
5552
|
-
var vapidHelper$
|
|
5538
|
+
var vapidHelper$2 = {
|
|
5553
5539
|
generateVAPIDKeys: generateVAPIDKeys,
|
|
5554
5540
|
getFutureExpirationTimestamp: getFutureExpirationTimestamp,
|
|
5555
5541
|
getVapidHeaders: getVapidHeaders,
|
|
@@ -6111,11 +6097,11 @@ var encrypt = function encrypt(userPublicKey, userAuth, payload, contentEncoding
|
|
|
6111
6097
|
cipherText: cipherText
|
|
6112
6098
|
};
|
|
6113
6099
|
};
|
|
6114
|
-
var encryptionHelper$
|
|
6100
|
+
var encryptionHelper$2 = {
|
|
6115
6101
|
encrypt: encrypt
|
|
6116
6102
|
};
|
|
6117
6103
|
|
|
6118
|
-
function WebPushError$
|
|
6104
|
+
function WebPushError$2(message, statusCode, headers, body, endpoint) {
|
|
6119
6105
|
Error.captureStackTrace(this, this.constructor);
|
|
6120
6106
|
this.name = this.constructor.name;
|
|
6121
6107
|
this.message = message;
|
|
@@ -6124,8 +6110,8 @@ function WebPushError$1(message, statusCode, headers, body, endpoint) {
|
|
|
6124
6110
|
this.body = body;
|
|
6125
6111
|
this.endpoint = endpoint;
|
|
6126
6112
|
}
|
|
6127
|
-
require$$5.inherits(WebPushError$
|
|
6128
|
-
var webPushError = WebPushError$
|
|
6113
|
+
require$$5.inherits(WebPushError$2, Error);
|
|
6114
|
+
var webPushError = WebPushError$2;
|
|
6129
6115
|
|
|
6130
6116
|
var dist$1 = {};
|
|
6131
6117
|
|
|
@@ -8565,9 +8551,9 @@ function _type_of(obj) {
|
|
|
8565
8551
|
}
|
|
8566
8552
|
var url = require$$3$1;
|
|
8567
8553
|
var https = require$$1;
|
|
8568
|
-
var WebPushError = webPushError;
|
|
8569
|
-
var vapidHelper = vapidHelper$
|
|
8570
|
-
var encryptionHelper = encryptionHelper$
|
|
8554
|
+
var WebPushError$1 = webPushError;
|
|
8555
|
+
var vapidHelper$1 = vapidHelper$2;
|
|
8556
|
+
var encryptionHelper$1 = encryptionHelper$2;
|
|
8571
8557
|
var webPushConstants = webPushConstants$1;
|
|
8572
8558
|
var urlBase64Helper = urlsafeBase64Helper;
|
|
8573
8559
|
// Default TTL is four weeks.
|
|
@@ -8604,9 +8590,9 @@ function WebPushLib$1() {}
|
|
|
8604
8590
|
vapidDetails = null;
|
|
8605
8591
|
return;
|
|
8606
8592
|
}
|
|
8607
|
-
vapidHelper.validateSubject(subject);
|
|
8608
|
-
vapidHelper.validatePublicKey(publicKey);
|
|
8609
|
-
vapidHelper.validatePrivateKey(privateKey);
|
|
8593
|
+
vapidHelper$1.validateSubject(subject);
|
|
8594
|
+
vapidHelper$1.validatePublicKey(publicKey);
|
|
8595
|
+
vapidHelper$1.validatePrivateKey(privateKey);
|
|
8610
8596
|
vapidDetails = {
|
|
8611
8597
|
subject: subject,
|
|
8612
8598
|
publicKey: publicKey,
|
|
@@ -8750,7 +8736,7 @@ function WebPushLib$1() {}
|
|
|
8750
8736
|
});
|
|
8751
8737
|
var requestPayload = null;
|
|
8752
8738
|
if (payload) {
|
|
8753
|
-
var encrypted = encryptionHelper.encrypt(subscription.keys.p256dh, subscription.keys.auth, payload, contentEncoding);
|
|
8739
|
+
var encrypted = encryptionHelper$1.encrypt(subscription.keys.p256dh, subscription.keys.auth, payload, contentEncoding);
|
|
8754
8740
|
requestDetails.headers['Content-Length'] = encrypted.cipherText.length;
|
|
8755
8741
|
requestDetails.headers['Content-Type'] = 'application/octet-stream';
|
|
8756
8742
|
if (contentEncoding === webPushConstants.supportedContentEncodings.AES_128_GCM) {
|
|
@@ -8776,7 +8762,7 @@ function WebPushLib$1() {}
|
|
|
8776
8762
|
} else if (currentVapidDetails) {
|
|
8777
8763
|
var parsedUrl = url.parse(subscription.endpoint);
|
|
8778
8764
|
var audience = parsedUrl.protocol + '//' + parsedUrl.host;
|
|
8779
|
-
var vapidHeaders = vapidHelper.getVapidHeaders(audience, currentVapidDetails.subject, currentVapidDetails.publicKey, currentVapidDetails.privateKey, contentEncoding);
|
|
8765
|
+
var vapidHeaders = vapidHelper$1.getVapidHeaders(audience, currentVapidDetails.subject, currentVapidDetails.publicKey, currentVapidDetails.privateKey, contentEncoding);
|
|
8780
8766
|
requestDetails.headers.Authorization = vapidHeaders.Authorization;
|
|
8781
8767
|
if (contentEncoding === webPushConstants.supportedContentEncodings.AES_GCM) {
|
|
8782
8768
|
if (requestDetails.headers['Crypto-Key']) {
|
|
@@ -8850,7 +8836,7 @@ function WebPushLib$1() {}
|
|
|
8850
8836
|
});
|
|
8851
8837
|
pushResponse.on('end', function() {
|
|
8852
8838
|
if (pushResponse.statusCode < 200 || pushResponse.statusCode > 299) {
|
|
8853
|
-
reject(new WebPushError('Received unexpected response code', pushResponse.statusCode, pushResponse.headers, responseText, requestDetails.endpoint));
|
|
8839
|
+
reject(new WebPushError$1('Received unexpected response code', pushResponse.statusCode, pushResponse.headers, responseText, requestDetails.endpoint));
|
|
8854
8840
|
} else {
|
|
8855
8841
|
resolve({
|
|
8856
8842
|
statusCode: pushResponse.statusCode,
|
|
@@ -8876,9 +8862,18 @@ function WebPushLib$1() {}
|
|
|
8876
8862
|
};
|
|
8877
8863
|
var webPushLib = WebPushLib$1;
|
|
8878
8864
|
|
|
8865
|
+
var vapidHelper = vapidHelper$2;
|
|
8866
|
+
var encryptionHelper = encryptionHelper$2;
|
|
8879
8867
|
var WebPushLib = webPushLib;
|
|
8868
|
+
var WebPushError = webPushError;
|
|
8869
|
+
var WebPushConstants = webPushConstants$1;
|
|
8880
8870
|
var webPush = new WebPushLib();
|
|
8881
8871
|
var src = {
|
|
8872
|
+
WebPushError: WebPushError,
|
|
8873
|
+
supportedContentEncodings: WebPushConstants.supportedContentEncodings,
|
|
8874
|
+
encrypt: encryptionHelper.encrypt,
|
|
8875
|
+
getVapidHeaders: vapidHelper.getVapidHeaders,
|
|
8876
|
+
generateVAPIDKeys: vapidHelper.generateVAPIDKeys,
|
|
8882
8877
|
setGCMAPIKey: webPush.setGCMAPIKey,
|
|
8883
8878
|
setVapidDetails: webPush.setVapidDetails,
|
|
8884
8879
|
generateRequestDetails: webPush.generateRequestDetails,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-push-notification.d.ts","sourceRoot":"","sources":["../../../src/lib/skill-push-notification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,OAAO,MAAM,UAAU,CAAC;AAoBpC,eAAO,MAAM,QAAQ,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,gCACT,CAAC"}
|