@basmilius/apple-airplay 0.13.3 → 0.13.4
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.mjs +24 -16
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -12926,21 +12926,26 @@ function chacha20Decrypt(state, data) {
|
|
|
12926
12926
|
const result = [];
|
|
12927
12927
|
let offset = 0;
|
|
12928
12928
|
let readCount = state.readCount ?? 0;
|
|
12929
|
-
|
|
12930
|
-
|
|
12931
|
-
|
|
12932
|
-
|
|
12933
|
-
|
|
12934
|
-
|
|
12935
|
-
|
|
12936
|
-
|
|
12937
|
-
|
|
12938
|
-
|
|
12939
|
-
|
|
12940
|
-
|
|
12941
|
-
|
|
12942
|
-
|
|
12943
|
-
|
|
12929
|
+
try {
|
|
12930
|
+
while (offset < data.length) {
|
|
12931
|
+
if (offset + 2 > data.length) return false;
|
|
12932
|
+
const frameLength = data.readUInt16LE(offset);
|
|
12933
|
+
offset += 2;
|
|
12934
|
+
if (frameLength === 0) throw new Error("Corrupt encrypted frame: zero-length frame");
|
|
12935
|
+
const end = offset + frameLength + 16;
|
|
12936
|
+
if (end > data.length) return false;
|
|
12937
|
+
const ciphertext = data.subarray(offset, offset + frameLength);
|
|
12938
|
+
const authTag = data.subarray(offset + frameLength, end);
|
|
12939
|
+
offset = end;
|
|
12940
|
+
const plaintext = Chacha20.decrypt(state.readKey, nonce(readCount++), Buffer.from(Uint16Array.of(frameLength).buffer.slice(0, 2)), ciphertext, authTag);
|
|
12941
|
+
result.push(plaintext);
|
|
12942
|
+
}
|
|
12943
|
+
state.readCount = readCount;
|
|
12944
|
+
return Buffer.concat(result);
|
|
12945
|
+
} catch (err) {
|
|
12946
|
+
state.readCount = readCount;
|
|
12947
|
+
throw err;
|
|
12948
|
+
}
|
|
12944
12949
|
}
|
|
12945
12950
|
/**
|
|
12946
12951
|
* Encrypts data using AirPlay's ChaCha20-Poly1305 frame format.
|
|
@@ -13790,7 +13795,8 @@ var DataStream = class extends BaseStream {
|
|
|
13790
13795
|
if (command === "sync") this.reply(parseHeaderSeqno(header));
|
|
13791
13796
|
}
|
|
13792
13797
|
} catch (err) {
|
|
13793
|
-
this.#
|
|
13798
|
+
this.#encryptedBuffer = Buffer.alloc(0);
|
|
13799
|
+
this.#buffer = Buffer.alloc(0);
|
|
13794
13800
|
this.context.logger.error("[data]", "onStreamData()", err);
|
|
13795
13801
|
this.emit("error", err);
|
|
13796
13802
|
}
|
|
@@ -14204,6 +14210,8 @@ var EventStream = class extends BaseStream {
|
|
|
14204
14210
|
await this.#handle(result.method, result.path, result.headers, result.body);
|
|
14205
14211
|
}
|
|
14206
14212
|
} catch (err) {
|
|
14213
|
+
this.#encryptedBuffer = Buffer.alloc(0);
|
|
14214
|
+
this.#buffer = Buffer.alloc(0);
|
|
14207
14215
|
this.context.logger.error("[event]", "onStreamData()", err);
|
|
14208
14216
|
this.emit("error", err);
|
|
14209
14217
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basmilius/apple-airplay",
|
|
3
3
|
"description": "Implementation of Apple's AirPlay2 in Node.js.",
|
|
4
|
-
"version": "0.13.
|
|
4
|
+
"version": "0.13.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": {
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@basmilius/apple-common": "0.13.
|
|
51
|
-
"@basmilius/apple-encoding": "0.13.
|
|
52
|
-
"@basmilius/apple-encryption": "0.13.
|
|
53
|
-
"@basmilius/apple-rtsp": "0.13.
|
|
50
|
+
"@basmilius/apple-common": "0.13.4",
|
|
51
|
+
"@basmilius/apple-encoding": "0.13.4",
|
|
52
|
+
"@basmilius/apple-encryption": "0.13.4",
|
|
53
|
+
"@basmilius/apple-rtsp": "0.13.4"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@bufbuild/buf": "^1.66.1",
|