steamutils 1.3.62 → 1.3.64

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/index.js +63 -30
  2. 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
- const community = new SteamCommunity();
6416
- community.setCookies(cookie.toString().split(";"));
6417
- community.oAuthToken = accessToken;
6418
- error = await new Promise((resolve) => {
6419
- community.acceptConfirmationForObject(identitySecret, objectID, resolve);
6420
- });
6421
- if (!error) {
6422
- return {
6423
- success: true,
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
- const community = new SteamCommunity();
6433
- community.setCookies(cookie.toString().split(";"));
6434
- community.oAuthToken = accessToken;
6435
- const time = SteamTotp.time();
6436
- const key = SteamTotp.getConfirmationKey(identitySecret, time, "conf");
6437
- // err.message === "Not Logged In";
6438
- const result = await new Promise((resolve) => {
6439
- community.getConfirmations(time, key, function (error, confirmations) {
6440
- if (error) {
6441
- resolve({ error });
6442
- }
6443
- resolve({ confirmations });
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
- if (result?.confirmations) {
6447
- return { confirmations: result?.confirmations };
6448
- }
6449
- if (result?.error) {
6450
- error = result.error;
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.3.62",
3
+ "version": "1.3.64",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "alpha-common-utils": "^1.0.6",