dsc-itv2-client 1.0.11 → 1.0.13
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/package.json +1 -1
- package/src/ITV2Client.js +27 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsc-itv2-client",
|
|
3
3
|
"author": "fajitacat",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.13",
|
|
5
5
|
"description": "Reverse engineered DSC ITV2 Protocol Client Library for TL280R Communicator - Monitor and control DSC alarm panels",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"type": "module",
|
package/src/ITV2Client.js
CHANGED
|
@@ -375,7 +375,7 @@ export class ITV2Client extends EventEmitter {
|
|
|
375
375
|
} else if (this.handshakeState === 'SENT_REQUEST_ACCESS') {
|
|
376
376
|
// Panel ACKed our REQUEST_ACCESS - session established!
|
|
377
377
|
this.handshakeState = 'ESTABLISHED';
|
|
378
|
-
this._logMinimal(
|
|
378
|
+
this._logMinimal(`[Handshake] Session established (Type ${this.detectedEncryptionType} encryption)`);
|
|
379
379
|
this._log(`[Handshake] *** SESSION ESTABLISHED ***`);
|
|
380
380
|
this._log(`[Handshake] Encryption Type: ${this.detectedEncryptionType}`);
|
|
381
381
|
this._log(`[Handshake] SEND key: ${this.session.derivedSendKey?.toString('hex')}`);
|
|
@@ -440,7 +440,32 @@ export class ITV2Client extends EventEmitter {
|
|
|
440
440
|
const response = this.session.buildCommandResponseWithAppSeq(appSeq, 0x00);
|
|
441
441
|
this._sendPacket(response);
|
|
442
442
|
|
|
443
|
-
|
|
443
|
+
// Send our REQUEST_ACCESS immediately (panel doesn't ACK our COMMAND_RESPONSE)
|
|
444
|
+
this._log(`[Handshake] Sending our REQUEST_ACCESS`);
|
|
445
|
+
|
|
446
|
+
// Enable encryption with SEND key
|
|
447
|
+
this.session.sendAesActive = true;
|
|
448
|
+
this.session.sendAesKey = this.session.derivedSendKey;
|
|
449
|
+
this._log(`[Handshake] Encrypting REQUEST_ACCESS with SEND key`);
|
|
450
|
+
|
|
451
|
+
// Build REQUEST_ACCESS based on detected encryption type
|
|
452
|
+
let reqAccessPacket;
|
|
453
|
+
if (this.detectedEncryptionType === 2) {
|
|
454
|
+
this._log(`[Handshake] Using Type 2 REQUEST_ACCESS`);
|
|
455
|
+
reqAccessPacket = this.session.buildRequestAccessType2();
|
|
456
|
+
} else {
|
|
457
|
+
this._log(`[Handshake] Using Type 1 REQUEST_ACCESS`);
|
|
458
|
+
reqAccessPacket = this.session.buildRequestAccessType1();
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
this._sendPacket(reqAccessPacket);
|
|
462
|
+
|
|
463
|
+
// Enable receive encryption
|
|
464
|
+
this.session.receiveAesActive = true;
|
|
465
|
+
this.session.receiveAesKey = this.session.pendingReceiveKey;
|
|
466
|
+
this._log(`[Handshake] Enabled receive encryption`);
|
|
467
|
+
|
|
468
|
+
this.handshakeState = 'SENT_REQUEST_ACCESS';
|
|
444
469
|
}
|
|
445
470
|
|
|
446
471
|
_handleCommandResponse(parsed) {
|