@mega-yfue/eufy-sdk 0.4.0-beta.10 → 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.
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The `algo_ecdh` passport steps the eufy and Solix clients share byte for byte. Hosts, header sets, key
3
+ * caching, 2FA delivery and the `gtoken` id differ per app line and stay in each client.
4
+ */
5
+ import { type SessionEntry } from "../../core/index.js";
6
+ /** The credential fields every `/passport/login` body starts with; each client adds its own challenge fields. */
7
+ export declare function loginCredentials(email: string, password: string, country: string): Record<string, unknown>;
8
+ /**
9
+ * Read a decrypted `/passport/login` reply; `undefined` when it carries no id or no token. `twoFactorPending`
10
+ * is true while `fa_info.info` is non-empty and false once 2FA is satisfied.
11
+ */
12
+ export declare function readLoginReply(data: Record<string, unknown>): {
13
+ userId: string;
14
+ accountUserId: string | undefined;
15
+ authToken: string;
16
+ geoKey: string | undefined;
17
+ tokenExpiresAt: number;
18
+ twoFactorPending: boolean;
19
+ } | undefined;
20
+ /** The headers that mark `encBody` as `algo_ecdh`-encrypted under `entry` and sign it. */
21
+ export declare function signedHeaders(entry: SessionEntry, encBody: string): Record<string, string>;
@@ -3,12 +3,11 @@
3
3
  * eufy client uses.
4
4
  *
5
5
  * Why this is separate from the eufy device client: Solix shares Anker's `algo_ecdh` passport (so
6
- * {@link prepareKeyExchange} / {@link encryptLoginPassword} / {@link signRequest} are reused verbatim
7
- * for the login handshake) but exposes a different device backend — its own `app-name`, host, and
8
- * bootstrap key (`SOLIX_APP_NAME`, `SOLIX_DEFAULT_API_HOST`, {@link SOLIX_LOCAL_KEY_HEX}) —
9
- * and its authenticated resource reads are PLAIN JSON, carrying only the auth token and a
10
- * `gtoken = md5(user_id)`, with no per-request encryption or signature. This client therefore does
11
- * the encrypted passport handshake to obtain a token, then makes plain authenticated reads.
6
+ * {@link prepareKeyExchange} and the steps in `./passport.ts` are shared with it) but exposes a different device
7
+ * backend — its own `app-name`, host, and bootstrap key (`SOLIX_APP_NAME`, `SOLIX_DEFAULT_API_HOST`,
8
+ * {@link SOLIX_LOCAL_KEY_HEX}) — and its authenticated resource reads are PLAIN JSON, carrying only the auth token
9
+ * and a `gtoken = md5(user_id)`, with no per-request encryption or signature. This client therefore does the
10
+ * encrypted passport handshake to obtain a token, then makes plain authenticated reads.
12
11
  *
13
12
  * This is the wire client (transport layer): it returns the vendor's typed JSON as received. Building
14
13
  * those records into capability-driven `SolixDevice` models is the model layer's job — see
@@ -510,11 +510,6 @@ export declare class P2PSession extends EventEmitter {
510
510
  * camera is selected by `mChannel` (= the device's `device_channel`) AND the frame-header channel.
511
511
  */
512
512
  private sendMediaPayloadLevel2;
513
- /**
514
- * Encrypt a level-2 command body (signCode 8): `tag(16) ‖ nonce(12) ‖ [seq,03,02,01](4) ‖
515
- * ciphertext`, AES-256-GCM under the negotiated session key, AAD "eufy security". Inverse of
516
- * `decryptLevel2`. The 4-byte sub-header is cleartext (skipped on decrypt); `seq` is a counter.
517
- */
518
513
  /**
519
514
  * Decode a `CMD_VIDEO_FRAME` (1300) payload into clean Annex-B H.264 (the 22-byte frame header
520
515
  * stripped). Reversed from the V6 app + live H.264 captures: the 22-byte header is
@@ -538,6 +533,11 @@ export declare class P2PSession extends EventEmitter {
538
533
  * key. Lazily generates a keypair; `rsaPrivateKey` decrypts the media key the station returns.
539
534
  */
540
535
  private rsaModulus;
536
+ /**
537
+ * Encrypt a level-2 command body (signCode 8): `tag(16) ‖ nonce(12) ‖ seq(4) ‖ ciphertext`,
538
+ * AES-256-GCM under the negotiated session key, AAD "eufy security". Inverse of `decryptLevel2`.
539
+ * The 4-byte sub-header is cleartext (skipped on decrypt); `seq` counts up from {@link LEVEL2_SEQ_BASE}.
540
+ */
541
541
  private encryptLevel2;
542
542
  /** Send a no-arg command frame (e.g. CMD_GATEWAYINFO) on a channel (default: the station channel). */
543
543
  private sendCommand;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mega-yfue/eufy-sdk",
3
- "version": "0.4.0-beta.10",
3
+ "version": "0.4.0-beta.12",
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",