@mega-yfue/eufy-sdk 0.4.0-beta.11 → 0.4.0-beta.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/dist/index.js
CHANGED
|
@@ -5743,7 +5743,7 @@ var SIREN_CMD = {
|
|
|
5743
5743
|
ALARM_TEST: 1826,
|
|
5744
5744
|
/** Manually stop a sounding alarm (app `APP_CMD_SIREN_SENSOR_MANUAL_STOP_ALARM`). */
|
|
5745
5745
|
MANUAL_STOP: 1871,
|
|
5746
|
-
/** Station-family HomeBase duration alarm, verified live on T8010 (app `SET_TONE_FILE`). */
|
|
5746
|
+
/** Station-family HomeBase duration alarm, verified live on T8010 and T8030 (app `SET_TONE_FILE`). */
|
|
5747
5747
|
HOMEBASE_TONE: 1201,
|
|
5748
5748
|
/** HomeBase alarm volume percentage (app `CMD_SET_HUB_SPK_VOLUME`). */
|
|
5749
5749
|
HUB_SPK_VOLUME: 1235,
|
|
@@ -5758,7 +5758,7 @@ var SirenAlarmDuration = { Min1: 60, Min5: 300, Min10: 600, Min15: 900 };
|
|
|
5758
5758
|
var HubAlarmTone = { Tone1: 1, Tone2: 2 };
|
|
5759
5759
|
var HUB_ALARM_EVIDENCE = [SIREN_CMD.HUB_ALARM_TONE, 1282];
|
|
5760
5760
|
function isStationAlarmOutput(ctx) {
|
|
5761
|
-
return ctx.deviceType === DeviceType.STATION;
|
|
5761
|
+
return ctx.deviceType === DeviceType.STATION || ctx.deviceType === DeviceType.HB3;
|
|
5762
5762
|
}
|
|
5763
5763
|
function isEvidencedStationAlarm(ctx) {
|
|
5764
5764
|
return isStationAlarmOutput(ctx) && HUB_ALARM_EVIDENCE.some((param) => ctx.paramIds.has(param));
|
|
@@ -15230,6 +15230,7 @@ var CMD_DATABASE_IMAGE = 1308;
|
|
|
15230
15230
|
var CMD_DATABASE = 1306;
|
|
15231
15231
|
var DB_QUERY = { FULL_TABLE: 1e4, COMBINATION_WITH_AI: 10011 };
|
|
15232
15232
|
var GCM_AAD = Buffer.from("eufy security");
|
|
15233
|
+
var LEVEL2_SEQ_BASE = 16909056;
|
|
15233
15234
|
function paramReport(payload) {
|
|
15234
15235
|
const list = payload?.params;
|
|
15235
15236
|
if (!Array.isArray(list))
|
|
@@ -16334,11 +16335,6 @@ var P2PSession = class _P2PSession extends EventEmitter2 {
|
|
|
16334
16335
|
this.seqNumber = this.seqNumber + 1 & 65535;
|
|
16335
16336
|
this.send(this.connectAddress, RequestMessageType.DATA, data);
|
|
16336
16337
|
}
|
|
16337
|
-
/**
|
|
16338
|
-
* Encrypt a level-2 command body (signCode 8): `tag(16) ‖ nonce(12) ‖ [seq,03,02,01](4) ‖
|
|
16339
|
-
* ciphertext`, AES-256-GCM under the negotiated session key, AAD "eufy security". Inverse of
|
|
16340
|
-
* `decryptLevel2`. The 4-byte sub-header is cleartext (skipped on decrypt); `seq` is a counter.
|
|
16341
|
-
*/
|
|
16342
16338
|
/**
|
|
16343
16339
|
* Decode a `CMD_VIDEO_FRAME` (1300) payload into clean Annex-B H.264 (the 22-byte frame header
|
|
16344
16340
|
* stripped). Reversed from the V6 app + live H.264 captures: the 22-byte header is
|
|
@@ -16405,6 +16401,11 @@ var P2PSession = class _P2PSession extends EventEmitter2 {
|
|
|
16405
16401
|
}
|
|
16406
16402
|
return this.rsaModulusHex;
|
|
16407
16403
|
}
|
|
16404
|
+
/**
|
|
16405
|
+
* Encrypt a level-2 command body (signCode 8): `tag(16) ‖ nonce(12) ‖ seq(4) ‖ ciphertext`,
|
|
16406
|
+
* AES-256-GCM under the negotiated session key, AAD "eufy security". Inverse of `decryptLevel2`.
|
|
16407
|
+
* The 4-byte sub-header is cleartext (skipped on decrypt); `seq` counts up from {@link LEVEL2_SEQ_BASE}.
|
|
16408
|
+
*/
|
|
16408
16409
|
encryptLevel2(plaintext) {
|
|
16409
16410
|
if (!this.level2Key)
|
|
16410
16411
|
return void 0;
|
|
@@ -16412,8 +16413,8 @@ var P2PSession = class _P2PSession extends EventEmitter2 {
|
|
|
16412
16413
|
const c = createCipheriv3("aes-256-gcm", this.level2Key, nonce);
|
|
16413
16414
|
c.setAAD(GCM_AAD);
|
|
16414
16415
|
const ct = Buffer.concat([c.update(plaintext), c.final()]);
|
|
16415
|
-
const sub2 = Buffer.
|
|
16416
|
-
|
|
16416
|
+
const sub2 = Buffer.alloc(4);
|
|
16417
|
+
sub2.writeUInt32LE(LEVEL2_SEQ_BASE + this.level2Seq++ >>> 0);
|
|
16417
16418
|
return Buffer.concat([c.getAuthTag(), nonce, sub2, ct]);
|
|
16418
16419
|
}
|
|
16419
16420
|
/** Send a no-arg command frame (e.g. CMD_GATEWAYINFO) on a channel (default: the station channel). */
|