jose 4.15.4 → 4.15.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.
|
@@ -60,6 +60,16 @@ export class JWEDecryptionFailed extends JOSEError {
|
|
|
60
60
|
return 'ERR_JWE_DECRYPTION_FAILED';
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
+
export class JWEDecompressionFailed extends JOSEError {
|
|
64
|
+
constructor() {
|
|
65
|
+
super(...arguments);
|
|
66
|
+
this.code = 'ERR_JWE_DECOMPRESSION_FAILED';
|
|
67
|
+
this.message = 'decompression operation failed';
|
|
68
|
+
}
|
|
69
|
+
static get code() {
|
|
70
|
+
return 'ERR_JWE_DECOMPRESSION_FAILED';
|
|
71
|
+
}
|
|
72
|
+
}
|
|
63
73
|
export class JWEInvalid extends JOSEError {
|
|
64
74
|
constructor() {
|
|
65
75
|
super(...arguments);
|
|
@@ -3,9 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.deflate = exports.inflate = void 0;
|
|
4
4
|
const util_1 = require("util");
|
|
5
5
|
const zlib_1 = require("zlib");
|
|
6
|
+
const errors_js_1 = require("../util/errors.js");
|
|
6
7
|
const inflateRaw = (0, util_1.promisify)(zlib_1.inflateRaw);
|
|
7
8
|
const deflateRaw = (0, util_1.promisify)(zlib_1.deflateRaw);
|
|
8
|
-
const inflate = (input) => inflateRaw(input)
|
|
9
|
+
const inflate = (input) => inflateRaw(input, { maxOutputLength: 250000 }).catch(() => {
|
|
10
|
+
throw new errors_js_1.JWEDecompressionFailed();
|
|
11
|
+
});
|
|
9
12
|
exports.inflate = inflate;
|
|
10
13
|
const deflate = (input) => deflateRaw(input);
|
|
11
14
|
exports.deflate = deflate;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JWSSignatureVerificationFailed = exports.JWKSTimeout = exports.JWKSMultipleMatchingKeys = exports.JWKSNoMatchingKey = exports.JWKSInvalid = exports.JWKInvalid = exports.JWTInvalid = exports.JWSInvalid = exports.JWEInvalid = exports.JWEDecryptionFailed = exports.JOSENotSupported = exports.JOSEAlgNotAllowed = exports.JWTExpired = exports.JWTClaimValidationFailed = exports.JOSEError = void 0;
|
|
3
|
+
exports.JWSSignatureVerificationFailed = exports.JWKSTimeout = exports.JWKSMultipleMatchingKeys = exports.JWKSNoMatchingKey = exports.JWKSInvalid = exports.JWKInvalid = exports.JWTInvalid = exports.JWSInvalid = exports.JWEInvalid = exports.JWEDecompressionFailed = exports.JWEDecryptionFailed = exports.JOSENotSupported = exports.JOSEAlgNotAllowed = exports.JWTExpired = exports.JWTClaimValidationFailed = exports.JOSEError = void 0;
|
|
4
4
|
class JOSEError extends Error {
|
|
5
5
|
static get code() {
|
|
6
6
|
return 'ERR_JOSE_GENERIC';
|
|
@@ -69,6 +69,17 @@ class JWEDecryptionFailed extends JOSEError {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
exports.JWEDecryptionFailed = JWEDecryptionFailed;
|
|
72
|
+
class JWEDecompressionFailed extends JOSEError {
|
|
73
|
+
constructor() {
|
|
74
|
+
super(...arguments);
|
|
75
|
+
this.code = 'ERR_JWE_DECOMPRESSION_FAILED';
|
|
76
|
+
this.message = 'decompression operation failed';
|
|
77
|
+
}
|
|
78
|
+
static get code() {
|
|
79
|
+
return 'ERR_JWE_DECOMPRESSION_FAILED';
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.JWEDecompressionFailed = JWEDecompressionFailed;
|
|
72
83
|
class JWEInvalid extends JOSEError {
|
|
73
84
|
constructor() {
|
|
74
85
|
super(...arguments);
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { promisify } from 'util';
|
|
2
2
|
import { inflateRaw as inflateRawCb, deflateRaw as deflateRawCb } from 'zlib';
|
|
3
|
+
import { JWEDecompressionFailed } from '../util/errors.js';
|
|
3
4
|
const inflateRaw = promisify(inflateRawCb);
|
|
4
5
|
const deflateRaw = promisify(deflateRawCb);
|
|
5
|
-
export const inflate = (input) => inflateRaw(input)
|
|
6
|
+
export const inflate = (input) => inflateRaw(input, { maxOutputLength: 250000 }).catch(() => {
|
|
7
|
+
throw new JWEDecompressionFailed();
|
|
8
|
+
});
|
|
6
9
|
export const deflate = (input) => deflateRaw(input);
|
|
@@ -60,6 +60,16 @@ export class JWEDecryptionFailed extends JOSEError {
|
|
|
60
60
|
return 'ERR_JWE_DECRYPTION_FAILED';
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
+
export class JWEDecompressionFailed extends JOSEError {
|
|
64
|
+
constructor() {
|
|
65
|
+
super(...arguments);
|
|
66
|
+
this.code = 'ERR_JWE_DECOMPRESSION_FAILED';
|
|
67
|
+
this.message = 'decompression operation failed';
|
|
68
|
+
}
|
|
69
|
+
static get code() {
|
|
70
|
+
return 'ERR_JWE_DECOMPRESSION_FAILED';
|
|
71
|
+
}
|
|
72
|
+
}
|
|
63
73
|
export class JWEInvalid extends JOSEError {
|
|
64
74
|
constructor() {
|
|
65
75
|
super(...arguments);
|
|
@@ -62,6 +62,15 @@ export declare class JWEDecryptionFailed extends JOSEError {
|
|
|
62
62
|
code: string;
|
|
63
63
|
message: string;
|
|
64
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* An error subclass thrown when a JWE ciphertext decompression fails.
|
|
67
|
+
*
|
|
68
|
+
*/
|
|
69
|
+
export declare class JWEDecompressionFailed extends JOSEError {
|
|
70
|
+
static get code(): 'ERR_JWE_DECOMPRESSION_FAILED';
|
|
71
|
+
code: string;
|
|
72
|
+
message: string;
|
|
73
|
+
}
|
|
65
74
|
/**
|
|
66
75
|
* An error subclass thrown when a JWE is invalid.
|
|
67
76
|
*
|
package/package.json
CHANGED