steamutils 1.3.64 → 1.3.65
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/SteamClient.js +9 -9
- package/index.js +96 -0
- package/package.json +1 -1
package/SteamClient.js
CHANGED
@@ -2303,15 +2303,15 @@ function SteamClient({ username, password, cookie, clientJsToken, isAutoRequestF
|
|
2303
2303
|
];
|
2304
2304
|
},
|
2305
2305
|
uploadRichPresence(appid, richPresence) {
|
2306
|
-
|
2307
|
-
|
2308
|
-
|
2309
|
-
|
2310
|
-
|
2311
|
-
|
2312
|
-
|
2313
|
-
|
2314
|
-
steamClient.uploadRichPresence(appid,
|
2306
|
+
const _richPresence = Array.isArray(richPresence)
|
2307
|
+
? richPresence.reduce(function (previousValue, currentValue, currentIndex, array) {
|
2308
|
+
if (currentValue.key) {
|
2309
|
+
previousValue[currentValue.key] = currentValue.value?.toString() || "";
|
2310
|
+
}
|
2311
|
+
return previousValue;
|
2312
|
+
}, {})
|
2313
|
+
: richPresence;
|
2314
|
+
steamClient.uploadRichPresence(appid, _richPresence);
|
2315
2315
|
},
|
2316
2316
|
getUserOwnedApps,
|
2317
2317
|
getPlayingAppIds,
|
package/index.js
CHANGED
@@ -6410,6 +6410,13 @@ export default class SteamUser {
|
|
6410
6410
|
}
|
6411
6411
|
|
6412
6412
|
async acceptConfirmationForObject(accessToken, identitySecret, objectID) {
|
6413
|
+
if (!accessToken || typeof accessToken !== "string") {
|
6414
|
+
return { error: "Invalid accessToken: " + accessToken };
|
6415
|
+
}
|
6416
|
+
if (!identitySecret || typeof identitySecret !== "string") {
|
6417
|
+
return { error: "Invalid identitySecret: " + identitySecret };
|
6418
|
+
}
|
6419
|
+
|
6413
6420
|
let error = null;
|
6414
6421
|
for (const cookie of this._cookies) {
|
6415
6422
|
try {
|
@@ -6433,7 +6440,60 @@ export default class SteamUser {
|
|
6433
6440
|
return { error };
|
6434
6441
|
}
|
6435
6442
|
|
6443
|
+
async denyConfirmationForObject(accessToken, identitySecret, objectID) {
|
6444
|
+
if (!accessToken || typeof accessToken !== "string") {
|
6445
|
+
return { error: "Invalid accessToken: " + accessToken };
|
6446
|
+
}
|
6447
|
+
if (!identitySecret || typeof identitySecret !== "string") {
|
6448
|
+
return { error: "Invalid identitySecret: " + identitySecret };
|
6449
|
+
}
|
6450
|
+
|
6451
|
+
let error = null;
|
6452
|
+
for (const cookie of this._cookies) {
|
6453
|
+
try {
|
6454
|
+
const community = new SteamCommunity();
|
6455
|
+
community.setCookies(cookie.toString().split(";"));
|
6456
|
+
community.oAuthToken = accessToken;
|
6457
|
+
try {
|
6458
|
+
community.setMobileAppAccessToken(accessToken);
|
6459
|
+
} catch (e) {}
|
6460
|
+
|
6461
|
+
error = await new Promise((resolve) => {
|
6462
|
+
let time = SteamTotp.time();
|
6463
|
+
let confKey = SteamTotp.getConfirmationKey(identitySecret, time, "list");
|
6464
|
+
community.getConfirmations(time, { tag: "list", key: confKey }, function (err, confs) {
|
6465
|
+
if (err) {
|
6466
|
+
resolve(err);
|
6467
|
+
return;
|
6468
|
+
}
|
6469
|
+
|
6470
|
+
const conf = confs.find((conf) => conf.creator == objectID);
|
6471
|
+
if (!conf) {
|
6472
|
+
resolve("Could not find confirmation for object " + objectID);
|
6473
|
+
return;
|
6474
|
+
}
|
6475
|
+
confKey = SteamTotp.getConfirmationKey(identitySecret, time, "accept");
|
6476
|
+
conf.respond(time, { tag: "accept", key: confKey }, false, resolve);
|
6477
|
+
});
|
6478
|
+
});
|
6479
|
+
if (!error) {
|
6480
|
+
return {
|
6481
|
+
success: true,
|
6482
|
+
};
|
6483
|
+
}
|
6484
|
+
} catch (e) {}
|
6485
|
+
}
|
6486
|
+
return { error };
|
6487
|
+
}
|
6488
|
+
|
6436
6489
|
async getConfirmations(accessToken, identitySecret) {
|
6490
|
+
if (!accessToken || typeof accessToken !== "string") {
|
6491
|
+
return { error: "Invalid accessToken: " + accessToken };
|
6492
|
+
}
|
6493
|
+
if (!identitySecret || typeof identitySecret !== "string") {
|
6494
|
+
return { error: "Invalid identitySecret: " + identitySecret };
|
6495
|
+
}
|
6496
|
+
|
6437
6497
|
let error = null;
|
6438
6498
|
for (const cookie of this._cookies) {
|
6439
6499
|
try {
|
@@ -6465,7 +6525,43 @@ export default class SteamUser {
|
|
6465
6525
|
return { error };
|
6466
6526
|
}
|
6467
6527
|
|
6528
|
+
async enableTwoFactor(accessToken) {
|
6529
|
+
if (!accessToken || typeof accessToken !== "string") {
|
6530
|
+
return { error: "Invalid accessToken: " + accessToken };
|
6531
|
+
}
|
6532
|
+
|
6533
|
+
let error = null;
|
6534
|
+
for (const cookie of this._cookies) {
|
6535
|
+
try {
|
6536
|
+
const community = new SteamCommunity();
|
6537
|
+
community.setCookies(cookie.toString().split(";"));
|
6538
|
+
community.oAuthToken = accessToken;
|
6539
|
+
try {
|
6540
|
+
community.setMobileAppAccessToken(accessToken);
|
6541
|
+
} catch (e) {}
|
6542
|
+
const response = await new Promise((resolve) => {
|
6543
|
+
community.enableTwoFactor((error, response) => {
|
6544
|
+
resolve({ error, response });
|
6545
|
+
});
|
6546
|
+
});
|
6547
|
+
if (!response.error) {
|
6548
|
+
return { ...response, success: true };
|
6549
|
+
} else {
|
6550
|
+
error = response.error;
|
6551
|
+
}
|
6552
|
+
} catch (e) {}
|
6553
|
+
}
|
6554
|
+
return { error };
|
6555
|
+
}
|
6556
|
+
|
6468
6557
|
async finalizeTwoFactor(accessToken, identitySecret, finalizeTwoFactorCode) {
|
6558
|
+
if (!accessToken || typeof accessToken !== "string") {
|
6559
|
+
return { error: "Invalid accessToken: " + accessToken };
|
6560
|
+
}
|
6561
|
+
if (!identitySecret || typeof identitySecret !== "string") {
|
6562
|
+
return { error: "Invalid identitySecret: " + identitySecret };
|
6563
|
+
}
|
6564
|
+
|
6469
6565
|
let error = null;
|
6470
6566
|
for (const cookie of this._cookies) {
|
6471
6567
|
try {
|