jose 6.2.1 → 6.2.2

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.
@@ -134,7 +134,11 @@ export async function flattenedDecrypt(jwe, key, options) {
134
134
  (!Number.isSafeInteger(maxDecompressedLength) || maxDecompressedLength < 1)) {
135
135
  throw new TypeError('maxDecompressedLength must be 0, a positive safe integer, or Infinity');
136
136
  }
137
- result.plaintext = await decompress(plaintext, maxDecompressedLength);
137
+ result.plaintext = await decompress(plaintext, maxDecompressedLength).catch((cause) => {
138
+ if (cause instanceof JWEInvalid)
139
+ throw cause;
140
+ throw new JWEInvalid('Failed to decompress plaintext', { cause });
141
+ });
138
142
  }
139
143
  if (jwe.protected !== undefined) {
140
144
  result.protectedHeader = parsedProt;
@@ -133,7 +133,9 @@ export class FlattenedEncrypt {
133
133
  }
134
134
  let plaintext = this.#plaintext;
135
135
  if (joseHeader.zip === 'DEF') {
136
- plaintext = await compress(plaintext);
136
+ plaintext = await compress(plaintext).catch((cause) => {
137
+ throw new JWEInvalid('Failed to compress plaintext', { cause });
138
+ });
137
139
  }
138
140
  const { ciphertext, tag, iv } = await encrypt(enc, plaintext, cek, this.#iv, additionalData);
139
141
  const jwe = {
@@ -9,7 +9,7 @@ function isCloudflareWorkers() {
9
9
  let USER_AGENT;
10
10
  if (typeof navigator === 'undefined' || !navigator.userAgent?.startsWith?.('Mozilla/5.0 ')) {
11
11
  const NAME = 'jose';
12
- const VERSION = 'v6.2.1';
12
+ const VERSION = 'v6.2.2';
13
13
  USER_AGENT = `${NAME}/${VERSION}`;
14
14
  }
15
15
  export const customFetch = Symbol();
@@ -9,8 +9,8 @@ export async function compress(input) {
9
9
  supported('CompressionStream');
10
10
  const cs = new CompressionStream('deflate-raw');
11
11
  const writer = cs.writable.getWriter();
12
- writer.write(input);
13
- writer.close();
12
+ writer.write(input).catch(() => { });
13
+ writer.close().catch(() => { });
14
14
  const chunks = [];
15
15
  const reader = cs.readable.getReader();
16
16
  for (;;) {
@@ -25,8 +25,8 @@ export async function decompress(input, maxLength) {
25
25
  supported('DecompressionStream');
26
26
  const ds = new DecompressionStream('deflate-raw');
27
27
  const writer = ds.writable.getWriter();
28
- writer.write(input);
29
- writer.close();
28
+ writer.write(input).catch(() => { });
29
+ writer.close().catch(() => { });
30
30
  const chunks = [];
31
31
  let length = 0;
32
32
  const reader = ds.readable.getReader();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jose",
3
- "version": "6.2.1",
3
+ "version": "6.2.2",
4
4
  "description": "JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes",
5
5
  "keywords": [
6
6
  "akp",