@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 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 (this.isEncrypted && payloadLength > 0) {
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 (this.isEncrypted) {
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
- async noOp() {
632
+ noOp() {
632
633
  this.#context.logger.debug("Sending no-op operation.");
633
- await this.#stream.send(FrameType.NoOp, Buffer.allocUnsafe(0));
634
+ this.#stream.send(FrameType.NoOp, Buffer.allocUnsafe(0));
634
635
  }
635
636
  }
636
637
  function objectOrFail(obj) {
@@ -34,5 +34,5 @@ export default class Protocol {
34
34
  tiStart(): Promise<object>;
35
35
  touchStart(): Promise<object>;
36
36
  tvrcSessionStart(): Promise<object>;
37
- noOp(): Promise<void>;
37
+ noOp(): void;
38
38
  }
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.0",
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.0",
44
- "@basmilius/apple-encoding": "0.7.0",
45
- "@basmilius/apple-encryption": "0.7.0"
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",