steamutils 1.3.91 → 1.3.93

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 +114 -9
  2. package/package.json +2 -1
package/index.js CHANGED
@@ -6,6 +6,7 @@ import { hex2b64, Key as RSA } from "node-bignumber";
6
6
  import SteamID from "steamid";
7
7
  import URL, { fileURLToPath } from "url";
8
8
  import Url from "url-parse";
9
+ import qs from "qs";
9
10
  import xml2js from "xml2js";
10
11
  import { console_log, getCleanObject, JSON_parse, JSON_stringify, removeSpaceKeys, sleep } from "./utils.js";
11
12
  import { Header, request } from "./axios.js";
@@ -5914,15 +5915,35 @@ export default class SteamUser {
5914
5915
  }
5915
5916
 
5916
5917
  async deauthorizeAllDevices() {
5917
- const result = await this._httpRequestAjax({
5918
- url: `https://store.steampowered.com/twofactor/manage_action`,
5919
- method: "POST",
5920
- data: "action=deauthorize&sessionid=" + this._sessionId,
5921
- headers: {
5922
- "content-type": "application/x-www-form-urlencoded",
5923
- Referer: "https://store.steampowered.com/twofactor/manage",
5924
- },
5925
- });
5918
+ const cookieManager = this._cookies[0];
5919
+ let result = null;
5920
+ let error = null;
5921
+ try {
5922
+ result = await axios.request({
5923
+ method: "post",
5924
+ maxBodyLength: Infinity,
5925
+ url: "https://store.steampowered.com/twofactor/manage_action",
5926
+ headers: {
5927
+ "Content-Type": "application/x-www-form-urlencoded",
5928
+ Cookie: cookieManager.toString(),
5929
+ Origin: "https://store.steampowered.com",
5930
+ Referer: "https://store.steampowered.com/twofactor/manage",
5931
+ },
5932
+ data: qs.stringify({
5933
+ action: "deauthorize",
5934
+ sessionid: cookieManager.getCookie("sessionid"),
5935
+ }),
5936
+ });
5937
+ } catch (e) {
5938
+ error = e;
5939
+ }
5940
+
5941
+ if (error?.errno === -4077) {
5942
+ return "ECONNRESET";
5943
+ }
5944
+
5945
+ console.log(result);
5946
+ console.log(error);
5926
5947
 
5927
5948
  if (!result) {
5928
5949
  return;
@@ -7127,6 +7148,90 @@ export default class SteamUser {
7127
7148
 
7128
7149
  const successExample = { success: 1, detail: 0, formattednewwalletbalance: "129.578,57₫" };
7129
7150
  }
7151
+
7152
+ async enumerateTokens(accessToken) {
7153
+ const params = {
7154
+ access_token: accessToken,
7155
+ origin: "https://store.steampowered.com",
7156
+ };
7157
+
7158
+ const result = await this._httpRequest({
7159
+ url: `https://api.steampowered.com/IAuthenticationService/EnumerateTokens/v1?${Object.keys(params)
7160
+ .map((k) => `${k}=${encodeURIComponent(params[k])}`)
7161
+ .join("&")}`,
7162
+ // responseType: "arraybuffer",
7163
+ method: "POST",
7164
+ });
7165
+ if (result instanceof ResponseError) {
7166
+ return result;
7167
+ }
7168
+
7169
+ return result?.data;
7170
+
7171
+ const data = {
7172
+ response: {
7173
+ refresh_tokens: [
7174
+ {
7175
+ token_id: "6524101908770518402",
7176
+ token_description: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
7177
+ time_updated: 1713256963,
7178
+ platform_type: 2,
7179
+ logged_in: true,
7180
+ os_platform: 2,
7181
+ auth_type: 4,
7182
+ first_seen: {
7183
+ time: 1713256963,
7184
+ },
7185
+ last_seen: {
7186
+ time: 1715595247,
7187
+ ip: {
7188
+ v4: 250140346,
7189
+ },
7190
+ country: "VN",
7191
+ state: "Ha Noi",
7192
+ city: "Hanoi",
7193
+ },
7194
+ os_type: 0,
7195
+ authentication_type: 2,
7196
+ },
7197
+ ],
7198
+ requesting_token: "6524101908770518402",
7199
+ },
7200
+ };
7201
+ }
7202
+ async revokeAccessToken(accessToken, tokenId) {
7203
+ const Protos = helpers([
7204
+ {
7205
+ name: "csgo",
7206
+ protos: loadProfos(`${__dirname}/protos/steam`),
7207
+ },
7208
+ ]);
7209
+
7210
+ const params = {
7211
+ access_token: accessToken,
7212
+ origin: "https://store.steampowered.com",
7213
+ spoof_steamid: "",
7214
+ token_id: tokenId,
7215
+ steamid: this._steamIdUser,
7216
+ revoke_action: Protos.csgo.EAuthTokenRevokeAction.k_EAuthTokenRevokePermanent,
7217
+ };
7218
+
7219
+ const result = await this._httpRequest({
7220
+ url: `https://api.steampowered.com/IAuthenticationService/RevokeRefreshToken/v1?${Object.keys(params)
7221
+ .map((k) => `${k}=${encodeURIComponent(params[k])}`)
7222
+ .join("&")}`,
7223
+ // responseType: "arraybuffer",
7224
+ method: "POST",
7225
+ });
7226
+ if (result instanceof ResponseError) {
7227
+ return result;
7228
+ }
7229
+
7230
+ return _.isEqual(result?.data, { response: {} });
7231
+ const successExample = {
7232
+ response: {},
7233
+ };
7234
+ }
7130
7235
  }
7131
7236
 
7132
7237
  SteamUser.MAX_RETRY = 10;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.3.91",
3
+ "version": "1.3.93",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "alpha-common-utils": "^1.0.6",
@@ -15,6 +15,7 @@
15
15
  "moment": "^2.30.1",
16
16
  "moment-timezone": "^0.5.45",
17
17
  "node-bignumber": "^1.2.2",
18
+ "qs": "^6.12.1",
18
19
  "steam-session": "^1.7.2",
19
20
  "steam-totp": "^2.1.2",
20
21
  "steam-user": "^5.0.8",