fca-priyansh 16.0.0 → 18.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/Extra/Balancer.js +49 -0
- package/Extra/Bypass/956/index.js +234 -0
- package/Extra/Bypass/test/aaaa.json +170 -0
- package/Extra/Bypass/test/index.js +188 -0
- package/Extra/Database/index.js +249 -140
- package/Extra/ExtraAddons.js +35 -33
- package/Extra/ExtraFindUID.js +3 -1
- package/Extra/ExtraGetThread.js +303 -56
- package/Extra/ExtraUptimeRobot.js +15 -3
- package/Extra/Html/Classic/script.js +3 -3
- package/Extra/Security/AES_256_GCM/index.js +0 -0
- package/Extra/Security/Base/Step_1.js +6 -0
- package/Extra/Security/Base/Step_2.js +22 -0
- package/Extra/Security/Base/Step_3.js +22 -0
- package/Extra/Security/Base/index.js +191 -0
- package/Extra/Security/Index.js +5 -146
- package/Extra/Security/Step_1.js +4 -9
- package/Extra/Security/Step_2.js +2 -0
- package/Extra/Security/Step_3.js +4 -2
- package/Extra/Src/Change_Environment.js +1 -1
- package/Extra/Src/Check_Update.js +67 -0
- package/Extra/Src/History.js +2 -2
- package/Extra/Src/Instant_Update.js +65 -0
- package/Extra/Src/Premium.js +35 -38
- package/Extra/Src/Release_Memory.js +160 -0
- package/Extra/Src/Websocket.js +213 -0
- package/Extra/Src/image/checkmate.jpg +0 -0
- package/Extra/Src/test.js +28 -0
- package/Extra/Src/uuid.js +1 -1
- package/Func/AcceptAgreement.js +4 -5
- package/Func/ClearCache.js +7 -7
- package/Func/ReportV1.js +5 -5
- package/LICENSE +1 -4
- package/Language/index.json +59 -8
- package/Main.js +1290 -0
- package/README.md +198 -1
- package/broadcast.js +43 -37
- package/index.js +303 -1704
- package/logger.js +4 -4
- package/package.json +16 -11
- package/src/Dev_Horizon_Data.js +3 -3
- package/src/Dev_getThreadInfoOLD.js +422 -0
- package/src/Dev_shareTest2.js +68 -0
- package/src/Dev_shareTest3.js +71 -0
- package/src/Premium.js +8 -13
- package/src/Screenshot.js +4 -6
- package/src/editMessage.js +53 -0
- package/src/getAccessToken.js +0 -4
- package/src/getFriendsList.js +1 -1
- package/src/getMessage.js +26 -3
- package/src/getThreadHistory.js +1 -1
- package/src/getThreadInfo.js +237 -161
- package/src/getThreadInfoOLD.js +422 -0
- package/src/getThreadMain.js +1 -1
- package/src/getUID.js +3 -3
- package/src/getUserInfo.js +56 -73
- package/src/getUserInfoMain.js +2 -2
- package/src/getUserInfoV2.js +0 -4
- package/src/getUserInfoV3.js +3 -3
- package/src/getUserInfoV4.js +5 -5
- package/src/getUserInfoV5.js +4 -4
- package/src/listenMqtt.js +905 -625
- package/src/listenMqttV1.js +846 -0
- package/src/sendMessage.js +54 -2
- package/src/sendMqttMessage.js +71 -0
- package/src/setPostReaction.js +3 -3
- package/src/shareContact.js +55 -0
- package/src/shareLink.js +58 -0
- package/src/unsendMessage.js +28 -20
- package/src/unsendMqttMessage.js +66 -0
- package/utils.js +1567 -138
- package/.gitattributes +0 -2
- package/gitattributes +0 -2
- package/gitignore.txt +0 -10
package/Extra/ExtraGetThread.js
CHANGED
@@ -1,118 +1,365 @@
|
|
1
1
|
/* eslint-disable */
|
2
2
|
"use strict";
|
3
|
-
var Database
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
var Database= require("./Database");
|
4
|
+
const { lastRun,capture } = require('./Src/Last-Run');
|
5
|
+
const logger = require("../logger");
|
6
|
+
const getText = global.Fca.getText;
|
7
7
|
var language = require("../Language/index.json");
|
8
|
+
const fs = require("fs");
|
8
9
|
language = language.find(i => i.Language == require(process.cwd() + "/PriyanshFca.json").Language).Folder.ExtraGetThread;
|
10
|
+
const Always_True = [];
|
11
|
+
if (global.Fca.Require.Priyansh.AntiGetInfo.Database_Type == "json") {
|
12
|
+
if (!fs.existsSync(process.cwd() + "/Horizon_Database/Threads.json")) {
|
13
|
+
fs.writeFileSync(process.cwd() + "/Horizon_Database/Threads.json",JSON.stringify({}));
|
14
|
+
}
|
15
|
+
}
|
16
|
+
else if (global.Fca.Require.Priyansh.AntiGetInfo.Database_Type != "default" && global.Fca.Require.Priyansh.AntiGetInfo.Database_Type != "json") {
|
17
|
+
logger.Warning("Database_Type in PriyanshFca.json is not valid. Only default and json are valid.");
|
18
|
+
process.exit(0);
|
19
|
+
}
|
9
20
|
|
10
21
|
exports.createData = function(threadID,threadData) {
|
11
|
-
|
12
|
-
|
13
|
-
|
22
|
+
if (global.Fca.Require.Priyansh.AntiGetInfo.Database_Type == "default") {
|
23
|
+
try {
|
24
|
+
Database(true).set(String(threadID),Object(threadData));
|
25
|
+
logger.Normal(getText(language.CreateDatabaseSuccess,String(threadID)));
|
26
|
+
}
|
27
|
+
catch (e) {
|
28
|
+
console.log(e);
|
29
|
+
logger.Warning(getText(language.CreateDatabaseFailure,String(threadID)));
|
30
|
+
}
|
14
31
|
}
|
15
|
-
|
16
|
-
|
17
|
-
|
32
|
+
else if (global.Fca.Require.Priyansh.AntiGetInfo.Database_Type == "json") {
|
33
|
+
try {
|
34
|
+
try {
|
35
|
+
var data = require(process.cwd() + "/Horizon_Database/Threads.json");
|
36
|
+
}
|
37
|
+
catch (e) {
|
38
|
+
var data = {};
|
39
|
+
fs.writeFileSync(process.cwd() + "/Horizon_Database/Threads.json",JSON.stringify(data));
|
40
|
+
}
|
41
|
+
|
42
|
+
data[String(threadID)] = Object(threadData);
|
43
|
+
fs.writeFileSync(process.cwd() + "/Horizon_Database/Threads.json",JSON.stringify(data));
|
44
|
+
logger.Normal(getText(language.CreateDatabaseSuccess,String(threadID)));
|
45
|
+
}
|
46
|
+
catch (e) {
|
47
|
+
console.log(e);
|
48
|
+
logger.Warning(getText(language.CreateDatabaseFailure,String(threadID)));
|
49
|
+
}
|
18
50
|
}
|
19
51
|
}
|
20
52
|
|
21
53
|
exports.updateData = function(threadID,threadData) {
|
22
|
-
|
23
|
-
|
24
|
-
|
54
|
+
if (global.Fca.Require.Priyansh.AntiGetInfo.Database_Type == "default") {
|
55
|
+
try {
|
56
|
+
Database(true).set(String(threadID),Object(threadData));
|
57
|
+
logger.Normal(getText(language.updateDataSuccess,String(threadID)));
|
58
|
+
}
|
59
|
+
catch (e) {
|
60
|
+
console.log(e);
|
61
|
+
logger.Warning(getText(language.updateDataFailure,String(threadID)));
|
62
|
+
}
|
25
63
|
}
|
26
|
-
|
27
|
-
|
28
|
-
|
64
|
+
else if (global.Fca.Require.Priyansh.AntiGetInfo.Database_Type == "json") {
|
65
|
+
try {
|
66
|
+
try {
|
67
|
+
var data = require(process.cwd() + "/Horizon_Database/Threads.json");
|
68
|
+
}
|
69
|
+
catch (e) {
|
70
|
+
var data = {};
|
71
|
+
fs.writeFileSync(process.cwd() + "/Horizon_Database/Threads.json",JSON.stringify(data));
|
72
|
+
}
|
73
|
+
|
74
|
+
data[String(threadID)] = Object(threadData);
|
75
|
+
fs.writeFileSync(process.cwd() + "/Horizon_Database/Threads.json",JSON.stringify(data));
|
76
|
+
logger.Normal(getText(language.updateDataSuccess,String(threadID)));
|
77
|
+
}
|
78
|
+
catch (e) {
|
79
|
+
console.log(e);
|
80
|
+
logger.Warning(getText(language.updateDataFailure,String(threadID)));
|
81
|
+
}
|
29
82
|
}
|
30
83
|
}
|
31
84
|
|
32
85
|
exports.updateMessageCount = function(threadID,threadData) {
|
33
|
-
|
34
|
-
|
86
|
+
if (global.Fca.Require.Priyansh.AntiGetInfo.Database_Type == "default") {
|
87
|
+
try {
|
88
|
+
Database(true).set(String(threadID),Object(threadData));
|
89
|
+
}
|
90
|
+
catch (e) {
|
91
|
+
console.log(e);
|
92
|
+
}
|
35
93
|
}
|
36
|
-
|
37
|
-
|
94
|
+
else if (global.Fca.Require.Priyansh.AntiGetInfo.Database_Type == "json") {
|
95
|
+
try {
|
96
|
+
try {
|
97
|
+
var data = require(process.cwd() + "/Horizon_Database/Threads.json");
|
98
|
+
}
|
99
|
+
catch (e) {
|
100
|
+
var data = {};
|
101
|
+
fs.writeFileSync(process.cwd() + "/Horizon_Database/Threads.json",JSON.stringify(data));
|
102
|
+
}
|
103
|
+
|
104
|
+
data[String(threadID)] = Object(threadData);
|
105
|
+
fs.writeFileSync(process.cwd() + "/Horizon_Database/Threads.json",JSON.stringify(data));
|
106
|
+
}
|
107
|
+
catch (e) {
|
108
|
+
console.log(e);
|
109
|
+
}
|
38
110
|
}
|
39
111
|
}
|
40
112
|
|
41
113
|
exports.getData = function(threadID) {
|
42
|
-
|
43
|
-
|
44
|
-
|
114
|
+
if (global.Fca.Require.Priyansh.AntiGetInfo.Database_Type == "default") {
|
115
|
+
let Sw;
|
116
|
+
if (Always_True.includes(threadID)) Sw = true
|
117
|
+
else Sw = Database(true).has(String(threadID))
|
118
|
+
switch (Sw) {
|
119
|
+
case true: {
|
120
|
+
return Database(true).get(String(threadID))
|
121
|
+
}
|
122
|
+
case false: {
|
123
|
+
return null;
|
124
|
+
}
|
125
|
+
}
|
126
|
+
}
|
127
|
+
else if (global.Fca.Require.Priyansh.AntiGetInfo.Database_Type == "json") {
|
128
|
+
try {
|
129
|
+
let Sw;
|
130
|
+
if (Always_True.includes(threadID)) Sw = true
|
131
|
+
else Sw = data.hasOwnProperty(String(threadID))
|
132
|
+
var data = require(process.cwd() + "/Horizon_Database/Threads.json");
|
133
|
+
switch (Sw) {
|
134
|
+
case true: {
|
135
|
+
return data[String(threadID)];
|
136
|
+
}
|
137
|
+
case false: {
|
138
|
+
return null;
|
139
|
+
}
|
140
|
+
}
|
45
141
|
}
|
46
|
-
|
142
|
+
catch (e) {
|
143
|
+
console.log(e);
|
47
144
|
return null;
|
48
145
|
}
|
49
146
|
}
|
50
147
|
}
|
51
148
|
|
52
149
|
exports.deleteAll = function(data) {
|
53
|
-
|
54
|
-
|
150
|
+
if (global.Fca.Require.Priyansh.AntiGetInfo.Database_Type == "default") {
|
151
|
+
for (let i of data) {
|
152
|
+
Database(true).delete(String(i));
|
153
|
+
}
|
154
|
+
}
|
155
|
+
else if (global.Fca.Require.Priyansh.AntiGetInfo.Database_Type == "json") {
|
156
|
+
try {
|
157
|
+
var data1 = require(process.cwd() + "/Horizon_Database/Threads.json");
|
158
|
+
for (let i of data) {
|
159
|
+
delete data1[String(i)];
|
160
|
+
}
|
161
|
+
fs.writeFileSync(process.cwd() + "/Horizon_Database/Threads.json",JSON.stringify(data1));
|
162
|
+
}
|
163
|
+
catch (e) {
|
164
|
+
console.log(e);
|
165
|
+
}
|
55
166
|
}
|
56
167
|
}
|
57
168
|
|
58
169
|
exports.getAll = function() {
|
59
|
-
|
170
|
+
if (global.Fca.Require.Priyansh.AntiGetInfo.Database_Type == "default") {
|
171
|
+
return Database(true).list();
|
172
|
+
}
|
173
|
+
else if (global.Fca.Require.Priyansh.AntiGetInfo.Database_Type == "json") {
|
174
|
+
try {
|
175
|
+
const Data_Res = []
|
176
|
+
var data = require(process.cwd() + "/Horizon_Database/Threads.json");
|
177
|
+
for (let i of Object.keys(data)) {
|
178
|
+
Data_Res.push({
|
179
|
+
ID: String(i),
|
180
|
+
data: data[String(i)]
|
181
|
+
});
|
182
|
+
}
|
183
|
+
return Data_Res;
|
184
|
+
}
|
185
|
+
catch (e) {
|
186
|
+
console.log(e);
|
187
|
+
return [];
|
188
|
+
}
|
189
|
+
}
|
60
190
|
}
|
61
191
|
|
62
192
|
exports.hasData = function(threadID) {
|
63
|
-
|
193
|
+
if (global.Fca.Require.Priyansh.AntiGetInfo.Database_Type == "default") {
|
194
|
+
if (Always_True.includes(threadID)) return true;
|
195
|
+
else {
|
196
|
+
const Data_Back = Database(true).has(String(threadID));
|
197
|
+
if (Data_Back === true) Always_True.push(threadID);
|
198
|
+
return Data_Back;
|
199
|
+
}
|
200
|
+
}
|
201
|
+
else if (global.Fca.Require.Priyansh.AntiGetInfo.Database_Type == "json") {
|
202
|
+
try {
|
203
|
+
if (Always_True.includes(threadID)) return true;
|
204
|
+
else {
|
205
|
+
var data = require(process.cwd() + "/Horizon_Database/Threads.json");
|
206
|
+
var has = data.hasOwnProperty(String(threadID));
|
207
|
+
if (has === true) Always_True.push(threadID);
|
208
|
+
return has
|
209
|
+
}
|
210
|
+
}
|
211
|
+
catch (e) {
|
212
|
+
console.log(e);
|
213
|
+
return false;
|
214
|
+
}
|
215
|
+
}
|
64
216
|
}
|
65
217
|
|
66
218
|
exports.alreadyUpdate = function(threadID) {
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
219
|
+
if (global.Fca.Require.Priyansh.AntiGetInfo.Database_Type == "default") {
|
220
|
+
var Time = Database(true).get(String(threadID)).TimeUpdate;
|
221
|
+
try {
|
222
|
+
if (global.Fca.startTime >= (Time + (3600 * 1000))) {
|
223
|
+
logger.Normal(getText(language.alreadyUpdate, String(threadID)));
|
224
|
+
return true;
|
225
|
+
}
|
226
|
+
else return false;
|
72
227
|
}
|
73
|
-
|
228
|
+
catch (e) {
|
229
|
+
console.log(e);
|
230
|
+
return true;
|
231
|
+
}
|
232
|
+
}
|
233
|
+
else if (global.Fca.Require.Priyansh.AntiGetInfo.Database_Type == "json") {
|
234
|
+
try {
|
235
|
+
var data = require(process.cwd() + "/Horizon_Database/Threads.json");
|
236
|
+
var Time = data[String(threadID)].TimeUpdate;
|
237
|
+
try {
|
238
|
+
if (global.Fca.startTime >= (Time + (3600 * 1000))) {
|
239
|
+
logger.Normal(getText(language.alreadyUpdate, String(threadID)));
|
240
|
+
return true;
|
241
|
+
}
|
242
|
+
else return false;
|
243
|
+
}
|
244
|
+
catch (e) {
|
245
|
+
console.log(e);
|
246
|
+
return true;
|
247
|
+
}
|
74
248
|
}
|
75
|
-
catch (e) {
|
249
|
+
catch (e) {
|
76
250
|
console.log(e);
|
77
|
-
|
251
|
+
return true;
|
252
|
+
}
|
78
253
|
}
|
79
254
|
}
|
80
255
|
|
81
256
|
exports.readyCreate = function(Name) {
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
257
|
+
if (global.Fca.Require.Priyansh.AntiGetInfo.Database_Type == "default") {
|
258
|
+
switch (Database(true).has(String(Name))) {
|
259
|
+
case true: {
|
260
|
+
if (!Always_True.includes(Name)) Always_True.push(Name);
|
261
|
+
|
262
|
+
if (Number(global.Fca.startTime) >= Number(Database(true).get(String(Name)) + (120 * 1000))) {
|
263
|
+
return true;
|
264
|
+
}
|
265
|
+
else {
|
266
|
+
return false;
|
267
|
+
}
|
268
|
+
}
|
269
|
+
case false: {
|
88
270
|
return false;
|
89
271
|
}
|
90
272
|
}
|
91
|
-
|
273
|
+
}
|
274
|
+
else if (global.Fca.Require.Priyansh.AntiGetInfo.Database_Type == "json") {
|
275
|
+
try {
|
276
|
+
var data = require(process.cwd() + "/Horizon_Database/Threads.json");
|
277
|
+
switch (data.hasOwnProperty(String(Name))) {
|
278
|
+
case true: {
|
279
|
+
if (Number(global.Fca.startTime) >= Number(data[String(Name)] + (120 * 1000))) {
|
280
|
+
return true;
|
281
|
+
}
|
282
|
+
else {
|
283
|
+
return false;
|
284
|
+
}
|
285
|
+
}
|
286
|
+
case false: {
|
287
|
+
return false;
|
288
|
+
}
|
289
|
+
}
|
290
|
+
}
|
291
|
+
catch (e) {
|
292
|
+
console.log(e);
|
92
293
|
return false;
|
93
294
|
}
|
94
295
|
}
|
95
296
|
}
|
96
297
|
|
97
298
|
exports.setLastRun = function(Name,LastRun) {
|
98
|
-
|
299
|
+
if (global.Fca.Require.Priyansh.AntiGetInfo.Database_Type == "default") {
|
300
|
+
Database(true).set(String(Name),String(lastRun(LastRun)));
|
301
|
+
}
|
302
|
+
else if (global.Fca.Require.Priyansh.AntiGetInfo.Database_Type == "json") {
|
303
|
+
try {
|
304
|
+
var data = require(process.cwd() + "/Horizon_Database/Threads.json");
|
305
|
+
data[String(Name)] = String(lastRun(LastRun));
|
306
|
+
fs.writeFileSync(process.cwd() + "/Horizon_Database/Threads.json",JSON.stringify(data));
|
307
|
+
}
|
308
|
+
catch (e) {
|
309
|
+
console.log(e);
|
310
|
+
}
|
311
|
+
}
|
99
312
|
}
|
100
313
|
|
101
314
|
exports.getLastRun = function(Name) {
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
return Database.get(String(Name),{},true);
|
315
|
+
if (global.Fca.Require.Priyansh.AntiGetInfo.Database_Type == "default") {
|
316
|
+
let Sw;
|
317
|
+
if (Always_True.includes(Name)) Sw = true;
|
318
|
+
else Sw = Database(true).has(String(Name));
|
319
|
+
|
320
|
+
switch (Sw) {
|
321
|
+
case true: {
|
322
|
+
return Database(true).get(String(Name));
|
111
323
|
}
|
112
|
-
|
113
|
-
|
114
|
-
|
324
|
+
case false: {
|
325
|
+
try {
|
326
|
+
capture(Name)
|
327
|
+
this.setLastRun(Name,Name);
|
328
|
+
return Database(true).get(String(Name));
|
329
|
+
}
|
330
|
+
catch(e) {
|
331
|
+
console.log(e);
|
332
|
+
return Date.now();
|
333
|
+
}
|
115
334
|
}
|
116
335
|
}
|
117
336
|
}
|
337
|
+
else if (global.Fca.Require.Priyansh.AntiGetInfo.Database_Type == "json") {
|
338
|
+
try {
|
339
|
+
let Sw;
|
340
|
+
if (Always_True.includes(Name)) Sw = true;
|
341
|
+
else Sw = data.hasOwnProperty(String(Name));
|
342
|
+
var data = require(process.cwd() + "/Horizon_Database/Threads.json");
|
343
|
+
switch (Sw) {
|
344
|
+
case true: {
|
345
|
+
return data[String(Name)];
|
346
|
+
}
|
347
|
+
case false: {
|
348
|
+
try {
|
349
|
+
capture(Name)
|
350
|
+
this.setLastRun(Name,Name);
|
351
|
+
return data[String(Name)];
|
352
|
+
}
|
353
|
+
catch(e) {
|
354
|
+
console.log(e);
|
355
|
+
return Date.now();
|
356
|
+
}
|
357
|
+
}
|
358
|
+
}
|
359
|
+
}
|
360
|
+
catch (e) {
|
361
|
+
console.log(e);
|
362
|
+
return Date.now();
|
363
|
+
}
|
364
|
+
}
|
118
365
|
}
|
@@ -1,9 +1,21 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
1
3
|
const logger = require("../logger");
|
2
4
|
module.exports = function() {
|
3
5
|
var Logger = global.Fca.Require.logger;
|
4
6
|
switch (process.platform) {
|
5
|
-
case 'win32':
|
6
|
-
|
7
|
+
case 'win32': {
|
8
|
+
if (global.Fca.Require.Priyansh.Uptime) {
|
9
|
+
logger.Warning(global.Fca.Require.Language.ExtraUpTime.NotSupport);
|
10
|
+
}
|
11
|
+
break;
|
12
|
+
}
|
13
|
+
case 'darwin': {
|
14
|
+
if (global.Fca.Require.Priyansh.Uptime) {
|
15
|
+
logger.Warning(global.Fca.Require.Language.ExtraUpTime.NotSupport);
|
16
|
+
}
|
17
|
+
break;
|
18
|
+
}
|
7
19
|
case 'linux':
|
8
20
|
if (process.env.REPL_SLUG) {
|
9
21
|
var Value = global.Fca.Require.Priyansh;
|
@@ -12,7 +24,7 @@ module.exports = function() {
|
|
12
24
|
logger.Normal(global.Fca.Require.Language.ExtraUpTime.Uptime);//
|
13
25
|
return setInterval(function() {
|
14
26
|
Fetch.get(`https://${process.env.REPL_SLUG}.${process.env.REPL_OWNER}.repl.co`);
|
15
|
-
},1000);
|
27
|
+
},10*1000);
|
16
28
|
}
|
17
29
|
else return;
|
18
30
|
}
|
@@ -18,7 +18,7 @@ var point = function(x,y,vx,vy){
|
|
18
18
|
this.y = y;
|
19
19
|
this.vx = vx || 1;
|
20
20
|
this.vy = vy || 1;
|
21
|
-
}
|
21
|
+
};
|
22
22
|
point.prototype.update = function() {
|
23
23
|
ctx.beginPath();
|
24
24
|
ctx.fillStyle = "#95a5a6";
|
@@ -58,7 +58,7 @@ point.prototype.update = function() {
|
|
58
58
|
|
59
59
|
this.x += this.vx;
|
60
60
|
this.y += this.vy;
|
61
|
-
}
|
61
|
+
};
|
62
62
|
|
63
63
|
function loop() {
|
64
64
|
ctx.clearRect(0,0,c.width,c.height);
|
@@ -116,4 +116,4 @@ function coordsToI(x,y,w) {
|
|
116
116
|
}
|
117
117
|
|
118
118
|
setInterval(loop,50);
|
119
|
-
init();
|
119
|
+
init();
|
File without changes
|
@@ -0,0 +1,6 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var CryptoJS = require("crypto-js");
|
4
|
+
module.exports.EncryptState = function EncryptState(Data,PassWord) { return CryptoJS.AES.encrypt(Data, PassWord).toString(); };
|
5
|
+
|
6
|
+
module.exports.DecryptState = function DecryptState(Data,PassWord) { return CryptoJS.AES.decrypt(Data, PassWord).toString(CryptoJS.enc.Utf8); };
|
@@ -0,0 +1,22 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var CryptoJS = require("crypto-js");
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Encrypt the text using the CryptoJS library and return the encrypted text as a Base64 string.
|
7
|
+
* @param Data - The data to be encrypted.
|
8
|
+
* @returns A string of characters that represent the encrypted data.
|
9
|
+
*/
|
10
|
+
module.exports.Encrypt = function Encrypt(Data) {
|
11
|
+
return CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(Data));
|
12
|
+
};
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Decrypt the data using the CryptoJS library, and return the decrypted data as a string.
|
16
|
+
* @param Data - The data to be decrypted.
|
17
|
+
* @returns The decrypted data.
|
18
|
+
*/
|
19
|
+
|
20
|
+
module.exports.Decrypt = function Decrypt(Data) {
|
21
|
+
return CryptoJS.enc.Base64.parse(Data).toString(CryptoJS.enc.Utf8);
|
22
|
+
};
|
@@ -0,0 +1,22 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
const crypto = require('crypto');
|
4
|
+
const aes = require("aes-js");
|
5
|
+
|
6
|
+
module.exports.encryptState = function encryptState(data, key) {
|
7
|
+
let hashEngine = crypto.createHash("sha256");
|
8
|
+
let hashKey = hashEngine.update(key).digest();
|
9
|
+
let bytes = aes.utils.utf8.toBytes(data);
|
10
|
+
let aesCtr = new aes.ModeOfOperation.ctr(hashKey);
|
11
|
+
let encryptedData = aesCtr.encrypt(bytes);
|
12
|
+
return aes.utils.hex.fromBytes(encryptedData);
|
13
|
+
};
|
14
|
+
|
15
|
+
module.exports.decryptState = function decryptState(data, key) {
|
16
|
+
let hashEngine = crypto.createHash("sha256");
|
17
|
+
let hashKey = hashEngine.update(key).digest();
|
18
|
+
let encryptedBytes = aes.utils.hex.toBytes(data);
|
19
|
+
let aesCtr = new aes.ModeOfOperation.ctr(hashKey);
|
20
|
+
let decryptedData = aesCtr.decrypt(encryptedBytes);
|
21
|
+
return aes.utils.utf8.fromBytes(decryptedData);
|
22
|
+
};
|