@epicauth/sdk 1.0.1 → 1.0.3
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/dist/client.js +59 -59
- package/package.json +2 -2
package/dist/client.js
CHANGED
|
@@ -35,7 +35,7 @@ export default class EpicAuth {
|
|
|
35
35
|
this.hash_to_check = options.hash_to_check;
|
|
36
36
|
this.url = options.url ?? "https://epicauth.cc/api/1.3/";
|
|
37
37
|
this.path = options.path;
|
|
38
|
-
this.loggingEnabled = options.loggingEnabled ??
|
|
38
|
+
this.loggingEnabled = options.loggingEnabled ?? false;
|
|
39
39
|
this.exitOnError = options.exitOnError ?? true;
|
|
40
40
|
if (!this.name || !this.ownerid || !this.version) {
|
|
41
41
|
throw new Error("Name, ownerid, and version are required");
|
|
@@ -81,10 +81,10 @@ export default class EpicAuth {
|
|
|
81
81
|
if (response === "EpicAuth_Invalid") {
|
|
82
82
|
return this.fail("This application does not exist");
|
|
83
83
|
}
|
|
84
|
-
if (response
|
|
84
|
+
if (response.message === "invalidver") {
|
|
85
85
|
if ("download" in response) {
|
|
86
86
|
console.log("Your application is outdated.");
|
|
87
|
-
exec(`start ${response
|
|
87
|
+
exec(`start ${response.download}`, (error) => {
|
|
88
88
|
if (error) {
|
|
89
89
|
return this.fail(`Failed to open the download link:${error}`);
|
|
90
90
|
}
|
|
@@ -95,8 +95,8 @@ export default class EpicAuth {
|
|
|
95
95
|
return this.fail("Your application is outdated and no download link was provided, contact the owner for the latest app version.");
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
if (response
|
|
99
|
-
return this.fail(response
|
|
98
|
+
if (response.success === false) {
|
|
99
|
+
return this.fail(response.message);
|
|
100
100
|
}
|
|
101
101
|
if ("sessionid" in response) {
|
|
102
102
|
this.sessionid = response.sessionid;
|
|
@@ -127,13 +127,13 @@ export default class EpicAuth {
|
|
|
127
127
|
...code && { "code": code },
|
|
128
128
|
};
|
|
129
129
|
const response = await this.request(body);
|
|
130
|
-
if (response
|
|
131
|
-
|
|
132
|
-
this.load_user_data(response
|
|
130
|
+
if (response.success === true) {
|
|
131
|
+
this.logEvent(response.message);
|
|
132
|
+
this.load_user_data(response.info);
|
|
133
133
|
}
|
|
134
134
|
else {
|
|
135
|
-
|
|
136
|
-
return this.fail(response
|
|
135
|
+
this.logEvent(response.message);
|
|
136
|
+
return this.fail(response.message);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
/**
|
|
@@ -157,13 +157,13 @@ export default class EpicAuth {
|
|
|
157
157
|
...code && { "code": code },
|
|
158
158
|
};
|
|
159
159
|
const response = await this.request(body);
|
|
160
|
-
if (response
|
|
161
|
-
|
|
162
|
-
this.load_user_data(response
|
|
160
|
+
if (response.success === true) {
|
|
161
|
+
this.logEvent(response.message);
|
|
162
|
+
this.load_user_data(response.info);
|
|
163
163
|
}
|
|
164
164
|
else {
|
|
165
|
-
|
|
166
|
-
return this.fail(response
|
|
165
|
+
this.logEvent(response.message);
|
|
166
|
+
return this.fail(response.message);
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
/**
|
|
@@ -189,13 +189,13 @@ export default class EpicAuth {
|
|
|
189
189
|
"hwid": hwid,
|
|
190
190
|
};
|
|
191
191
|
const response = await this.request(body);
|
|
192
|
-
if (response
|
|
193
|
-
|
|
194
|
-
this.load_user_data(response
|
|
192
|
+
if (response.success === true) {
|
|
193
|
+
this.logEvent(response.message);
|
|
194
|
+
this.load_user_data(response.info);
|
|
195
195
|
}
|
|
196
196
|
else {
|
|
197
|
-
|
|
198
|
-
return this.fail(response
|
|
197
|
+
this.logEvent(response.message);
|
|
198
|
+
return this.fail(response.message);
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
/**
|
|
@@ -216,13 +216,13 @@ export default class EpicAuth {
|
|
|
216
216
|
"key": license,
|
|
217
217
|
};
|
|
218
218
|
const response = await this.request(body);
|
|
219
|
-
if (response
|
|
220
|
-
|
|
219
|
+
if (response.success === true) {
|
|
220
|
+
this.logEvent(response.message);
|
|
221
221
|
return this.fail("Restart the application to apply the changes.");
|
|
222
222
|
}
|
|
223
223
|
else {
|
|
224
|
-
|
|
225
|
-
return this.fail(response
|
|
224
|
+
this.logEvent(response.message);
|
|
225
|
+
return this.fail(response.message);
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
228
|
/**
|
|
@@ -240,11 +240,11 @@ export default class EpicAuth {
|
|
|
240
240
|
"varid": name
|
|
241
241
|
};
|
|
242
242
|
const response = await this.request(body);
|
|
243
|
-
if (response
|
|
244
|
-
|
|
243
|
+
if (response.success === true) {
|
|
244
|
+
this.logEvent(response.message);
|
|
245
245
|
}
|
|
246
246
|
else {
|
|
247
|
-
this.fail(response
|
|
247
|
+
this.fail(response.message ?? "var error");
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
/**
|
|
@@ -262,11 +262,11 @@ export default class EpicAuth {
|
|
|
262
262
|
"var": name
|
|
263
263
|
};
|
|
264
264
|
const response = await this.request(body);
|
|
265
|
-
if (response
|
|
266
|
-
|
|
265
|
+
if (response.success === true) {
|
|
266
|
+
this.logEvent(response.message);
|
|
267
267
|
}
|
|
268
268
|
else {
|
|
269
|
-
this.fail(response
|
|
269
|
+
this.fail(response.message ?? "getvar error");
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
272
|
/**
|
|
@@ -286,11 +286,11 @@ export default class EpicAuth {
|
|
|
286
286
|
"data": value,
|
|
287
287
|
};
|
|
288
288
|
const response = await this.request(body);
|
|
289
|
-
if (response
|
|
289
|
+
if (response.success === true) {
|
|
290
290
|
return true;
|
|
291
291
|
}
|
|
292
292
|
else {
|
|
293
|
-
this.fail(response
|
|
293
|
+
this.fail(response.message ?? "setvar error");
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
296
|
/**
|
|
@@ -307,11 +307,11 @@ export default class EpicAuth {
|
|
|
307
307
|
"sessionid": this.sessionid,
|
|
308
308
|
};
|
|
309
309
|
const response = await this.request(body);
|
|
310
|
-
if (response
|
|
310
|
+
if (response.success === true) {
|
|
311
311
|
return true;
|
|
312
312
|
}
|
|
313
313
|
else {
|
|
314
|
-
this.fail(response
|
|
314
|
+
this.fail(response.message);
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
/**
|
|
@@ -330,11 +330,11 @@ export default class EpicAuth {
|
|
|
330
330
|
"fileid": id
|
|
331
331
|
};
|
|
332
332
|
const response = await this.request(body);
|
|
333
|
-
if (response
|
|
334
|
-
return Buffer.from(response
|
|
333
|
+
if (response.success === true) {
|
|
334
|
+
return Buffer.from(response.contents);
|
|
335
335
|
}
|
|
336
336
|
else {
|
|
337
|
-
this.fail(response
|
|
337
|
+
this.fail(response.message);
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
340
|
/**
|
|
@@ -355,11 +355,11 @@ export default class EpicAuth {
|
|
|
355
355
|
"conttype": conttype,
|
|
356
356
|
};
|
|
357
357
|
const response = await this.request(data);
|
|
358
|
-
if (response
|
|
359
|
-
return response
|
|
358
|
+
if (response.success === true) {
|
|
359
|
+
return response.message;
|
|
360
360
|
}
|
|
361
361
|
else {
|
|
362
|
-
this.fail(response
|
|
362
|
+
this.fail(response.message);
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
365
|
/**
|
|
@@ -376,11 +376,11 @@ export default class EpicAuth {
|
|
|
376
376
|
"sessionid": this.sessionid,
|
|
377
377
|
};
|
|
378
378
|
const response = await this.request(body);
|
|
379
|
-
if (response
|
|
379
|
+
if (response.success === true) {
|
|
380
380
|
return true;
|
|
381
381
|
}
|
|
382
382
|
else {
|
|
383
|
-
this.fail(response
|
|
383
|
+
this.fail(response.message);
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
386
|
/**
|
|
@@ -399,11 +399,11 @@ export default class EpicAuth {
|
|
|
399
399
|
"hwid": hwid,
|
|
400
400
|
};
|
|
401
401
|
const response = await this.request(body);
|
|
402
|
-
if (response
|
|
402
|
+
if (response.success === true) {
|
|
403
403
|
return true;
|
|
404
404
|
}
|
|
405
405
|
else {
|
|
406
|
-
this.fail(response
|
|
406
|
+
this.fail(response.message);
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
409
|
/**
|
|
@@ -437,9 +437,9 @@ export default class EpicAuth {
|
|
|
437
437
|
"sessionid": this.sessionid,
|
|
438
438
|
};
|
|
439
439
|
const response = await this.request(body);
|
|
440
|
-
if (response
|
|
440
|
+
if (response.success === true) {
|
|
441
441
|
if ("users" in response) {
|
|
442
|
-
return Number(response
|
|
442
|
+
return Number(response.users);
|
|
443
443
|
}
|
|
444
444
|
else {
|
|
445
445
|
return null;
|
|
@@ -463,8 +463,8 @@ export default class EpicAuth {
|
|
|
463
463
|
"sessionid": this.sessionid,
|
|
464
464
|
};
|
|
465
465
|
const response = await this.request(body);
|
|
466
|
-
if (response
|
|
467
|
-
return this.load_app_data(response
|
|
466
|
+
if (response.success === true) {
|
|
467
|
+
return this.load_app_data(response.appinfo);
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
470
|
/**
|
|
@@ -483,8 +483,8 @@ export default class EpicAuth {
|
|
|
483
483
|
"channel": channel,
|
|
484
484
|
};
|
|
485
485
|
const response = await this.request(body);
|
|
486
|
-
if (response
|
|
487
|
-
return response
|
|
486
|
+
if (response.success === true) {
|
|
487
|
+
return response.messages;
|
|
488
488
|
}
|
|
489
489
|
else {
|
|
490
490
|
return false;
|
|
@@ -508,7 +508,7 @@ export default class EpicAuth {
|
|
|
508
508
|
"message": message,
|
|
509
509
|
};
|
|
510
510
|
const response = await this.request(body);
|
|
511
|
-
if (response
|
|
511
|
+
if (response.success === true) {
|
|
512
512
|
return true;
|
|
513
513
|
}
|
|
514
514
|
else {
|
|
@@ -531,7 +531,7 @@ export default class EpicAuth {
|
|
|
531
531
|
"sessionid": this.sessionid,
|
|
532
532
|
};
|
|
533
533
|
const response = await this.request(body);
|
|
534
|
-
if (response
|
|
534
|
+
if (response.success === true) {
|
|
535
535
|
console.log("Username changed successfully");
|
|
536
536
|
}
|
|
537
537
|
else {
|
|
@@ -551,11 +551,11 @@ export default class EpicAuth {
|
|
|
551
551
|
"sessionid": this.sessionid,
|
|
552
552
|
};
|
|
553
553
|
const response = await this.request(body);
|
|
554
|
-
if (response
|
|
554
|
+
if (response.success === true) {
|
|
555
555
|
this.fail("Logged out successfully");
|
|
556
556
|
}
|
|
557
557
|
else {
|
|
558
|
-
this.fail(response
|
|
558
|
+
this.fail(response.message);
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
561
|
/**
|
|
@@ -573,11 +573,11 @@ export default class EpicAuth {
|
|
|
573
573
|
...code && { "code": code },
|
|
574
574
|
};
|
|
575
575
|
const response = await this.request(post_data);
|
|
576
|
-
if (response
|
|
576
|
+
if (response.success === true) {
|
|
577
577
|
if (!code) {
|
|
578
578
|
console.log(response);
|
|
579
|
-
console.log("Your 2fa secret code is: " + response["2fa"]
|
|
580
|
-
this.displayQrCode(response["2fa"]
|
|
579
|
+
console.log("Your 2fa secret code is: " + response["2fa"].secret_code);
|
|
580
|
+
this.displayQrCode(response["2fa"].QRCode);
|
|
581
581
|
console.log("Please enter the code you received in your authenticator app.");
|
|
582
582
|
const userCode = await new Promise((resolve) => {
|
|
583
583
|
readline.question("Enter the code: ", (input) => {
|
|
@@ -591,7 +591,7 @@ export default class EpicAuth {
|
|
|
591
591
|
}
|
|
592
592
|
}
|
|
593
593
|
else {
|
|
594
|
-
|
|
594
|
+
this.logEvent(response.message);
|
|
595
595
|
this.sleep(5000);
|
|
596
596
|
process.exit(0);
|
|
597
597
|
}
|
|
@@ -615,7 +615,7 @@ export default class EpicAuth {
|
|
|
615
615
|
"code": code,
|
|
616
616
|
};
|
|
617
617
|
const response = await this.request(post_data);
|
|
618
|
-
|
|
618
|
+
this.logEvent(response.message);
|
|
619
619
|
await this.sleep(5000);
|
|
620
620
|
}
|
|
621
621
|
async checkinit() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epicauth/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "EpicAuth SDK for Node.js and Bun",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -36,6 +36,6 @@
|
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/bun": "latest",
|
|
39
|
-
"typescript": "^
|
|
39
|
+
"typescript": "^7.0.2"
|
|
40
40
|
}
|
|
41
41
|
}
|