@mega-yfue/eufy-sdk 0.6.0-beta.37 → 0.6.0-beta.39
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 +220 -171
- package/dist/index.js.map +3 -3
- package/dist/model/capabilities/battery.d.ts +3 -6
- package/dist/transport/p2p/codec.d.ts +6 -0
- package/dist/transport/p2p/command-router.d.ts +3 -0
- package/dist/transport/p2p/live-trace.d.ts +1 -1
- package/dist/transport/p2p/p2p-session.d.ts +14 -2
- package/dist/transport/p2p/video.d.ts +1 -1
- package/package.json +1 -1
|
@@ -128,12 +128,9 @@ export declare const CELL_PARAMS: readonly number[];
|
|
|
128
128
|
*/
|
|
129
129
|
export declare function isChargingState(v: string | number | boolean): boolean;
|
|
130
130
|
/**
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* Each write is gated on the device reporting the param it reads back, because "has a battery" is much
|
|
135
|
-
* weaker evidence than "speaks this setting": an entry sensor reports a level (1101) and nothing else,
|
|
136
|
-
* and handing it a power-source frame it never accepts would look like success.
|
|
131
|
+
* The published `battery` table: the full camera surface, minus every member on the `sensor` codec —
|
|
132
|
+
* a sensor's 1101 is a non-cell sentinel and it has none of the camera power reads, so it exposes no
|
|
133
|
+
* battery entity (see {@link notOnSensor}). Every getter, setter and description derives from this.
|
|
137
134
|
*
|
|
138
135
|
* Exported but NOT published: each entry states its wire id and the evidence it was confirmed on,
|
|
139
136
|
* which the reference site does not carry.
|
|
@@ -94,6 +94,12 @@ export declare function p2pCommandEncryptionKey(stationSn: string, p2pDid: strin
|
|
|
94
94
|
export declare function decryptP2PData(data: Buffer, key: Buffer): Buffer;
|
|
95
95
|
/** The `cipher_id` named in a decrypted `CMD_GATEWAYINFO` (1100) payload (uint16 LE @0). */
|
|
96
96
|
export declare function gatewayInfoCipherId(gwPayload: Buffer): number;
|
|
97
|
+
/**
|
|
98
|
+
* Whether a `CMD_GATEWAYINFO` (1100) reply is a level-2 refusal: int32 LE `GATEWAY_LEVEL2_REFUSED` (`99 ff
|
|
99
|
+
* ff ff`) in place of a cipher. {@link gatewayInfoCipherId} reads those bytes as `cipher_id` 65433. Any other
|
|
100
|
+
* opening is not a refusal.
|
|
101
|
+
*/
|
|
102
|
+
export declare function gatewayInfoRefused(gwPayload: Buffer): boolean;
|
|
97
103
|
/** Options for {@link eciesUnwrap}. */
|
|
98
104
|
export interface EciesUnwrapOptions {
|
|
99
105
|
/**
|
|
@@ -697,6 +697,9 @@ export declare class P2PCommandRouter {
|
|
|
697
697
|
* sources on the replaced session are discarded before closing it (see {@link tearDownStation}).
|
|
698
698
|
* Replaced at most once per resolution, so a station whose replacement is silent too is returned rather
|
|
699
699
|
* than closed again.
|
|
700
|
+
*
|
|
701
|
+
* `clearFallback` hands over a session whose station {@link P2PSession.refusedLevel2} instead of throwing, for
|
|
702
|
+
* a standalone device of a model in {@link CLEAR_FF09_MODELS}.
|
|
700
703
|
*/
|
|
701
704
|
private resolveSession;
|
|
702
705
|
/**
|
|
@@ -148,7 +148,7 @@ export type LiveTrace =
|
|
|
148
148
|
*/
|
|
149
149
|
| {
|
|
150
150
|
phase: "level2-unavailable";
|
|
151
|
-
reason: "no-cipher-key" | "derivation-failed" | "not-negotiating" | "session-closed" | "grace-elapsed";
|
|
151
|
+
reason: "no-cipher-key" | "derivation-failed" | "not-negotiating" | "session-closed" | "grace-elapsed" | "gateway-refused";
|
|
152
152
|
cipherId?: number;
|
|
153
153
|
waitedMs?: number;
|
|
154
154
|
}
|
|
@@ -224,6 +224,8 @@ export declare class P2PSession extends EventEmitter {
|
|
|
224
224
|
private readonly liveStartedChannels;
|
|
225
225
|
/** The `cipher_id` this connection's `CMD_GATEWAYINFO` reply named, once its negotiation has read it. */
|
|
226
226
|
private gatewayCipherId?;
|
|
227
|
+
/** Whether this connection's latest `CMD_GATEWAYINFO` reply was a refusal — see {@link gatewayInfoRefused}. */
|
|
228
|
+
private gatewayRefused;
|
|
227
229
|
/** The `n` of the last `[0x01, n]` header this connection sent in the clear — see {@link nextClearCommandBytes}. */
|
|
228
230
|
private clearCommandCount;
|
|
229
231
|
private readonly unackedLiveStarts;
|
|
@@ -326,7 +328,8 @@ export declare class P2PSession extends EventEmitter {
|
|
|
326
328
|
* Every outcome settles the wait in {@link awaitLevel2Key}, so a later command is told at once rather than
|
|
327
329
|
* left to time out against a key that is not coming. Settling also re-opens the negotiation, so a later
|
|
328
330
|
* GATEWAYINFO reply in the same connection generation runs it again; a lookup that completes after its
|
|
329
|
-
* generation ended settles nothing.
|
|
331
|
+
* generation ended settles nothing. A {@link gatewayInfoRefused} reply names no cipher, so it settles at once
|
|
332
|
+
* with no cloud lookup, and a later reply naming a cipher withdraws the refusal.
|
|
330
333
|
*/
|
|
331
334
|
private negotiateLevel2Key;
|
|
332
335
|
/**
|
|
@@ -526,6 +529,11 @@ export declare class P2PSession extends EventEmitter {
|
|
|
526
529
|
sendIntStringCommand(commandType: number, value: number, valueSub: number, strValue: string, channel?: number): void;
|
|
527
530
|
/** Send a level-1 {@link buildStringPairCommandPayload} command on `channel`. */
|
|
528
531
|
sendStringPairCommand(commandType: number, strValue: string, strValueSub: string, channel: number): void;
|
|
532
|
+
/**
|
|
533
|
+
* Whether this connection's station answered `CMD_GATEWAYINFO` with a refusal ({@link gatewayInfoRefused}) and
|
|
534
|
+
* no key that frames a set-payload is held.
|
|
535
|
+
*/
|
|
536
|
+
get refusedLevel2(): boolean;
|
|
529
537
|
/**
|
|
530
538
|
* Send a **level-2 (AES-256-GCM, signCode 8) control payload** to a HomeBase-attached device. The
|
|
531
539
|
* target camera is selected by `channel` (= device_channel) + the `mChannel` envelope — the same
|
|
@@ -536,8 +544,12 @@ export declare class P2PSession extends EventEmitter {
|
|
|
536
544
|
* On a session holding only the AES-128-ECB level-2 key of an RSA cipher, the frame is the level-1
|
|
537
545
|
* layout ({@link sendRawLevel1Bytes}) sealed under that key at encryption type 2: the encryption-type
|
|
538
546
|
* byte names the key the body is sealed with (1 = level-1 key, 2 = the negotiated key).
|
|
547
|
+
*
|
|
548
|
+
* With `clearOnRefusal` on a session that {@link refusedLevel2}, the frame goes in the clear in the vendor
|
|
549
|
+
* app's form for such a device: header bytes `[01 00]`, signCode 0, and a body of `{cmd, payload}` alone.
|
|
550
|
+
* Without it, a refused session answers `false` and sends nothing.
|
|
539
551
|
*/
|
|
540
|
-
sendControlLevel2(cmd: number, channel: number, accountId: string, payload: Record<string, unknown>, mValue3?: number): boolean;
|
|
552
|
+
sendControlLevel2(cmd: number, channel: number, accountId: string, payload: Record<string, unknown>, mValue3?: number, clearOnRefusal?: boolean): boolean;
|
|
541
553
|
/**
|
|
542
554
|
* Send a **level-2 (GCM, signCode 8) frame whose plaintext is exactly `json`** — no
|
|
543
555
|
* `{account_id,cmd,mChannel,…}` envelope. The target device is selected by the frame-header
|
|
@@ -73,7 +73,7 @@ export declare class VideoFrameDecoder {
|
|
|
73
73
|
export interface AssembledAccessUnit {
|
|
74
74
|
/** Unsigned 32-bit header timestamp from the first frame of this access unit. */
|
|
75
75
|
sourceTimestamp: number;
|
|
76
|
-
/** True when
|
|
76
|
+
/** True when header bit 0 is set, or (bit 0 clear) the payload contains an IDR — a point to begin decoding at. */
|
|
77
77
|
keyframe: boolean;
|
|
78
78
|
/** Frame width the unit's header declared. */
|
|
79
79
|
width: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mega-yfue/eufy-sdk",
|
|
3
|
-
"version": "0.6.0-beta.
|
|
3
|
+
"version": "0.6.0-beta.39",
|
|
4
4
|
"description": "One typed TypeScript client for the Anker eufy v6 cloud — capability-driven devices, realtime events over P2P/MQTT/push, and live media",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "mega-yfue",
|