steamutils 1.3.62 → 1.3.64
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/index.js +63 -30
- package/package.json +1 -1
package/index.js
CHANGED
@@ -6412,43 +6412,76 @@ export default class SteamUser {
|
|
6412
6412
|
async acceptConfirmationForObject(accessToken, identitySecret, objectID) {
|
6413
6413
|
let error = null;
|
6414
6414
|
for (const cookie of this._cookies) {
|
6415
|
-
|
6416
|
-
|
6417
|
-
|
6418
|
-
|
6419
|
-
|
6420
|
-
|
6421
|
-
|
6422
|
-
|
6423
|
-
|
6424
|
-
|
6425
|
-
|
6415
|
+
try {
|
6416
|
+
const community = new SteamCommunity();
|
6417
|
+
community.setCookies(cookie.toString().split(";"));
|
6418
|
+
community.oAuthToken = accessToken;
|
6419
|
+
try {
|
6420
|
+
community.setMobileAppAccessToken(accessToken);
|
6421
|
+
} catch (e) {}
|
6422
|
+
|
6423
|
+
error = await new Promise((resolve) => {
|
6424
|
+
community.acceptConfirmationForObject(identitySecret, objectID, resolve);
|
6425
|
+
});
|
6426
|
+
if (!error) {
|
6427
|
+
return {
|
6428
|
+
success: true,
|
6429
|
+
};
|
6430
|
+
}
|
6431
|
+
} catch (e) {}
|
6426
6432
|
}
|
6427
6433
|
return { error };
|
6428
6434
|
}
|
6435
|
+
|
6429
6436
|
async getConfirmations(accessToken, identitySecret) {
|
6430
6437
|
let error = null;
|
6431
6438
|
for (const cookie of this._cookies) {
|
6432
|
-
|
6433
|
-
|
6434
|
-
|
6435
|
-
|
6436
|
-
|
6437
|
-
|
6438
|
-
|
6439
|
-
|
6440
|
-
|
6441
|
-
|
6442
|
-
|
6443
|
-
|
6439
|
+
try {
|
6440
|
+
const community = new SteamCommunity();
|
6441
|
+
community.setCookies(cookie.toString().split(";"));
|
6442
|
+
community.oAuthToken = accessToken;
|
6443
|
+
try {
|
6444
|
+
community.setMobileAppAccessToken(accessToken);
|
6445
|
+
} catch (e) {}
|
6446
|
+
const time = SteamTotp.time();
|
6447
|
+
const key = SteamTotp.getConfirmationKey(identitySecret, time, "conf");
|
6448
|
+
// err.message === "Not Logged In";
|
6449
|
+
const result = await new Promise((resolve) => {
|
6450
|
+
community.getConfirmations(time, key, function (error, confirmations) {
|
6451
|
+
if (error) {
|
6452
|
+
resolve({ error });
|
6453
|
+
}
|
6454
|
+
resolve({ confirmations });
|
6455
|
+
});
|
6444
6456
|
});
|
6445
|
-
|
6446
|
-
|
6447
|
-
|
6448
|
-
|
6449
|
-
|
6450
|
-
|
6451
|
-
}
|
6457
|
+
if (result?.confirmations) {
|
6458
|
+
return { confirmations: result?.confirmations };
|
6459
|
+
}
|
6460
|
+
if (result?.error) {
|
6461
|
+
error = result.error;
|
6462
|
+
}
|
6463
|
+
} catch (e) {}
|
6464
|
+
}
|
6465
|
+
return { error };
|
6466
|
+
}
|
6467
|
+
|
6468
|
+
async finalizeTwoFactor(accessToken, identitySecret, finalizeTwoFactorCode) {
|
6469
|
+
let error = null;
|
6470
|
+
for (const cookie of this._cookies) {
|
6471
|
+
try {
|
6472
|
+
const community = new SteamCommunity();
|
6473
|
+
community.setCookies(cookie.toString().split(";"));
|
6474
|
+
community.oAuthToken = accessToken;
|
6475
|
+
try {
|
6476
|
+
community.setMobileAppAccessToken(accessToken);
|
6477
|
+
} catch (e) {}
|
6478
|
+
error = await new Promise((resolve) => {
|
6479
|
+
community.finalizeTwoFactor(identitySecret, finalizeTwoFactorCode, resolve);
|
6480
|
+
});
|
6481
|
+
if (!error) {
|
6482
|
+
return { success: true };
|
6483
|
+
}
|
6484
|
+
} catch (e) {}
|
6452
6485
|
}
|
6453
6486
|
return { error };
|
6454
6487
|
}
|