@basmilius/apple-companion-link 0.7.0 → 0.7.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.
- package/dist/index.js +5 -4
- package/dist/protocol.d.ts +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -224,15 +224,16 @@ class Stream extends EncryptionAwareConnection {
|
|
|
224
224
|
});
|
|
225
225
|
}
|
|
226
226
|
send(type, payload) {
|
|
227
|
+
const encrypt = this.isEncrypted && type !== FrameType.NoOp;
|
|
227
228
|
let payloadLength = payload.byteLength;
|
|
228
|
-
if (
|
|
229
|
+
if (encrypt) {
|
|
229
230
|
payloadLength += Chacha20.CHACHA20_AUTH_TAG_LENGTH;
|
|
230
231
|
}
|
|
231
232
|
const header = Buffer.allocUnsafe(4);
|
|
232
233
|
header.writeUint8(type, 0);
|
|
233
234
|
header.writeUintBE(payloadLength, 1, 3);
|
|
234
235
|
let data;
|
|
235
|
-
if (
|
|
236
|
+
if (encrypt) {
|
|
236
237
|
const nonce = Buffer.alloc(12);
|
|
237
238
|
nonce.writeBigUInt64LE(BigInt(this.#encryptionState.writeCount++), 0);
|
|
238
239
|
const encrypted = Chacha20.encrypt(this.#encryptionState.writeKey, nonce, header, payload);
|
|
@@ -628,9 +629,9 @@ class Protocol {
|
|
|
628
629
|
});
|
|
629
630
|
return objectOrFail(payload);
|
|
630
631
|
}
|
|
631
|
-
|
|
632
|
+
noOp() {
|
|
632
633
|
this.#context.logger.debug("Sending no-op operation.");
|
|
633
|
-
|
|
634
|
+
this.#stream.send(FrameType.NoOp, Buffer.allocUnsafe(0));
|
|
634
635
|
}
|
|
635
636
|
}
|
|
636
637
|
function objectOrFail(obj) {
|
package/dist/protocol.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basmilius/apple-companion-link",
|
|
3
3
|
"description": "Implementation of Apple's Companion Link in Node.js.",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": {
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@basmilius/apple-common": "0.7.
|
|
44
|
-
"@basmilius/apple-encoding": "0.7.
|
|
45
|
-
"@basmilius/apple-encryption": "0.7.
|
|
43
|
+
"@basmilius/apple-common": "0.7.2",
|
|
44
|
+
"@basmilius/apple-encoding": "0.7.2",
|
|
45
|
+
"@basmilius/apple-encryption": "0.7.2"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@basmilius/tools": "^2.25.0",
|