@mega-yfue/eufy-sdk 0.2.0-beta.15 → 0.2.0-beta.16

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.
@@ -179,6 +179,13 @@ export declare class MegaHttpClient {
179
179
  private sessionKey?;
180
180
  /** Per-host ECDH session keys for non-mega gateways (e.g. eufylife) keyed by host. */
181
181
  private readonly sessionKeys;
182
+ /**
183
+ * The held credential. `userId` is the login reply's `ap_cloud_user_id` where it has one — the Anker
184
+ * Passport cloud's id — while `accountUserId` is the eufy account's own `user_id`.
185
+ *
186
+ * The `gtoken` header is hashed from `accountUserId`: that is the id the gateway recomputes the header
187
+ * from, rejecting a disagreement with `"gtoken not equal userid error"`.
188
+ */
182
189
  private auth_?;
183
190
  /** captcha_id of an in-flight challenge, held between login() and solveCaptcha(). */
184
191
  private pendingCaptchaId?;
@@ -246,7 +253,14 @@ export declare class MegaHttpClient {
246
253
  */
247
254
  private baseHeaders;
248
255
  /**
249
- * The account-credential headers every authed call carries — `x-auth-token` + `gtoken` (`md5(userId)`).
256
+ * The id `gtoken` is hashed from — the account's own `user_id`, which is what the gateway recomputes the
257
+ * header from. One place so the two header paths cannot drift on which of the session's ids that is.
258
+ *
259
+ * Call only where `auth_` is already established; every header path guards it.
260
+ */
261
+ private gtokenUserId;
262
+ /**
263
+ * The account-credential headers every authed call carries — `x-auth-token` + `gtoken`.
250
264
  * One place so the signed path, the key-exchange and the bearer path can't drift on what "authed" means.
251
265
  */
252
266
  private authTokenHeaders;
@@ -121,6 +121,11 @@ export declare class SolixClient {
121
121
  * Turn a decrypted `/passport/login` payload into an `ok`/`2fa` result, establishing the session on
122
122
  * `ok`. The passport marks a pending 2FA with a non-empty `fa_info.info`, and empties it once the code
123
123
  * has been satisfied.
124
+ *
125
+ * `gtoken` is hashed from `ap_cloud_user_id` where the reply carries one, `user_id` otherwise. Whether
126
+ * this gateway recomputes the header from `user_id` specifically — as the mega gateway does, rejecting a
127
+ * disagreement with `"gtoken not equal userid error"` — is unverified here: no Solix response has been
128
+ * observed refusing the header, which is consistent with the two ids agreeing on the accounts seen.
124
129
  */
125
130
  private classifyLogin;
126
131
  /** Decrypt a login envelope's `data` (base64 `IV(16)||AES-128-CBC`, keyed by the share key). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mega-yfue/eufy-sdk",
3
- "version": "0.2.0-beta.15",
3
+ "version": "0.2.0-beta.16",
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",