nodejs-insta-private-api-mqt 1.3.89 → 1.3.90

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.
@@ -731,6 +731,31 @@ class AccountRepository extends Repository {
731
731
  headers,
732
732
  });
733
733
 
734
+ // NEW: salvăm cheia de criptare a parolei direct din headers de la mobileconfig
735
+ try {
736
+ const mcHeaders = response.headers || {};
737
+ const mcLower = {};
738
+ for (const k of Object.keys(mcHeaders)) {
739
+ mcLower[k.toLowerCase()] = mcHeaders[k];
740
+ }
741
+
742
+ const mcKeyIdStr =
743
+ mcLower['ig-set-password-encryption-key-id'];
744
+ const mcPubKey =
745
+ mcLower['ig-set-password-encryption-pub-key'];
746
+
747
+ if (mcKeyIdStr) {
748
+ const parsedKeyId = parseInt(mcKeyIdStr, 10);
749
+ if (!Number.isNaN(parsedKeyId)) {
750
+ state.passwordEncryptionKeyId = parsedKeyId;
751
+ }
752
+ }
753
+
754
+ if (mcPubKey) {
755
+ state.passwordEncryptionPubKey = mcPubKey;
756
+ }
757
+ } catch (e) {}
758
+
734
759
  try {
735
760
  const fs = require('fs');
736
761
  const path = require('path');
@@ -1059,18 +1084,23 @@ class AccountRepository extends Repository {
1059
1084
  throw new Error('Username and password are required');
1060
1085
  }
1061
1086
 
1087
+ // 0: ne asigurăm că avem csrf + cookies de bază
1088
+ await this.ensureCsrfToken();
1089
+
1090
+ // 1: încercăm să luăm cheia de criptare a parolei din /launcher/mobileconfig/
1091
+ try {
1092
+ await this._launcherMobileConfig(true);
1093
+ } catch (e) {}
1094
+
1095
+ // Fallback: dacă mobileconfig nu a setat cheia, folosim mecanismul vechi de LOGIN_EXPERIMENTS
1062
1096
  if (!this.client.state.passwordEncryptionPubKey) {
1063
1097
  await this.syncLoginExperiments();
1064
1098
  }
1065
1099
 
1100
+ // Acum parola este criptată CU cheia venită din mobileconfig (dacă a existat)
1066
1101
  const { encrypted, time } = this.encryptPassword(password);
1067
1102
 
1068
- await this.ensureCsrfToken();
1069
-
1070
- // Step 1–5: mobileconfig, keystore attestation, TOS preload, process client data, phone prefill
1071
- try {
1072
- await this._launcherMobileConfig(true);
1073
- } catch (e) {}
1103
+ // Step 2–5: keystore attestation, TOS preload, process client data, phone prefill
1074
1104
  try {
1075
1105
  await this._createAndroidKeystoreAttestation();
1076
1106
  } catch (e) {}
@@ -2291,10 +2321,12 @@ class AccountRepository extends Repository {
2291
2321
  phone_id: this.client.state.phoneId,
2292
2322
  device_token: '',
2293
2323
  guid: this.client.state.uuid,
2294
- users: preferences,
2324
+ users: preferen1gces,
2295
2325
  }),
2296
2326
  });
2297
2327
  return response.body;
2298
2328
  });
2299
2329
  }
2300
- }module.exports = AccountRepository;
2330
+ }
2331
+
2332
+ module.exports = AccountRepository;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodejs-insta-private-api-mqt",
3
- "version": "1.3.89",
3
+ "version": "1.3.90",
4
4
  "description": "Complete Instagram MQTT protocol with full-featured REALTIME and REST API — all in one project.",
5
5
 
6
6
  "main": "dist/dist/index.js",