steamutils 1.3.94 → 1.3.96
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 +60 -44
- package/package.json +1 -1
package/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { createHmac, randomBytes } from "crypto";
|
2
2
|
import sha256 from "crypto-js/sha256.js";
|
3
3
|
import _ from "lodash";
|
4
4
|
import moment from "moment";
|
@@ -26,6 +26,7 @@ import SteamCommunity from "steamcommunity";
|
|
26
26
|
import SteamTotp from "steam-totp";
|
27
27
|
import { protoDecode, protoEncode } from "./helpers/util.js";
|
28
28
|
import helpers, { loadProfos } from "./helpers/protos.js";
|
29
|
+
|
29
30
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
30
31
|
|
31
32
|
let requestTimestamp = 0;
|
@@ -5915,45 +5916,50 @@ export default class SteamUser {
|
|
5915
5916
|
}
|
5916
5917
|
|
5917
5918
|
async deauthorizeAllDevices() {
|
5918
|
-
|
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
|
-
}
|
5919
|
+
let response = false;
|
5940
5920
|
|
5941
|
-
|
5942
|
-
|
5943
|
-
|
5921
|
+
for (const cookieManager of this._cookies) {
|
5922
|
+
let result = null;
|
5923
|
+
let error = null;
|
5944
5924
|
|
5945
|
-
|
5946
|
-
|
5925
|
+
try {
|
5926
|
+
result = await axios.request({
|
5927
|
+
method: "post",
|
5928
|
+
maxBodyLength: Infinity,
|
5929
|
+
url: "https://store.steampowered.com/twofactor/manage_action",
|
5930
|
+
headers: {
|
5931
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
5932
|
+
Cookie: cookieManager.toString(),
|
5933
|
+
Origin: "https://store.steampowered.com",
|
5934
|
+
Referer: "https://store.steampowered.com/twofactor/manage",
|
5935
|
+
},
|
5936
|
+
data: qs.stringify({
|
5937
|
+
action: "deauthorize",
|
5938
|
+
sessionid: cookieManager.getCookie("sessionid"),
|
5939
|
+
}),
|
5940
|
+
});
|
5941
|
+
} catch (e) {
|
5942
|
+
error = e;
|
5943
|
+
}
|
5947
5944
|
|
5948
|
-
|
5949
|
-
|
5945
|
+
if (error?.errno === -4077) {
|
5946
|
+
response = new ResponseError({
|
5947
|
+
message: "ECONNRESET",
|
5948
|
+
steamId: this.getSteamIdUser(),
|
5949
|
+
});
|
5950
|
+
} else if (!result) {
|
5951
|
+
response = new ResponseError({
|
5952
|
+
message: "Failed",
|
5953
|
+
steamId: this.getSteamIdUser(),
|
5954
|
+
});
|
5955
|
+
} else if (result instanceof ResponseError) {
|
5956
|
+
response = result;
|
5957
|
+
} else if (result.request?.res?.responseUrl?.startsWith("https://store.steampowered.com/login/")) {
|
5958
|
+
return true;
|
5959
|
+
}
|
5950
5960
|
}
|
5951
5961
|
|
5952
|
-
|
5953
|
-
return result;
|
5954
|
-
}
|
5955
|
-
console.log(result?.data);
|
5956
|
-
const example = {};
|
5962
|
+
return response;
|
5957
5963
|
}
|
5958
5964
|
|
5959
5965
|
async getMarketUnavailable() {
|
@@ -7233,9 +7239,9 @@ export default class SteamUser {
|
|
7233
7239
|
});
|
7234
7240
|
return revokeRefreshTokenResult?.data;
|
7235
7241
|
}
|
7236
|
-
async revokeAccessToken(accessToken, tokenId, sharedSecret) {
|
7242
|
+
async revokeAccessToken(accessToken, tokenId, sharedSecret, clientId) {
|
7237
7243
|
const version = 1;
|
7238
|
-
const clientId = tokenId;
|
7244
|
+
// const clientId = tokenId;
|
7239
7245
|
let signatureData = Buffer.alloc(2 + 8 + 8);
|
7240
7246
|
signatureData.writeUInt16LE(version, 0);
|
7241
7247
|
signatureData.writeBigUInt64LE(BigInt(clientId), 2);
|
@@ -7256,12 +7262,28 @@ export default class SteamUser {
|
|
7256
7262
|
|
7257
7263
|
const signature = createHmac("sha256", secretAsBuffer(sharedSecret)).update(signatureData).digest();
|
7258
7264
|
|
7265
|
+
/*const approver = new LoginApprover(accessToken, sharedSecret, {});
|
7266
|
+
const sessionInfo = await approver._handler.sendRequest({
|
7267
|
+
apiInterface: "Authentication",
|
7268
|
+
apiMethod: "RevokeRefreshToken",
|
7269
|
+
apiVersion: 1,
|
7270
|
+
data: {
|
7271
|
+
token_id: tokenId,
|
7272
|
+
steamid: this._steamIdUser,
|
7273
|
+
revoke_action: 1,
|
7274
|
+
signature: signature.toString(),
|
7275
|
+
},
|
7276
|
+
accessToken: accessToken,
|
7277
|
+
});
|
7278
|
+
console.log("sessionInfo", sessionInfo);*/
|
7279
|
+
|
7259
7280
|
const Protos = helpers([
|
7260
7281
|
{
|
7261
7282
|
name: "csgo",
|
7262
7283
|
protos: loadProfos(`${__dirname}/protos/webui`),
|
7263
7284
|
},
|
7264
7285
|
]);
|
7286
|
+
|
7265
7287
|
const params = {
|
7266
7288
|
access_token: accessToken,
|
7267
7289
|
spoof_steamid: "",
|
@@ -7287,13 +7309,7 @@ export default class SteamUser {
|
|
7287
7309
|
url: `https://api.steampowered.com/IAuthenticationService/RevokeRefreshToken/v1?${qs.stringify(params)}`,
|
7288
7310
|
// responseType: "arraybuffer",
|
7289
7311
|
method: "POST",
|
7290
|
-
data:
|
7291
|
-
access_token: accessToken,
|
7292
|
-
token_id: tokenId,
|
7293
|
-
steamid: this._steamIdUser,
|
7294
|
-
revoke_action: 1,
|
7295
|
-
signature: signature,
|
7296
|
-
},
|
7312
|
+
data: params,
|
7297
7313
|
headers: {
|
7298
7314
|
"Content-Type": "multipart/form-data",
|
7299
7315
|
},
|