@substrate-system/crypto-stream 0.0.33

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.
Files changed (43) hide show
  1. package/LICENSE +99 -0
  2. package/README.md +366 -0
  3. package/dist/concat-streams.cjs +59 -0
  4. package/dist/ece.cjs +375 -0
  5. package/dist/extract-transformer.cjs +55 -0
  6. package/dist/index.cjs +28 -0
  7. package/dist/keychain.cjs +344 -0
  8. package/dist/slice-transformer.cjs +75 -0
  9. package/dist/src/concat-streams.d.ts +9 -0
  10. package/dist/src/concat-streams.d.ts.map +1 -0
  11. package/dist/src/concat-streams.js +46 -0
  12. package/dist/src/concat-streams.js.map +1 -0
  13. package/dist/src/ece.d.ts +66 -0
  14. package/dist/src/ece.d.ts.map +1 -0
  15. package/dist/src/ece.js +373 -0
  16. package/dist/src/ece.js.map +1 -0
  17. package/dist/src/extract-transformer.d.ts +18 -0
  18. package/dist/src/extract-transformer.d.ts.map +1 -0
  19. package/dist/src/extract-transformer.js +40 -0
  20. package/dist/src/extract-transformer.js.map +1 -0
  21. package/dist/src/index.d.ts +3 -0
  22. package/dist/src/index.d.ts.map +1 -0
  23. package/dist/src/index.js +3 -0
  24. package/dist/src/index.js.map +1 -0
  25. package/dist/src/keychain.d.ts +103 -0
  26. package/dist/src/keychain.d.ts.map +1 -0
  27. package/dist/src/keychain.js +267 -0
  28. package/dist/src/keychain.js.map +1 -0
  29. package/dist/src/slice-transformer.d.ts +19 -0
  30. package/dist/src/slice-transformer.d.ts.map +1 -0
  31. package/dist/src/slice-transformer.js +58 -0
  32. package/dist/src/slice-transformer.js.map +1 -0
  33. package/dist/src/transform-stream.d.ts +11 -0
  34. package/dist/src/transform-stream.d.ts.map +1 -0
  35. package/dist/src/transform-stream.js +136 -0
  36. package/dist/src/transform-stream.js.map +1 -0
  37. package/dist/src/util.d.ts +27 -0
  38. package/dist/src/util.d.ts.map +1 -0
  39. package/dist/src/util.js +49 -0
  40. package/dist/src/util.js.map +1 -0
  41. package/dist/transform-stream.cjs +159 -0
  42. package/dist/util.cjs +57 -0
  43. package/package.json +86 -0
package/LICENSE ADDED
@@ -0,0 +1,99 @@
1
+ # Big Time Public License
2
+
3
+ Version 2.0.2
4
+
5
+ <https://bigtimelicense.com/versions/2.0.2>
6
+
7
+ ## Purpose
8
+
9
+ These terms let you use and share this software for noncommercial purposes and in small business for free, while also guaranteeing that paid licenses for big businesses will be available on fair, reasonable, and nondiscriminatory terms.
10
+
11
+ ## Acceptance
12
+
13
+ In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
14
+
15
+ ## Noncommercial Purposes
16
+
17
+ You may use the software for any noncommercial purpose.
18
+
19
+ ## Personal Uses
20
+
21
+ Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, count as use for noncommercial purposes.
22
+
23
+ ## Noncommercial Organizations
24
+
25
+ Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution counts as use for noncommercial purposes, regardless of the source of funding or obligations resulting from the funding.
26
+
27
+ ## Small Business
28
+
29
+ You may use the software for the benefit of your company if it meets all these criteria:
30
+
31
+ 1. had fewer than 20 total individuals working as employees and independent contractors at all times during the last tax year
32
+
33
+ 2. earned less than $1,000,000 total revenue in the last tax year
34
+
35
+ 3. received less than $1,000,000 total debt, equity, and other investment in the last five tax years, counting investment in predecessor companies that reorganized into, merged with, or spun out your company
36
+
37
+ All dollar figures are United States dollars as of 2019. Adjust for them inflation according to the United States Bureau of Labor Statistics' consumer price index for all urban consumers, United States city average, for all items, not seasonally adjusted, with 1982–1984=100 reference base.
38
+
39
+ ## Big Business
40
+
41
+ You may use the software for the benefit of your company:
42
+
43
+ 1. for 128 days after your company stops qualifying under [Small Business](#small-business)
44
+
45
+ 2. indefinitely, if the licensor or their legal successor does not offer fair, reasonable, and nondiscriminatory terms for a commercial license for the software within 32 days of [written request](#how-to-request) and negotiate in good faith to conclude a deal
46
+
47
+ ## How to Request
48
+
49
+ If this software includes an address for the licensor or an agent of the licensor in a standard place, such as in documentation, software package metadata, or an "about" page or screen, try to request a fair commercial license at that address. If this package includes both online and offline addresses, try online before offline. If you can't deliver a request that way, or this software doesn't include any addressees, spend one hour online researching an address, recording all your searches and inquiries as you go, and try any addresses that you find. If you can't find any addresses, or if those addresses also fail, that counts as failure to offer a fair commercial license by the licensor under [Big Business](#big-business).
50
+
51
+ ## Fair, Reasonable, and Nondiscriminatory Terms
52
+
53
+ Fair, reasonable, and nondiscriminatory terms may license the software perpetually or for a term, and may or may not cover new versions of the software. If the licensor advertises license terms and a pricing structure for generally available commercial licenses, the licensor proposes license terms and a price as advertised, and a customer not affiliated with the licensor has bought a commercial license for the software on substantially equivalent terms in the past year, the proposal is fair, reasonable, and nondiscriminatory.
54
+
55
+ ## Copyright License
56
+
57
+ The licensor grants you a copyright license to do everything with the software that would otherwise infringe the licensor's copyright in it for any purpose allowed by these terms.
58
+
59
+ ## Notices
60
+
61
+ You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with `Required Notice:` that the licensor provided with the software. For example:
62
+
63
+ > Required Notice: Copyright Nick Thomas (https://nichoth.com)
64
+
65
+ ## Patent License
66
+
67
+ The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
68
+
69
+ ## Fair Use
70
+
71
+ You may have "fair use" rights for the software under the law. These terms do not limit them.
72
+
73
+ ## No Other Rights
74
+
75
+ These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
76
+
77
+ ## Patent Defense
78
+
79
+ If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
80
+
81
+ ## Violations
82
+
83
+ The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
84
+
85
+ ## No Liability
86
+
87
+ ***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
88
+
89
+ ## Definitions
90
+
91
+ The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
92
+
93
+ **You** refers to the individual or entity agreeing to these terms.
94
+
95
+ **Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **Control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
96
+
97
+ **Your licenses** are all the licenses granted to you for the software under these terms.
98
+
99
+ **Use** means anything you do with the software requiring one of your licenses.
package/README.md ADDED
@@ -0,0 +1,366 @@
1
+ # crypto stream
2
+ [![tests](https://img.shields.io/github/actions/workflow/status/mycelial-systems/crypto-stream/nodejs.yml?style=flat-square)](https://github.com/mycelial-systems/crypto-stream/actions/workflows/nodejs.yml)
3
+ [![module](https://img.shields.io/badge/module-ESM%2FCJS-blue?style=flat-square)](README.md)
4
+ [![types](https://img.shields.io/npm/types/@substrate-system/crypto-stream?style=flat-square)](README.md)
5
+ [![semantic versioning](https://img.shields.io/badge/semver-2.0.0-blue?logo=semver&style=flat-square)](https://semver.org/)
6
+ [![Common Changelog](https://nichoth.github.io/badge/common-changelog.svg)](./CHANGELOG.md)
7
+ [![install size](https://flat.badgen.net/packagephobia/install/@substrate-system/crypto-stream?cache-control=no-cache)](https://packagephobia.com/result?p=@substrate-system/crypto-stream)
8
+ [![license](https://img.shields.io/badge/license-Big_Time-blue?style=flat-square)](LICENSE)
9
+
10
+
11
+ Streaming encryption for the browser, based on
12
+ [Encrypted Content-Encoding for HTTP (RFC 8188)](https://tools.ietf.org/html/rfc8188)
13
+
14
+ This uses the [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API).
15
+
16
+
17
+ <details><summary><h2>Contents</h2></summary>
18
+
19
+ <!-- toc -->
20
+
21
+ - [install](#install)
22
+ - [fork](#fork)
23
+ - [example](#example)
24
+ * [example with blobs](#example-with-blobs)
25
+ - [API](#api)
26
+ * [`new Keychain([key, [salt]])`](#new-keychainkey-salt)
27
+ * [`keychain.key`](#keychainkey)
28
+ * [`keychain.keyB64`](#keychainkeyb64)
29
+ * [`keychain.salt`](#keychainsalt)
30
+ * [`keychain.saltB64`](#keychainsaltb64)
31
+ * [`keychain.authToken()`](#keychainauthtoken)
32
+ * [`keychain.authTokenB64()`](#keychainauthtokenb64)
33
+ * [`keychain.authHeader()`](#keychainauthheader)
34
+ * [`keychain.setAuthToken(authToken)`](#keychainsetauthtokenauthtoken)
35
+ * [`keychain.encryptStream(stream)`](#keychainencryptstreamstream)
36
+ * [`keychain.decryptStream(encryptedStream)`](#keychaindecryptstreamencryptedstream)
37
+ * [`keychain.decryptStreamRange(offset, length, totalEncryptedLength)`](#keychaindecryptstreamrangeoffset-length-totalencryptedlength)
38
+ * [`keychain.encryptMeta(meta)`](#keychainencryptmetameta)
39
+ * [`keychain.decryptMeta(ivEncryptedMeta)`](#keychaindecryptmetaivencryptedmeta)
40
+ * [`keychain.encryptBytes(bytes)`](#keychainencryptbytesbytes)
41
+ * [`keychain.decryptBytes(bytes)`](#keychaindecryptbytesbytes)
42
+ * [`plaintextSize(encryptedSize)`](#plaintextsizeencryptedsize)
43
+ * [`encryptedSize(plaintextSize)`](#encryptedsizeplaintextsize)
44
+ - [credits](#credits)
45
+
46
+ <!-- tocstop -->
47
+
48
+ </details>
49
+
50
+ ## install
51
+ ```sh
52
+ npm i -S @substrate-system/crypto-stream
53
+ ```
54
+
55
+ ## fork
56
+ This is a fork of [SocketDev/wormhole-crypto](https://github.com/SocketDev/wormhole-crypto). Thanks [@SocketDev](https://github.com/SocketDev) team for working in open source.
57
+
58
+ ## example
59
+
60
+ ```js
61
+ import { Keychain } from '@substrate-system/crypto-stream'
62
+
63
+ // Create a new keychain. Since no arguments are specified, the key and salt
64
+ // are generated.
65
+ const keychain = new Keychain()
66
+
67
+ // Get a WHATWG stream somehow, from fetch(), from a Blob(), etc.
68
+ const stream = getStream()
69
+
70
+ // Create an encrypted version of that stream
71
+ const encryptedStream = await keychain.encryptStream(stream)
72
+
73
+ // Normally you'd now use `encryptedStream`, e.g. in fetch(), etc.
74
+ // However, for this example, we'll just decrypt the stream immediately
75
+ const plaintextStream = await keychain.decryptStream(encryptedStream)
76
+
77
+ // Now, you can use `plaintextStream` and it will be identical
78
+ // to if you had used `stream`.
79
+ ```
80
+
81
+ ### example with blobs
82
+
83
+ See [./example](./example/index.ts) for a version that uses blobs + a
84
+ local `vite` server.
85
+
86
+ ```js
87
+ import { Keychain } from '@substrate-system/crypto-stream'
88
+
89
+ const encryptedData = await fetch(imgUrl)
90
+ const decryptedStream = await keychain.decryptStream(encryptedData.body)
91
+ const response = new Response(decryptedStream)
92
+ const blobUrl = window.URL.createObjectURL(await response.blob())
93
+
94
+ // ...
95
+
96
+ function Component () {
97
+ return html`<img src="${blobUrl}" />`
98
+ }
99
+ ```
100
+
101
+ ## API
102
+
103
+ ### `new Keychain([key, [salt]])`
104
+ ```ts
105
+ constructor (key?:string|Uint8Array, salt?:string|Uint8Array)
106
+ ```
107
+
108
+ Type: `Class`
109
+
110
+ Returns: `Keychain`
111
+
112
+ Create a new keychain object. The keychain can be used to create encryption
113
+ streams, decryption streams, and to encrypt or decrypt a "metadata" buffer.
114
+
115
+ #### `key`
116
+
117
+ Type: `Uint8Array | string | null`
118
+
119
+ Default: `null`
120
+
121
+ The main key. This should be 16 bytes in length. If a `string` is given,
122
+ then it should be a base64-encoded string. If the argument is `null`, then a
123
+ key will be automatically generated.
124
+
125
+ #### `salt`
126
+
127
+ Type: `Uint8Array | string | null`
128
+
129
+ Default: `null`
130
+
131
+ The salt. This should be 16 bytes in length. If a `string` is given,
132
+ then it should be a base64-encoded string. If this argument is `null`, then a
133
+ salt will be automatically generated.
134
+
135
+ ### `keychain.key`
136
+
137
+ ```ts
138
+ key:Uint8Array
139
+ ```
140
+
141
+ The main key.
142
+
143
+ ### `keychain.keyB64`
144
+
145
+ ```ts
146
+ keyB64:string
147
+ ```
148
+
149
+ The main key as a base64url-encoded string.
150
+
151
+ ### `keychain.salt`
152
+
153
+ ```ts
154
+ salt:Uint8Array
155
+ ```
156
+
157
+ The salt.
158
+
159
+ Implementation note: The salt is used to derive the (internal) metadata key and
160
+ authentication token.
161
+
162
+ ### `keychain.saltB64`
163
+
164
+ ```ts
165
+ saltB64:string
166
+ ```
167
+ The salt as a base64-encoded string.
168
+
169
+ ### `keychain.authToken()`
170
+ ```ts
171
+ authToken ():Promise<ArrayBuffer>
172
+ ```
173
+
174
+ Returns the authentication token. By default, the authentication token is
175
+ automatically derived from the main key using HKDF SHA-256.
176
+
177
+ The authentication token can be used to communicate with the server and
178
+ prove that the client has permission to fetch some data. Without a valid
179
+ authentication token, the server can reject the request.
180
+
181
+ Since the authentication token is derived from the main key, the client would
182
+ present it to the server as a "reader token" to prove that it is in possession
183
+ of the main key without revealing the main key to the server.
184
+
185
+ For destructive operations, the client should instead
186
+ present a "writer token", which is not derived from the main key but is provided
187
+ by the server.
188
+
189
+ ### `keychain.authTokenB64()`
190
+
191
+ ```ts
192
+ authTokenB64 ():Promise<string>
193
+ ```
194
+
195
+ Returns the authentication token as a base64-encoded string.
196
+
197
+ ### `keychain.authHeader()`
198
+
199
+ ```ts
200
+ authHeader ():Promise<string>
201
+ // => `Bearer sync-v1 ${authTokenB64}`
202
+ ```
203
+
204
+ Returns a `Promise` that resolves to the HTTP header value to be provided to the server, as a base64 string. It contains the authentication token.
205
+
206
+ ### `keychain.setAuthToken(authToken)`
207
+
208
+ ```ts
209
+ setAuthToken (authToken:string|Uint8Array|null):void
210
+ ```
211
+
212
+ Update the keychain authentication token to the given `authToken`.
213
+
214
+ #### `authToken`
215
+
216
+ Type: `Uint8Array | string | null`
217
+
218
+ Default: `null`
219
+
220
+ The authentication token. This should be 16 bytes in length. If a `string` is
221
+ given, then it should be a base64-encoded string. If this argument is `null`,
222
+ then an authentication token will be automatically generated.
223
+
224
+ ### `keychain.encryptStream(stream)`
225
+
226
+ ```ts
227
+ encryptStream (stream:ReadableStream):Promise<ReadableStream>
228
+ ```
229
+
230
+ Type: `Function`
231
+
232
+ Returns: `Promise<ReadableStream>`
233
+
234
+ Returns a `Promise` that resolves to a `ReadableStream` encryption stream that
235
+ consumes the data in `stream` and returns an encrypted version. Data is
236
+ encrypted with [Encrypted Content-Encoding for HTTP (RFC 8188)](https://tools.ietf.org/html/rfc8188).
237
+
238
+ #### `stream`
239
+
240
+ Type: `ReadableStream`
241
+
242
+ A WHATWG readable stream used as a data source for the encrypted stream.
243
+
244
+ ### `keychain.decryptStream(encryptedStream)`
245
+
246
+ Type: `Function`
247
+
248
+ Returns: `Promise<ReadableStream>`
249
+
250
+ Returns a `Promise` that resolves to a `ReadableStream` decryption stream that
251
+ consumes the data in `encryptedStream` and returns a plaintext version.
252
+
253
+ ### `keychain.decryptStreamRange(offset, length, totalEncryptedLength)`
254
+
255
+ ```ts
256
+ function decryptStreamRange (
257
+ secretKey:CryptoKey,
258
+ offset:number,
259
+ length:number,
260
+ totalEncryptedLength:number,
261
+ rs:number = RECORD_SIZE
262
+ ):{
263
+ ranges:{ offset:number, length:number }[],
264
+ decrypt:(streams:ReadableStream[])=>ReadableStream
265
+ }
266
+ ```
267
+
268
+ Returns a `Promise` that resolves to a object containing `ranges`, which is
269
+ an array of objects containing `offset` and `length` integers specifying the
270
+ encrypted byte ranges that are needed to decrypt the client's specified range,
271
+ and a `decrypt` function.
272
+
273
+ Once the client has gathered a stream for each byte range in `ranges`,
274
+ the client should call `decrypt(streams)`, where `streams` is an array of
275
+ `ReadableStream` objects, one for each of the requested ranges. `decrypt`
276
+ will then return a `ReadableStream` containing the plaintext data for the
277
+ client's desired byte range.
278
+
279
+ #### `encryptedStream`
280
+
281
+ Type: `ReadableStream`
282
+
283
+ A WHATWG readable stream used as a data source for the plaintext stream.
284
+
285
+ ### `keychain.encryptMeta(meta)`
286
+
287
+ ```ts
288
+ encryptMeta (meta:Uint8Array):Promise<Uint8Array>
289
+ ```
290
+
291
+ Returns a `Promise` that resolves to an encrypted version of `meta`. The
292
+ metadata is encrypted with AES-GCM.
293
+
294
+ Implementation note: The metadata key is automatically derived from the main
295
+ key using HKDF SHA-256. The value is not user-controlled.
296
+
297
+ Implementation note: The initialization vector (IV) is automatically generated
298
+ and included in the encrypted output. No need to generate it or to manage it
299
+ separately from the encrypted output.
300
+
301
+ #### `meta`
302
+
303
+ Type: `Uint8Array`
304
+
305
+ The metadata buffer to encrypt.
306
+
307
+ ### `keychain.decryptMeta(ivEncryptedMeta)`
308
+ ```ts
309
+ decryptMeta (ivEncryptedMeta:Uint8Array):Promise<Uint8Array>
310
+ ```
311
+
312
+ Returns: `Promise<Uint8Array>`
313
+
314
+ Returns a `Promise` that resolves to a decrypted version of `encryptedMeta`.
315
+
316
+ #### `ivEncryptedMeta`
317
+
318
+ Type: `Uint8Array`
319
+
320
+ The encrypted metadata buffer to decrypt.
321
+
322
+ ### `keychain.encryptBytes(bytes)`
323
+
324
+ ```ts
325
+ async function encryptBytes (
326
+ bytes:ArrayBuffer|Uint8Array,
327
+ opts?:{ iv?:Uint8Array },
328
+ ):Promise<Uint8Array>
329
+ ```
330
+
331
+ Encrypt and return the given data in-memory, not using streams.
332
+
333
+ ### `keychain.decryptBytes(bytes)`
334
+
335
+ ```ts
336
+ async function decryptBytes (
337
+ bytes:Uint8Array,
338
+ ):Promise<ArrayBuffer>
339
+ ```
340
+
341
+ Decrypt the given data in-memory, without streaming.
342
+
343
+ ### `plaintextSize(encryptedSize)`
344
+
345
+ ```ts
346
+ function plaintextSize (
347
+ encryptedSize:number,
348
+ rs:number = RECORD_SIZE
349
+ ):number
350
+ ```
351
+
352
+ Given an encrypted size, return the corresponding plaintext size.
353
+
354
+ ### `encryptedSize(plaintextSize)`
355
+ ```ts
356
+ function encryptedSize (
357
+ plaintextSize:number,
358
+ rs:number = RECORD_SIZE
359
+ ):number
360
+ ```
361
+
362
+ Given a plaintext size, return the corresponding encrypted size.
363
+
364
+ ## credits
365
+
366
+ Thank you [Feross](https://github.com/feross) and [SocketDev](https://github.com/SocketDev) team for writing and publishing this.
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var concat_streams_exports = {};
21
+ __export(concat_streams_exports, {
22
+ concatStreams: () => concatStreams
23
+ });
24
+ module.exports = __toCommonJS(concat_streams_exports);
25
+ function concatStreams(inputStreams) {
26
+ let currentReader = null;
27
+ const nextStream = /* @__PURE__ */ __name((controller) => {
28
+ const stream = inputStreams.shift();
29
+ if (stream !== void 0) {
30
+ currentReader = stream.getReader();
31
+ } else {
32
+ currentReader = null;
33
+ controller.close();
34
+ }
35
+ }, "nextStream");
36
+ return new ReadableStream({
37
+ start(controller) {
38
+ nextStream(controller);
39
+ },
40
+ async pull(controller) {
41
+ while (currentReader !== null) {
42
+ const { value, done } = await currentReader.read();
43
+ if (done) {
44
+ nextStream(controller);
45
+ } else {
46
+ controller.enqueue(value);
47
+ break;
48
+ }
49
+ }
50
+ },
51
+ async cancel(reason) {
52
+ await Promise.all([
53
+ currentReader && currentReader.cancel(reason),
54
+ ...inputStreams.map((stream) => stream.cancel(reason))
55
+ ]);
56
+ }
57
+ });
58
+ }
59
+ __name(concatStreams, "concatStreams");