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