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.
Files changed (2) hide show
  1. package/index.js +53 -30
  2. 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
- 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
+ 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
- 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 });
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
- if (result?.confirmations) {
6447
- return { confirmations: result?.confirmations };
6448
- }
6449
- if (result?.error) {
6450
- error = result.error;
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.3.62",
3
+ "version": "1.3.63",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "alpha-common-utils": "^1.0.6",