@mega-yfue/eufy-sdk 0.5.0-beta.59 → 0.5.0-beta.60
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/core/store.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export interface PersistedSession {
|
|
|
16
16
|
authToken: string;
|
|
17
17
|
geoKey?: string;
|
|
18
18
|
region: RegionShard;
|
|
19
|
+
/** The `countryCode` the session was logged in with; a different configured one logs in again. */
|
|
20
|
+
countryCode?: string;
|
|
19
21
|
/** The host `estimate_domain` answered; it names shards the region classification cannot (`ie`). */
|
|
20
22
|
estimatedDomain?: string;
|
|
21
23
|
openudid: string;
|
package/dist/index.js
CHANGED
|
@@ -1654,7 +1654,8 @@ var MegaHttpClient = class {
|
|
|
1654
1654
|
}
|
|
1655
1655
|
/**
|
|
1656
1656
|
* Install the session the store holds, if it holds a usable one: the token + its bound ECDH key, skipping
|
|
1657
|
-
* estimate/key-exchange/login/2FA entirely. Answers the token adopted, or `undefined`.
|
|
1657
|
+
* estimate/key-exchange/login/2FA entirely. Answers the token adopted, or `undefined`. A session logged in
|
|
1658
|
+
* with a country other than the configured one is not usable: its shard is the other country's.
|
|
1658
1659
|
*
|
|
1659
1660
|
* Read at construction, and again when a rejection is being recovered from — a store SHARED with another
|
|
1660
1661
|
* client may already hold the session that client obtained, which is cheaper to adopt than to compete with.
|
|
@@ -1668,6 +1669,10 @@ var MegaHttpClient = class {
|
|
|
1668
1669
|
const saved = this.store.load();
|
|
1669
1670
|
if (!isSessionValid(saved) || !saved)
|
|
1670
1671
|
return void 0;
|
|
1672
|
+
if (saved.countryCode !== void 0 && saved.countryCode.toUpperCase() !== this.cfg.countryCode.toUpperCase()) {
|
|
1673
|
+
this.logger.info(`[mega] stored session was logged in with country ${saved.countryCode}, configured ${this.cfg.countryCode} \u2014 logging in again`);
|
|
1674
|
+
return void 0;
|
|
1675
|
+
}
|
|
1671
1676
|
this.region = saved.region;
|
|
1672
1677
|
this.estimatedDomain = saved.estimatedDomain ?? "";
|
|
1673
1678
|
this.auth_ = {
|
|
@@ -2486,6 +2491,7 @@ ${this.auth_?.authToken ?? ""}`;
|
|
|
2486
2491
|
authToken: this.auth_.authToken,
|
|
2487
2492
|
geoKey: this.auth_.geoKey,
|
|
2488
2493
|
region: this.region,
|
|
2494
|
+
countryCode: this.cfg.countryCode,
|
|
2489
2495
|
estimatedDomain: this.estimatedDomain,
|
|
2490
2496
|
openudid: this.openudid,
|
|
2491
2497
|
phoneModel: this.phoneModel,
|