@mega-yfue/eufy-sdk 0.4.0-beta.11 → 0.4.0-beta.12
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
|
@@ -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). */
|