@mega-yfue/eufy-sdk 0.1.2 → 0.2.0-beta.1

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.
@@ -186,8 +186,16 @@ export declare class MegaHttpClient {
186
186
  * restored-session short-circuit must NOT treat it as a usable session. Cleared on Ok/reset. */
187
187
  private pending2fa;
188
188
  private tokenExpiresAt;
189
- /** Stable per-install device id — the auth token is bound to it. */
190
- private openudid;
189
+ /**
190
+ * Stable per-install device id: `openudid` as configured, as restored from the session store, or as
191
+ * derived from the ACCOUNT when neither supplied one — two clients that configure none therefore
192
+ * share it, and are one install as far as everything keyed on this is concerned.
193
+ *
194
+ * Two things are keyed on it, and both fail the same way when it is shared: the auth token is bound
195
+ * to it, so each login displaces the other's session, and the secure-MQTT client id is built from it,
196
+ * so each connection evicts the other's channel.
197
+ */
198
+ readonly openudid: string;
191
199
  /** The device model reported to the cloud (explicit `phoneModel`, else a stable random one). */
192
200
  private readonly phoneModel;
193
201
  /** The `user-agent` for the media-download path (explicit `mediaUserAgent`, else derived from the model). */
@@ -11,6 +11,12 @@ export interface AppClientIdInput {
11
11
  }
12
12
  /** Build a client_id shaped like `android-{appName}-{uid}-{mqttUuid}-{timestamp}`. */
13
13
  export declare function buildAppShapedClientId(input: AppClientIdInput): string;
14
- /** A fresh stable-looking install UUID (16 hex chars) — generate ONCE per identity and persist it
15
- * (a new random value on every connect defeats the point of "stable"). */
16
- export declare function generateMqttUuid(): string;
14
+ /**
15
+ * The `mqttUuid` segment for a client bound to `installId`, hashed to the 16-hex shape
16
+ * {@link buildAppShapedClientId} expects. Deterministic, so a client keeps its id across restarts and
17
+ * takes its own stale session over rather than doubling up beside it; one-way, so the id it is derived
18
+ * from is not recoverable from a client_id that travels the wire in clear.
19
+ *
20
+ * Two clients are distinguished exactly as far as their `installId` is: equal ids in, equal ids out.
21
+ */
22
+ export declare function mqttUuidFrom(installId: string): string;
@@ -87,9 +87,6 @@ export interface MqttRouterDeps {
87
87
  export declare class MqttCommandRouter {
88
88
  private readonly deps;
89
89
  private readonly logger;
90
- /** Stable per-process install id for the app-shaped MQTT client_id (see {@link buildAppShapedClientId}) —
91
- * generated once, reused for every security-MQTT connect this router makes. */
92
- private mqttUuid?;
93
90
  constructor(deps: MqttRouterDeps);
94
91
  /**
95
92
  * Whether this transport stack drives `dev`'s `ff09-*` commands — a **eufy-cloud device**
@@ -14,6 +14,16 @@
14
14
  import { EventEmitter } from "node:events";
15
15
  import type { EufyDevice, RealtimeTransport } from "../../core/types.js";
16
16
  import { type Logger } from "../../core/logger.js";
17
+ /**
18
+ * Whether a connect failed because the broker REFUSED the client — a CONNACK return code the client
19
+ * cannot retry its way out of, as `mqtt.js` words it (`Connection refused: not authorized`). A socket
20
+ * that dies without an answer is not this: it is the same request, unanswered, and retrying it is the
21
+ * only way to learn which of the two happened.
22
+ *
23
+ * A refusal that arrives as a dropped connection instead of a CONNACK reads here as the transport
24
+ * failure it is indistinguishable from.
25
+ */
26
+ export declare function isNotAuthorized(err: unknown): boolean;
17
27
  /**
18
28
  * Per-user mTLS credentials as returned by get_user_mqtt_info.
19
29
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mega-yfue/eufy-sdk",
3
- "version": "0.1.2",
3
+ "version": "0.2.0-beta.1",
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",