steamcommunity 3.44.2 → 3.44.4

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.
@@ -1,159 +1,159 @@
1
- var SteamTotp = require('steam-totp');
2
- var SteamCommunity = require('../index.js');
3
-
4
- var ETwoFactorTokenType = {
5
- "None": 0, // No token-based two-factor authentication
6
- "ValveMobileApp": 1, // Tokens generated using Valve's special charset (5 digits, alphanumeric)
7
- "ThirdParty": 2 // Tokens generated using literally everyone else's standard charset (6 digits, numeric). This is disabled.
8
- };
9
-
10
- SteamCommunity.prototype.enableTwoFactor = function(callback) {
11
- var self = this;
12
-
13
- this.getWebApiOauthToken(function(err, token) {
14
- if(err) {
15
- callback(err);
16
- return;
17
- }
18
-
19
- self.httpRequestPost({
20
- "uri": "https://api.steampowered.com/ITwoFactorService/AddAuthenticator/v1/",
21
- "form": {
22
- "steamid": self.steamID.getSteamID64(),
23
- "access_token": token,
24
- "authenticator_time": Math.floor(Date.now() / 1000),
25
- "authenticator_type": ETwoFactorTokenType.ValveMobileApp,
26
- "device_identifier": SteamTotp.getDeviceID(self.steamID),
27
- "sms_phone_id": "1"
28
- },
29
- "json": true
30
- }, function(err, response, body) {
31
- if (err) {
32
- callback(err);
33
- return;
34
- }
35
-
36
- if(!body.response) {
37
- callback(new Error("Malformed response"));
38
- return;
39
- }
40
-
41
- if(body.response.status != 1) {
42
- var error = new Error("Error " + body.response.status);
43
- error.eresult = body.response.status;
44
- callback(error);
45
- return;
46
- }
47
-
48
- callback(null, body.response);
49
- }, "steamcommunity");
50
- });
51
- };
52
-
53
- SteamCommunity.prototype.finalizeTwoFactor = function(secret, activationCode, callback) {
54
- var attemptsLeft = 30;
55
- var diff = 0;
56
-
57
- var self = this;
58
- this.getWebApiOauthToken(function(err, token) {
59
- if(err) {
60
- callback(err);
61
- return;
62
- }
63
-
64
- SteamTotp.getTimeOffset(function(err, offset, latency) {
65
- if (err) {
66
- callback(err);
67
- return;
68
- }
69
-
70
- diff = offset;
71
- finalize(token);
72
- });
73
- });
74
-
75
- function finalize(token) {
76
- var code = SteamTotp.generateAuthCode(secret, diff);
77
-
78
- self.httpRequestPost({
79
- "uri": "https://api.steampowered.com/ITwoFactorService/FinalizeAddAuthenticator/v1/",
80
- "form": {
81
- "steamid": self.steamID.getSteamID64(),
82
- "access_token": token,
83
- "authenticator_code": code,
84
- "authenticator_time": Math.floor(Date.now() / 1000),
85
- "activation_code": activationCode
86
- },
87
- "json": true
88
- }, function(err, response, body) {
89
- if (err) {
90
- callback(err);
91
- return;
92
- }
93
-
94
- if(!body.response) {
95
- callback(new Error("Malformed response"));
96
- return;
97
- }
98
-
99
- body = body.response;
100
-
101
- if(body.server_time) {
102
- diff = body.server_time - Math.floor(Date.now() / 1000);
103
- }
104
-
105
- if(body.status == 89) {
106
- callback(new Error("Invalid activation code"));
107
- } else if(body.want_more) {
108
- attemptsLeft--;
109
- diff += 30;
110
-
111
- finalize(token);
112
- } else if(!body.success) {
113
- callback(new Error("Error " + body.status));
114
- } else {
115
- callback(null);
116
- }
117
- }, "steamcommunity");
118
- }
119
- };
120
-
121
- SteamCommunity.prototype.disableTwoFactor = function(revocationCode, callback) {
122
- var self = this;
123
-
124
- this.getWebApiOauthToken(function(err, token) {
125
- if(err) {
126
- callback(err);
127
- return;
128
- }
129
-
130
- self.httpRequestPost({
131
- "uri": "https://api.steampowered.com/ITwoFactorService/RemoveAuthenticator/v1/",
132
- "form": {
133
- "steamid": self.steamID.getSteamID64(),
134
- "access_token": token,
135
- "revocation_code": revocationCode,
136
- "steamguard_scheme": 1
137
- },
138
- "json": true
139
- }, function(err, response, body) {
140
- if (err) {
141
- callback(err);
142
- return;
143
- }
144
-
145
- if(!body.response) {
146
- callback(new Error("Malformed response"));
147
- return;
148
- }
149
-
150
- if(!body.response.success) {
151
- callback(new Error("Request failed"));
152
- return;
153
- }
154
-
155
- // success = true means it worked
156
- callback(null);
157
- }, "steamcommunity");
158
- });
159
- };
1
+ var SteamTotp = require('steam-totp');
2
+ var SteamCommunity = require('../index.js');
3
+
4
+ var ETwoFactorTokenType = {
5
+ "None": 0, // No token-based two-factor authentication
6
+ "ValveMobileApp": 1, // Tokens generated using Valve's special charset (5 digits, alphanumeric)
7
+ "ThirdParty": 2 // Tokens generated using literally everyone else's standard charset (6 digits, numeric). This is disabled.
8
+ };
9
+
10
+ SteamCommunity.prototype.enableTwoFactor = function(callback) {
11
+ var self = this;
12
+
13
+ this.getWebApiOauthToken(function(err, token) {
14
+ if(err) {
15
+ callback(err);
16
+ return;
17
+ }
18
+
19
+ self.httpRequestPost({
20
+ "uri": "https://api.steampowered.com/ITwoFactorService/AddAuthenticator/v1/",
21
+ "form": {
22
+ "steamid": self.steamID.getSteamID64(),
23
+ "access_token": token,
24
+ "authenticator_time": Math.floor(Date.now() / 1000),
25
+ "authenticator_type": ETwoFactorTokenType.ValveMobileApp,
26
+ "device_identifier": SteamTotp.getDeviceID(self.steamID),
27
+ "sms_phone_id": "1"
28
+ },
29
+ "json": true
30
+ }, function(err, response, body) {
31
+ if (err) {
32
+ callback(err);
33
+ return;
34
+ }
35
+
36
+ if(!body.response) {
37
+ callback(new Error("Malformed response"));
38
+ return;
39
+ }
40
+
41
+ if(body.response.status != 1) {
42
+ var error = new Error("Error " + body.response.status);
43
+ error.eresult = body.response.status;
44
+ callback(error);
45
+ return;
46
+ }
47
+
48
+ callback(null, body.response);
49
+ }, "steamcommunity");
50
+ });
51
+ };
52
+
53
+ SteamCommunity.prototype.finalizeTwoFactor = function(secret, activationCode, callback) {
54
+ var attemptsLeft = 30;
55
+ var diff = 0;
56
+
57
+ var self = this;
58
+ this.getWebApiOauthToken(function(err, token) {
59
+ if(err) {
60
+ callback(err);
61
+ return;
62
+ }
63
+
64
+ SteamTotp.getTimeOffset(function(err, offset, latency) {
65
+ if (err) {
66
+ callback(err);
67
+ return;
68
+ }
69
+
70
+ diff = offset;
71
+ finalize(token);
72
+ });
73
+ });
74
+
75
+ function finalize(token) {
76
+ var code = SteamTotp.generateAuthCode(secret, diff);
77
+
78
+ self.httpRequestPost({
79
+ "uri": "https://api.steampowered.com/ITwoFactorService/FinalizeAddAuthenticator/v1/",
80
+ "form": {
81
+ "steamid": self.steamID.getSteamID64(),
82
+ "access_token": token,
83
+ "authenticator_code": code,
84
+ "authenticator_time": Math.floor(Date.now() / 1000),
85
+ "activation_code": activationCode
86
+ },
87
+ "json": true
88
+ }, function(err, response, body) {
89
+ if (err) {
90
+ callback(err);
91
+ return;
92
+ }
93
+
94
+ if(!body.response) {
95
+ callback(new Error("Malformed response"));
96
+ return;
97
+ }
98
+
99
+ body = body.response;
100
+
101
+ if(body.server_time) {
102
+ diff = body.server_time - Math.floor(Date.now() / 1000);
103
+ }
104
+
105
+ if(body.status == 89) {
106
+ callback(new Error("Invalid activation code"));
107
+ } else if(body.want_more) {
108
+ attemptsLeft--;
109
+ diff += 30;
110
+
111
+ finalize(token);
112
+ } else if(!body.success) {
113
+ callback(new Error("Error " + body.status));
114
+ } else {
115
+ callback(null);
116
+ }
117
+ }, "steamcommunity");
118
+ }
119
+ };
120
+
121
+ SteamCommunity.prototype.disableTwoFactor = function(revocationCode, callback) {
122
+ var self = this;
123
+
124
+ this.getWebApiOauthToken(function(err, token) {
125
+ if(err) {
126
+ callback(err);
127
+ return;
128
+ }
129
+
130
+ self.httpRequestPost({
131
+ "uri": "https://api.steampowered.com/ITwoFactorService/RemoveAuthenticator/v1/",
132
+ "form": {
133
+ "steamid": self.steamID.getSteamID64(),
134
+ "access_token": token,
135
+ "revocation_code": revocationCode,
136
+ "steamguard_scheme": 1
137
+ },
138
+ "json": true
139
+ }, function(err, response, body) {
140
+ if (err) {
141
+ callback(err);
142
+ return;
143
+ }
144
+
145
+ if(!body.response) {
146
+ callback(new Error("Malformed response"));
147
+ return;
148
+ }
149
+
150
+ if(!body.response.success) {
151
+ callback(new Error("Request failed"));
152
+ return;
153
+ }
154
+
155
+ // success = true means it worked
156
+ callback(null);
157
+ }, "steamcommunity");
158
+ });
159
+ };
@@ -526,7 +526,7 @@ SteamCommunity.prototype.getUserInventoryContents = function(userID, appID, cont
526
526
  },
527
527
  "qs": {
528
528
  "l": language, // Default language
529
- "count": 5000, // Max items per 'page'
529
+ "count": 2000, // Max items per 'page'
530
530
  "start_assetid": start
531
531
  },
532
532
  "json": true
@@ -1,62 +1,62 @@
1
- // If you aren't running this script inside of the repository, replace the following line with:
2
- // const SteamCommunity = require('steamcommunity');
3
- const SteamCommunity = require('../index.js');
4
- const ReadLine = require('readline');
5
-
6
- let community = new SteamCommunity();
7
- let rl = ReadLine.createInterface({
8
- input: process.stdin,
9
- output: process.stdout
10
- });
11
-
12
- rl.question('Username: ', (accountName) => {
13
- rl.question('Password: ', (password) => {
14
- rl.question('Two-Factor Auth Code: ', (authCode) =>{
15
- rl.question('Revocation Code: R', (rCode) => {
16
- doLogin(accountName, password, authCode, '', rCode);
17
- });
18
- });
19
- });
20
- });
21
-
22
- function doLogin(accountName, password, authCode, captcha, rCode) {
23
- community.login({
24
- accountName: accountName,
25
- password: password,
26
- twoFactorCode: authCode,
27
- captcha: captcha
28
- }, (err, sessionID, cookies, steamguard) => {
29
- if (err) {
30
- if (err.message == 'SteamGuard') {
31
- console.log('This account does not have two-factor authentication enabled.');
32
- process.exit();
33
- return;
34
- }
35
-
36
- if (err.message == 'CAPTCHA') {
37
- console.log(err.captchaurl);
38
- rl.question('CAPTCHA: ', (captchaInput) => {
39
- doLogin(accountName, password, authCode, captchaInput);
40
- });
41
-
42
- return;
43
- }
44
-
45
- console.log(err);
46
- process.exit();
47
- return;
48
- }
49
-
50
- console.log('Logged on!');
51
- community.disableTwoFactor('R' + rCode, (err) => {
52
- if (err) {
53
- console.log(err);
54
- process.exit();
55
- return;
56
- }
57
-
58
- console.log('Two-factor authentication disabled!');
59
- process.exit();
60
- });
61
- });
62
- }
1
+ // If you aren't running this script inside of the repository, replace the following line with:
2
+ // const SteamCommunity = require('steamcommunity');
3
+ const SteamCommunity = require('../index.js');
4
+ const ReadLine = require('readline');
5
+
6
+ let community = new SteamCommunity();
7
+ let rl = ReadLine.createInterface({
8
+ input: process.stdin,
9
+ output: process.stdout
10
+ });
11
+
12
+ rl.question('Username: ', (accountName) => {
13
+ rl.question('Password: ', (password) => {
14
+ rl.question('Two-Factor Auth Code: ', (authCode) =>{
15
+ rl.question('Revocation Code: R', (rCode) => {
16
+ doLogin(accountName, password, authCode, '', rCode);
17
+ });
18
+ });
19
+ });
20
+ });
21
+
22
+ function doLogin(accountName, password, authCode, captcha, rCode) {
23
+ community.login({
24
+ accountName: accountName,
25
+ password: password,
26
+ twoFactorCode: authCode,
27
+ captcha: captcha
28
+ }, (err, sessionID, cookies, steamguard) => {
29
+ if (err) {
30
+ if (err.message == 'SteamGuard') {
31
+ console.log('This account does not have two-factor authentication enabled.');
32
+ process.exit();
33
+ return;
34
+ }
35
+
36
+ if (err.message == 'CAPTCHA') {
37
+ console.log(err.captchaurl);
38
+ rl.question('CAPTCHA: ', (captchaInput) => {
39
+ doLogin(accountName, password, authCode, captchaInput);
40
+ });
41
+
42
+ return;
43
+ }
44
+
45
+ console.log(err);
46
+ process.exit();
47
+ return;
48
+ }
49
+
50
+ console.log('Logged on!');
51
+ community.disableTwoFactor('R' + rCode, (err) => {
52
+ if (err) {
53
+ console.log(err);
54
+ process.exit();
55
+ return;
56
+ }
57
+
58
+ console.log('Two-factor authentication disabled!');
59
+ process.exit();
60
+ });
61
+ });
62
+ }