fca-priyansh 10.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.gitattributes +2 -0
- package/.github/workflows/publish.yml +20 -0
- package/Extra/Database/index.js +360 -0
- package/Extra/ExtraAddons.js +80 -0
- package/Extra/ExtraFindUID.js +60 -0
- package/Extra/ExtraGetThread.js +118 -0
- package/Extra/ExtraScreenShot.js +430 -0
- package/Extra/ExtraUptimeRobot.js +26 -0
- package/Extra/Html/Classic/script.js +119 -0
- package/Extra/Html/Classic/style.css +8 -0
- package/Extra/Security/Index.js +146 -0
- package/Extra/Security/Step_1.js +11 -0
- package/Extra/Security/Step_2.js +20 -0
- package/Extra/Security/Step_3.js +20 -0
- package/Extra/Src/Change_Environment.js +24 -0
- package/Extra/Src/History.js +115 -0
- package/Extra/Src/Last-Run.js +65 -0
- package/Extra/Src/Premium.js +84 -0
- package/Extra/Src/uuid.js +137 -0
- package/Func/AcceptAgreement.js +32 -0
- package/Func/ClearCache.js +64 -0
- package/Func/ReportV1.js +54 -0
- package/LICENSE +24 -0
- package/Language/index.json +177 -0
- package/README.md +1 -0
- package/SECURITY.md +17 -0
- package/broadcast.js +38 -0
- package/gitattributes +2 -0
- package/gitignore.txt +10 -0
- package/index.js +1364 -0
- package/logger.js +66 -0
- package/package.json +91 -0
- package/src/Dev_Horizon_Data.js +125 -0
- package/src/Premium.js +30 -0
- package/src/Screenshot.js +85 -0
- package/src/addExternalModule.js +16 -0
- package/src/addUserToGroup.js +79 -0
- package/src/changeAdminStatus.js +79 -0
- package/src/changeArchivedStatus.js +41 -0
- package/src/changeAvt.js +85 -0
- package/src/changeBio.js +65 -0
- package/src/changeBlockedStatus.js +36 -0
- package/src/changeGroupImage.js +106 -0
- package/src/changeNickname.js +45 -0
- package/src/changeThreadColor.js +62 -0
- package/src/changeThreadEmoji.js +42 -0
- package/src/createNewGroup.js +70 -0
- package/src/createPoll.js +60 -0
- package/src/deleteMessage.js +45 -0
- package/src/deleteThread.js +43 -0
- package/src/forwardAttachment.js +48 -0
- package/src/getAccessToken.js +32 -0
- package/src/getCurrentUserID.js +7 -0
- package/src/getEmojiUrl.js +27 -0
- package/src/getFriendsList.js +73 -0
- package/src/getMessage.js +80 -0
- package/src/getThreadHistory.js +537 -0
- package/src/getThreadInfo.js +348 -0
- package/src/getThreadList.js +213 -0
- package/src/getThreadMain.js +220 -0
- package/src/getThreadPictures.js +59 -0
- package/src/getUID.js +59 -0
- package/src/getUserID.js +62 -0
- package/src/getUserInfo.js +129 -0
- package/src/getUserInfoMain.js +65 -0
- package/src/getUserInfoV2.js +36 -0
- package/src/getUserInfoV3.js +63 -0
- package/src/getUserInfoV4.js +55 -0
- package/src/getUserInfoV5.js +61 -0
- package/src/handleFriendRequest.js +46 -0
- package/src/handleMessageRequest.js +49 -0
- package/src/httpGet.js +49 -0
- package/src/httpPost.js +48 -0
- package/src/httpPostFormData.js +41 -0
- package/src/listenMqtt.js +676 -0
- package/src/logout.js +68 -0
- package/src/markAsDelivered.js +48 -0
- package/src/markAsRead.js +70 -0
- package/src/markAsReadAll.js +43 -0
- package/src/markAsSeen.js +51 -0
- package/src/muteThread.js +47 -0
- package/src/removeUserFromGroup.js +49 -0
- package/src/resolvePhotoUrl.js +37 -0
- package/src/searchForThread.js +43 -0
- package/src/sendMessage.js +334 -0
- package/src/sendTypingIndicator.js +80 -0
- package/src/setMessageReaction.js +109 -0
- package/src/setPostReaction.js +102 -0
- package/src/setTitle.js +74 -0
- package/src/threadColors.js +39 -0
- package/src/unfriend.js +43 -0
- package/src/unsendMessage.js +40 -0
- package/test/data/shareAttach.js +146 -0
- package/test/data/something.mov +0 -0
- package/test/data/test.png +0 -0
- package/test/data/test.txt +7 -0
- package/test/env/.env +0 -0
- package/test/example-config.json +18 -0
- package/test/test-page.js +140 -0
- package/test/test.js +385 -0
- package/test/testv2.js +3 -0
- package/utils.js +1648 -0
@@ -0,0 +1,146 @@
|
|
1
|
+
var ArrPassWord = ["CFGIZMHQGX", "URHQBLBLDR", "UBBWNJHLQS", "VOTNXBXQII", "HNGMQVUAHX", "IAFYAYRZDY", "WDJLNZSHGO", "SPMYPNPIDK", "BHDWKZCQJW", "YKHYNQHGSP", "XJWRXNOVIO", "SBPIBKTTYZ", "WOIJIPGAJH", "ZMBZURDFLW", "MVLVQWADDO", "CYJTGTGZON", "PRYZDDAWFO", "DUEOZNSCFJ", "KJPYPBSKMG", "EWFJVYCMMX", "CEDXZXJOGL", "KHPGXTFVOK", "PLQXZDLWJB", "SNWGNETCDG", "LILQXIGAZA", "GYGBDGBBYM", "DCRQKCOQLI", "RQJRRHVVKP", "JPCXRJGGNF", "JIEVLOVWIV", "PDGOFRVGEB", "QIIDHSRVKV", "ZECHPLBKFS", "EXQWXMACRP", "ZCCGCBWORF", "GJFOBWWMOS", "QCFNCFNIKZ", "ZAZZRZPAVC", "FQTFSFTNAP", "MVSSFKTHFA", "JFQGSMBYYQ", "JQINYGVFYJ", "ZBSPCBAQHC", "NQOTZDJARE", "CPWSWUEYQQ", "JVPWHYBXIB", "CXNXMSBIGT", "IFAFLNVDJK", "JOSSVDYERS", "YLWCRIRTUV", "CCKFYYGPAK", "YPELTOONQB", "FRMSZGHOEE", "BHRUUWMTDV", "OXKRPPNJHM", "FTPZCTSIFX", "NEDXDNHXOT", "VWREYWTQAD", "WIJFGFHOXG", "DOYYUZDOAA", "PMATAFECMX", "DKCIKASCUI", "GUESGUXXIM", "ZKHVCWXFYH", "BSTNRFIIQU", "TYIUNFDOYP", "NOUONMIJZM", "ECQTMQOJZI", "JVZQUABCGO", "DQQOTHHRZR", "HXDYLEMAGD", "RLALZZNBWU", "EEEEDUEGMW", "ZARNWMSQKV", "UDHXZOHBVX", "ACDYVCOSTK", "FVMTMIILWE", "FEBSFBHHWH", "WNSMQUVOLT", "BNROOXMJLS", "UMXDBEEPIA", "QTGHEEUVAD", "DDQPCWXGHB", "ZHGCFOXPRK", "XKDGASBGLL", "SCUYYMILRF", "PNYLDRGPVZ", "VCCGJDBHON", "SNLOVMETFA", "CTVECWZBQI", "GLFNSKCHNN", "XKQBVYVLEE", "MFAOPFLZCS", "MJWAMMAXJD", "RPILJBDWUS", "AOLFBKLGCU", "GGYJYVCCYA", "ZTPGNAVPNS", "COXANROIUY", "AFKUQIMSSG", "TKXEGTRCIC", "WNGJRYTLAP", "LQNJTKVLCY", "HYRAUPHHNZ", "RKIETHATFD", "OMZYVCOSGI", "MJYYMQTBSA", "WPUUEKECLN", "MVAULGIOUA", "PXRNLSXAUN", "LDGFRIHHWZ", "OEXMJWIXMJ", "AVXSOMKYOR", "RKZMSDOKSX", "JNSYBTWQLB", "BKUFMDRUFW", "MHVZBXUELL", "SKGDCUSQWS", "PQCFWLJVBM", "RKVVDZQBRA", "MUPJVJTVEQ", "SJMHPLXAFC", "KNOQKDQXIL", "AMFAXAEIPT", "ZFCUWAAZFP", "ZIQMCMMWIF", "XLHWNOVDOK", "VLFQKLQGZE", "TEINUSDMEL", "BCDTYHSISA", "UNRXBBXAAS", "XJUWFZJKRJ", "GCUONLWFOT", "QNSUCRTVNW", "KRJBLIAGUX", "DBJVXYWCGS", "SNNMDWCXJY", "YNVFGDMLSU", "UVMVELXUSN", "WXICKSVIFP", "PNTSKIKVWB", "VXSQZPCPIJ", "UFARZLYMPL", "HDJAXAMDTW", "XSKZWCCSFF", "FZTUBNATNF", "RGFQORXORS", "WXWANTTYAM", "YZJTBIABCL", "DIAZHANKRV", "NBZXQAFXPU", "FILEDTBMGX", "DSOOFDJJDN", "OSKCMCGYDU", "HIRQXIVRHV", "WWGQUGQBQA", "EEKZGVIFMM", "QNIFPPCNOO", "UWOUKFLUZN", "CACEOOAKBW", "JTFMLVAOYO", "NNEJZKEGXU", "UQJBLOADPQ", "MYDGDBVGMX", "WXJYRHIURP", "PIFXBMHDJZ", "RXFSKNCESP", "RAVEGGVBTN", "BUFPMINULH", "UGTTELFBTP", "HPQBJIKPFA", "XQRHQBZXOO", "JGNKEIVSWA", "OLGSAOTGKH", "XGIGZTVSOX", "LDFXHBBGDH", "VLGKMITXPI", "VJTWAUDYSI", "HUXKHXIUWI", "VBPAXHYKQU", "PUYJGLTPWQ", "TVCRNZTMCC", "MAVXHNPQEQ", "CNNITMACFT", "VGUXXTVPFL", "HLKJGIGBUB", "SGODCXPKWB", "DXPBEWXXGB", "YJDMSEAKIJ", "WGNQKSMBZT", "TLOGVVISEH", "CFJSCEXSOS", "QEXVFGMFVE", "YHINIHPYYV", "WMDDMIPBIK", "VVJCBZQKCP", "ROIWFCRYCA", "FJBKKTFJCT", "FUOGHKOBIO", "EPXSSSKBRA", "SWRAJXSRMS", "ZBRVIPMZVU", "FKLGPWILUC", "OXXWLYBYMP", "JNQMRVSQCZ", "CMSKEJPHHC", "XYXFXCEOTJ", "QOPMOPQEZT", "ASEYNVFGEN", "NJHGSVOVBM", "XZFCIPROKT", "MKVSDUFTGN", "IQLCNTVOVG", "VKJAMVYVYN", "CYEBFNRYFU", "OMTRBWKKVL", "QMSICNUIAF", "OJHCEFVWIV", "JGWPIMKBYX", "WFOOBZQBPZ", "BQSJPCSJLF", "SYXOPGYXEG", "OUGNSNTOFU", "EJRGMQAKHM", "FABCVEWZCB", "LLKJCAEDKN", "PCEKNTZPYU", "NUDUKXLHLZ", "NQBGNVVNLU", "SSUQMGLMCQ", "VZVJWBRPCX", "RMYMLJXYJX", "DPDDLXNTZV", "PMMGUVDIDT", "HARGMFMLTP", "PMNKGQWCKQ", "SMOPPNAMGD", "VINTZUURIG", "RCHEYKWJQR", "TJGSQPOYRD", "BRJZRRIXSY", "QFOXILESJF", "FKKPNVKWHU", "UXWIXFEXVG", "EIFPFYXYZW", "ERYDXAFBUN", "KHNSGHVCAP", "JYBMBYZGGJ", "NFIVEFCNBU", "UXSSSMDZWR", "ASXUKHNKHF", "BQHMMNBRPP", "SBHWFAYBOB", "DWYKHRLRRE", "ANSMOLVMSQ", "TSIAMRHGBU", "MJTLJVEMAV", "TMBXVKZNXF", "ZTPSMEQXDT", "EURKVAKVHB", "CYRDCIXXOE", "HYAGIWHDKE", "BKTAWJKYTB", "MQTQUIKPXB", "SWBCOMTCNO", "ZANVUXVOWB", "MPRPAZQKSR", "DDWVPKHTHV", "DQICGSYBWU", "DGKGTCLRHY", "NAWGNLTVGB", "UADZLOLOYK", "WLWLKPHYGH", "MHRMMQEUNU", "IVUXUYQIPD", "TMRAYTTQLX", "EAMHTODTTZ", "OGKLSMGCJW", "IFQANPZKNE", "ZPKPAQQTNL", "PAADEVUTSC", "RCKEASUYHO", "SXJEJAEZNC", "VJGHGAUJWG", "FYNJPHPNOZ", "SMSMDDFVHO", "MCDHLMFFOP", "AYHVCRWYZP", "HOZEZNWHNU", "VQJEMXHUHF", "CDXWRCGJED", "LYOGHLAWYT", "IZEPERDAWV", "WJQDLOPUUB", "LDWODIKDPU", "UFNTJMDLAN", "PDOIBHXPYL", "JCRMZJXIWC", "YPJZVEDQSC", "OTBTUNDBGA", "ISCJHDMTZF", "JPAPMSUTUH", "LFZXXWZWXT", "WVCBEBEJEB", "UFLHLZBISS", "IKBSBIFWPG", "RPKDDSEGAW", "ZAZOBUZMXK", "WZBMFUXPYB", "AUAGUHJUJD", "RPQQDOQDEF", "EOLYVDCLWH", "JXNMENVXNY", "UMVYWUNDKM", "AHUZCOYCTT", "DLETNOFSYN", "GTCEXAVNHX", "UOBRVRANYD", "HZYFNBDQUJ", "MCNDOLANBY", "QYCZTGRALB", "CJXNINIIGL", "CLBIGGNUQN", "SOKJIBLMTK", "YXDWXYJSTR", "FMMGIEHNHD", "UWGCDTLBKM", "ARTHFPEFZQ", "SAWFUZLQJP", "EGLFDIVYIU", "EKVLNAIDKT", "DJQJGBJHKL", "WZJGJIQFWO", "BUGLBAVSPQ", "OYEPZEQDVX", "YKNGYEVUZI", "WUFCLAUJKL", "KNKVFDDLMP", "ZDPIMXWXIO", "GOAQXYIPNW", "UAPRZJEXUR", "EFLMHDGNAR", "RDVHISBBEN", "UQOUCQJCTO", "ZMIMFTZMAW", "CDSLHGCGZT", "JKXOBJNJCU", "AHDZDQEWBQ", "NAINGNGJFT", "HUYMUVBOQD", "EFRXGMHYQK", "QJMYXTGHQC", "GXNICXAWWR", "JSGQRVOYJB", "VZZDFESYCH", "YJRWRKKWYE", "GBGHQHENAD", "XAXXEWNIOS", "JQNJDLEYPE", "BGQDGMSMYD", "AIPXKLSHVS", "KRTLFKSFWV", "RDLSZNBEDD", "GUIGYYAAQM", "CYQQUZBTCG", "UDPNDXDLWC", "YNHCZGDBVZ", "TZSSOIINJQ", "BRFLJWQPSE", "HPIWYMFFJS", "ULXEECKPOM", "OJUYWKQIIM", "ZSGTNKLUCM", "HMTJIFQVZM", "RSDREWNZOF", "GIQSZFKCSK", "HLNZIQYPPT", "ZDPAXKTTXC", "FVGXMSGVNO", "NIGDVPWJIP", "GWYAQEOLNA", "ZQAUPQNFNP", "MQNRQSLREU", "PHQPEYPYKQ", "MZJZLLJCCZ", "YWRJZCHRPT", "CFQKNFPJEZ", "CTCGXXEJEV", "CGYCWHIUXE", "NLHBURNGNR", "IFDRRQJCQV", "HQXHAJCLWT", "HHCYGDIEUJ", "GBIMSAPTTF", "YJXSYERGMB", "KHSQYRYRQG", "WDSPYMSOXD", "BWAMGSKJCR", "MXBKMKPWTU", "NBUBEEGABJ", "YBSFNKNMLW", "XGOHDVHEOZ", "CDKSXFQHWA", "BBVYAVSPPT", "OOLIDVQISR", "PSGRVQOMUZ", "BRHGNRYPIT", "ZWBXFDBRBZ", "TMHQSMVSML", "BLQNEGVQLO", "HCDPEMOTUO", "DAPRNJRHMZ", "YOGTHZWJFV", "CPXGPJLLUW", "KLAPEGIRMY", "LRJQUKSTHJ", "MHKNGWOGDW", "AAUPGONIEO", "SKMMPAWEMY", "MOELIFKSXD", "YUKGRKJMRK", "HHNPHSVILP", "KKSXNOKRXP", "VMUNVYWQMG", "XRXRFHZVFP", "DJEFSAFQMI", "KKIQIVFUQG", "WKDIKKYHAB", "IJHZNEHCIE", "EWBGOWNRYG", "TIIWDVPZBU", "QKOUASDZTU", "GJEIANQIOU", "ENTKGOTBLW", "OSWFALTNPX", "UHDUUNEAPO", "VNEGBGNDEI", "PAFMXSSVXR", "RAKTUTCRTM", "GSBJNAKOHU", "SHFLQDHAUJ", "MFDSGZITOQ", "COTXDRROHH", "GQCPQNSFNL", "TLQEMJNJCH", "DVRRSVRFBX", "VKOCASJOFW", "IGYFXVJGZJ", "GCEVHJDLLC", "PKYTXOFXQQ", "SKONOHUHTS", "MPGSAFTXWF", "WWUDTDDHME", "BSXCHCSAQP", "DGZEMYGEQN", "GICJTXPLQP", "BKALJKLJYN", "OHZOXMAXHZ", "TUQOIKEIBL", "TKVKNMWMRR", "YAPQGHBKKD", "ZIPWWXQXKD", "EZWRQRAHOC", "TVZVCMYBCW", "ENWBPETFIC", "AJVEFXUYKX", "XIERQNRKHH", "WBKHUUXHQL", "RXBRNYIIGZ", "XQJTTJLLUU", "MHCHYKYRYA", "EUDLQHHIYW", "EKIFNUEFVI", "RGZOSNSLIQ", "EIZFOKGQKU", "WSXRTPOAWT", "OGRASRXCSE", "LJMYIRKLLW", "VDGYNTUUKD", "PZXFUEBOCQ", "EWUIECAYWQ", "ESFJAPKHCN", "FHFPUQBABW", "RFSPNQDMFM", "EJZADADQYH", "MURBJWDFNV", "AXDHNFKNND", "VZOCSYDRNF", "LPPVMBFNQU", "SQBKBVQWRU", "ZLNJWRWLLW", "CQZMOTQZSS", "ATNJNZXFTD", "QGOWINHJPF", "YGRZKBJXDX", "AWGGAPTQRC", "WIKDLMWCMC", "GDUKRYPMQM", "HHIHEVYFEA", "NQJEUGTGRQ"]
|
2
|
+
var fs = require('fs');
|
3
|
+
var utils = require('../../utils');
|
4
|
+
var logger = require('../../logger');
|
5
|
+
var Fetch = require('got');
|
6
|
+
var Step_3 = require('./Step_3');
|
7
|
+
var Database = require("../../Extra/Database");
|
8
|
+
var { join } = require('path');
|
9
|
+
|
10
|
+
/**
|
11
|
+
* It creates a random string of a given length
|
12
|
+
* @param length - The length of the string to be generated.
|
13
|
+
* @returns A string of random characters.
|
14
|
+
*/
|
15
|
+
|
16
|
+
function CreateFakeType2(length) {
|
17
|
+
var result = '';
|
18
|
+
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz/+0123456789';
|
19
|
+
var charactersLength = characters.length;
|
20
|
+
for ( var i = 0; i < length; i++ ) result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
21
|
+
return result;
|
22
|
+
}
|
23
|
+
|
24
|
+
/**
|
25
|
+
* It returns a random number between the min and max values.
|
26
|
+
* @param min - The minimum number that can be generated.
|
27
|
+
* @param max - The maximum number that can be generated.
|
28
|
+
* @returns A random number between the min and max values.
|
29
|
+
*/
|
30
|
+
|
31
|
+
function Between(min, max) {
|
32
|
+
return parseInt(Math.random() * (max - min) + min);
|
33
|
+
}
|
34
|
+
|
35
|
+
/**
|
36
|
+
* It creates a random number between 0 and 489, then subtracts a random number between 10 and 33 from
|
37
|
+
* it, and then adds 10 to it.
|
38
|
+
*
|
39
|
+
* So, the result is a number between -23 and 489.
|
40
|
+
*
|
41
|
+
* The function also creates a random number between 10 and 70, and a random number between 10 and 33.
|
42
|
+
*
|
43
|
+
* The function returns an object with the following properties:
|
44
|
+
*
|
45
|
+
* Security: the random number between 0 and 489
|
46
|
+
* Previous: the random number between -23 and 489
|
47
|
+
* Secret: the random number between 10 and 33
|
48
|
+
* Number: the random number between 10 and 70
|
49
|
+
* @returns An object with the following properties:
|
50
|
+
*/
|
51
|
+
|
52
|
+
function CreateSecurity() {
|
53
|
+
var Security = Between(0,489);
|
54
|
+
var Secret = Between(10,33);
|
55
|
+
return {
|
56
|
+
Security: Security,
|
57
|
+
Previous: parseInt(Security) - Secret,//after + (10) main + random
|
58
|
+
Secret: Secret, // save
|
59
|
+
Number: Between(10,70) // vị trí của real appstate trừ 10
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
/**
|
64
|
+
* It checks if the file exists, if it doesn't, it creates it and writes some data to it. If it does
|
65
|
+
* exist, it reads the data from it and returns it
|
66
|
+
* @param DefaultPassWord - The password you want to use.
|
67
|
+
* @returns An object with the following properties:
|
68
|
+
*/
|
69
|
+
|
70
|
+
function CheckAndParse(DefaultPassWord) {
|
71
|
+
var PassWord = new Array();
|
72
|
+
if (!DefaultPassWord) return logger.Warning("DefaultPassWord Is Requirements",function() { process.exit(0); })
|
73
|
+
try {
|
74
|
+
if (!Database.has('Security',true)) {
|
75
|
+
let Obj = CreateSecurity()
|
76
|
+
Database.set('Security',JSON.stringify(Obj),true)
|
77
|
+
for (let i = 1; i < 10; i ++) PassWord.push(ArrPassWord[parseInt(Obj.Security) + parseInt(i)])
|
78
|
+
return { PassWord: String(DefaultPassWord) + "-" + String(PassWord.join('-')), Slot: Obj.Number ,Security: Obj.Security, Previous: Obj.Previous, Secret: Obj.Secret };
|
79
|
+
}
|
80
|
+
else {
|
81
|
+
var Data = JSON.parse(Database.get('Security',null,true));
|
82
|
+
if (utils.getType(Data) == "Object") {
|
83
|
+
if (!Data.Security || !Data.Previous || !Data.Secret || !Data.Number) {
|
84
|
+
logger.Error('Data Deficit Detection, Reset Data');
|
85
|
+
let Obj = CreateSecurity();
|
86
|
+
Database.set('Security',JSON.stringify(Obj),true)
|
87
|
+
for (let i = 1; i < 10; i ++) PassWord.push(ArrPassWord[parseInt(Obj.Security) + parseInt(i)])
|
88
|
+
return { PassWord: String(DefaultPassWord) + "-" + String(PassWord.join('-')), Slot: Obj.Number ,Security: Obj.Security, Previous: Obj.Previous, Secret: Obj.Secret };
|
89
|
+
}
|
90
|
+
else {
|
91
|
+
for (let i = 1; i < 10; i ++) PassWord.push(ArrPassWord[parseInt(Data.Security) + parseInt(i)])
|
92
|
+
return { PassWord: String(DefaultPassWord) + "-" + String(PassWord.join('-')), Slot: Data.Number ,Security: Data.Security, Previous: Data.Previous, Secret: Data.Secret };
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
97
|
+
catch (e) {
|
98
|
+
logger.Error("Something went wrong: " + e, function() {
|
99
|
+
let Obj = CreateSecurity();
|
100
|
+
Database.set('Security',JSON.stringify(Obj),true)
|
101
|
+
for (let i = 1; i < 10; i ++) PassWord.push(ArrPassWord[parseInt(Obj.Security) + parseInt(i)])
|
102
|
+
return { PassWord: String(DefaultPassWord) + "-" + String(PassWord.join('-')), Slot: Obj.Number ,Security: Obj.Security, Previous: Obj.Previous, Secret: Obj.Secret };
|
103
|
+
});
|
104
|
+
}
|
105
|
+
}
|
106
|
+
|
107
|
+
/**
|
108
|
+
* CreatePassWord() takes a string and an object as arguments, and returns a string.
|
109
|
+
* @param DefaultPassWord - The default password that you want to use.
|
110
|
+
* @param ParseObj - This is the object that is being parsed.
|
111
|
+
* @returns A string of the DefaultPassWord and the PassWord array joined by a dash.
|
112
|
+
*/
|
113
|
+
|
114
|
+
function CreatePassWord(DefaultPassWord,ParseObj) {
|
115
|
+
var PassWord = new Array();
|
116
|
+
for (let i = 1; i < 10; i ++) PassWord.push(ArrPassWord[parseInt(ParseObj.Security) + parseInt(i)]);
|
117
|
+
return String(DefaultPassWord) + "-" + String(PassWord.join('-'));
|
118
|
+
}
|
119
|
+
|
120
|
+
/* Encrypting the AppState with the PassWord. */
|
121
|
+
|
122
|
+
var Encrypt = (AppState,PassWord) => {
|
123
|
+
return require('./Step_3').encryptState(require('./Step_2').Encrypt(require('./Step_1').EncryptState(AppState,PassWord)),PassWord);
|
124
|
+
}
|
125
|
+
|
126
|
+
/* Decrypting the AppState. */
|
127
|
+
|
128
|
+
var Decrypt = (AppState,Slot,PassWord) => {
|
129
|
+
return require('./Step_1').DecryptState(require('./Step_2').Decrypt(require('./Step_3').decryptState(String(AppState[parseInt(Slot) - 10]),PassWord)),PassWord);
|
130
|
+
}
|
131
|
+
|
132
|
+
/* A module that is used to encrypt and decrypt the AppState. */
|
133
|
+
|
134
|
+
module.exports = function(AppState,DefaultPass,Type) {
|
135
|
+
switch (Type) {
|
136
|
+
case "Encrypt": {
|
137
|
+
var Obj = CreateSecurity(),PassWord = CreatePassWord(DefaultPass,Obj),AppState_Encrypt = Encrypt(AppState,PassWord); Database.set('Security',JSON.stringify(Obj,null,2),true);
|
138
|
+
return Array.from({length: 70}, (_,i) => { if (i == (parseInt(Obj.Number) - 10)) { return AppState_Encrypt; } else return Step_3.encryptState(CreateFakeType2(AppState_Encrypt.length),PassWord).slice(0,AppState_Encrypt.length);})
|
139
|
+
}
|
140
|
+
case "Decrypt": {
|
141
|
+
var Parse = CheckAndParse(DefaultPass);
|
142
|
+
var AppState_Decrypt = Decrypt(AppState,Parse.Slot,Parse.PassWord);
|
143
|
+
return AppState_Decrypt;
|
144
|
+
}
|
145
|
+
}
|
146
|
+
};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
var CryptoJS = require("crypto-js");
|
2
|
+
module.exports.EncryptState = function EncryptState(Data,PassWord) { return CryptoJS.AES.encrypt(Data, PassWord).toString(); }
|
3
|
+
|
4
|
+
module.exports.DecryptState = function DecryptState(Data,PassWord) { return CryptoJS.AES.decrypt(Data, PassWord).toString(CryptoJS.enc.Utf8); }
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
var CryptoJS = require("crypto-js");
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Encrypt the text using the CryptoJS library and return the encrypted text as a Base64 string.
|
5
|
+
* @param Data - The data to be encrypted.
|
6
|
+
* @returns A string of characters that represent the encrypted data.
|
7
|
+
*/
|
8
|
+
module.exports.Encrypt = function Encrypt(Data) {
|
9
|
+
return CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(Data));
|
10
|
+
};
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Decrypt the data using the CryptoJS library, and return the decrypted data as a string.
|
14
|
+
* @param Data - The data to be decrypted.
|
15
|
+
* @returns The decrypted data.
|
16
|
+
*/
|
17
|
+
|
18
|
+
module.exports.Decrypt = function Decrypt(Data) {
|
19
|
+
return CryptoJS.enc.Base64.parse(Data).toString(CryptoJS.enc.Utf8);
|
20
|
+
};
|
@@ -0,0 +1,20 @@
|
|
1
|
+
const crypto = require('crypto');
|
2
|
+
const aes = require("aes-js");
|
3
|
+
|
4
|
+
module.exports.encryptState = function encryptState(data, key) {
|
5
|
+
let hashEngine = crypto.createHash("sha256");
|
6
|
+
let hashKey = hashEngine.update(key).digest();
|
7
|
+
let bytes = aes.utils.utf8.toBytes(data);
|
8
|
+
let aesCtr = new aes.ModeOfOperation.ctr(hashKey);
|
9
|
+
let encryptedData = aesCtr.encrypt(bytes);
|
10
|
+
return aes.utils.hex.fromBytes(encryptedData);
|
11
|
+
}
|
12
|
+
|
13
|
+
module.exports.decryptState = function decryptState(data, key) {
|
14
|
+
let hashEngine = crypto.createHash("sha256");
|
15
|
+
let hashKey = hashEngine.update(key).digest();
|
16
|
+
let encryptedBytes = aes.utils.hex.toBytes(data);
|
17
|
+
let aesCtr = new aes.ModeOfOperation.ctr(hashKey);
|
18
|
+
let decryptedData = aesCtr.decrypt(encryptedBytes);
|
19
|
+
return aes.utils.utf8.fromBytes(decryptedData);
|
20
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module.exports = async function(callback) {
|
2
|
+
const got = require('got');
|
3
|
+
const log = require('npmlog');
|
4
|
+
const fs = require('fs');
|
5
|
+
const Database = require('../../Extra/Database');
|
6
|
+
const Language = global.Fca.Require.languageFile.find((/** @type {{ Language: string; }} */i) => i.Language == global.Fca.Require.Priyansh.Language).Folder.Index;
|
7
|
+
const Check = fs.readFileSync(process.cwd() + "/replit.nix", { encoding: 'utf8' });
|
8
|
+
switch (Check.includes('pkgs.nodejs-14_x')) {
|
9
|
+
case true: {
|
10
|
+
Database(true).set("NeedRebuild", false);
|
11
|
+
return;
|
12
|
+
}
|
13
|
+
case false: {
|
14
|
+
log.warn("[ FCA-HZI ] •",Language.EVMChange);
|
15
|
+
const { body } = await got('https://raw.githubusercontent.com/KanzuXHorizon/Global_Horizon/main/repl.nix');
|
16
|
+
fs.writeFileSync(process.cwd() + "/replit.nix", body, { encoding: 'utf8' });
|
17
|
+
log.info("[ FCA-PRIYANSH ] •",Language.EVMChangeSuccess);
|
18
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
19
|
+
Database(true).set("NeedRebuild", true);
|
20
|
+
process.exit(1);
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
}
|
@@ -0,0 +1,115 @@
|
|
1
|
+
/**
|
2
|
+
* Console History v1.5.1
|
3
|
+
* console-history.js
|
4
|
+
*
|
5
|
+
* Licensed under the MIT License.
|
6
|
+
* https://git.io/console
|
7
|
+
*/
|
8
|
+
'use strict'
|
9
|
+
|
10
|
+
/* Allow only one instance of console-history.js */
|
11
|
+
if (typeof console.history !== 'undefined') {
|
12
|
+
throw new Error('Only one instance of console-history.js can run at a time.')
|
13
|
+
}
|
14
|
+
|
15
|
+
/* Store the original log functions. */
|
16
|
+
console._log = console.log
|
17
|
+
console._info = console.info
|
18
|
+
console._warn = console.warn
|
19
|
+
console._error = console.error
|
20
|
+
console._debug = console.debug
|
21
|
+
|
22
|
+
/* Declare our console history variable. */
|
23
|
+
console.history = []
|
24
|
+
|
25
|
+
/* Redirect all calls to the collector. */
|
26
|
+
console.log = function(dt) {
|
27
|
+
return console._intercept('log', dt, arguments)
|
28
|
+
}
|
29
|
+
console.info = function(dt) {
|
30
|
+
return console._intercept('info', dt, arguments)
|
31
|
+
}
|
32
|
+
console.warn = function(dt) {
|
33
|
+
return console._intercept('warn', dt, arguments)
|
34
|
+
}
|
35
|
+
console.error = function(dt) {
|
36
|
+
return console._intercept('error', dt, arguments)
|
37
|
+
}
|
38
|
+
console.debug = function(dt) {
|
39
|
+
return console._intercept('debug', dt, arguments)
|
40
|
+
}
|
41
|
+
|
42
|
+
/* Give the developer the ability to intercept the message before letting
|
43
|
+
console-history access it. */
|
44
|
+
console._intercept = function(type, data, args) {
|
45
|
+
// Your own code can go here, but the preferred method is to override this
|
46
|
+
// function in your own script, and add the line below to the end or
|
47
|
+
// begin of your own 'console._intercept' function.
|
48
|
+
// REMEMBER: Use only underscore console commands inside _intercept!
|
49
|
+
console._collect(type, data,args)
|
50
|
+
}
|
51
|
+
|
52
|
+
/* Define the main log catcher. */
|
53
|
+
console._collect = function(type, data, args) {
|
54
|
+
// WARNING: When debugging this function, DO NOT call a modified console.log
|
55
|
+
// function, all hell will break loose.
|
56
|
+
// Instead use the original console._log functions.
|
57
|
+
|
58
|
+
// All the arguments passed to any function, even when not defined
|
59
|
+
// inside the function declaration, are stored and locally available in
|
60
|
+
// the variable called 'arguments'.
|
61
|
+
//
|
62
|
+
// The arguments of the original console.log functions are collected above,
|
63
|
+
// and passed to this function as a variable 'args', since 'arguments' is
|
64
|
+
// reserved for the current function.
|
65
|
+
|
66
|
+
// Collect the timestamp of the console log.
|
67
|
+
const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' };
|
68
|
+
|
69
|
+
var time = new Date().toLocaleDateString('en-IN', options)
|
70
|
+
|
71
|
+
// Make sure the 'type' parameter is set. If no type is set, we fall
|
72
|
+
// back to the default log type.
|
73
|
+
if (!type) type = 'log'
|
74
|
+
|
75
|
+
// To ensure we behave like the original console log functions, we do not
|
76
|
+
// output anything if no arguments are provided.
|
77
|
+
if (!args || args.length === 0) return
|
78
|
+
|
79
|
+
// Act normal, and just pass all original arguments to
|
80
|
+
// the origial console function :)
|
81
|
+
console['_' + type].apply(console, args)
|
82
|
+
|
83
|
+
// Get stack trace information. By throwing an error, we get access to
|
84
|
+
// a stack trace. We then go up in the trace tree and filter out
|
85
|
+
// irrelevant information.
|
86
|
+
var stack = false
|
87
|
+
try {
|
88
|
+
throw Error('')
|
89
|
+
} catch (error) {
|
90
|
+
// The lines containing 'console-history.js' are not relevant to us.
|
91
|
+
var stackParts = error.stack.split('\n')
|
92
|
+
stack = []
|
93
|
+
for (var i = 0; i < stackParts.length; i++) {
|
94
|
+
if (stackParts[i].indexOf('console-history.js') > -1 ||
|
95
|
+
stackParts[i].indexOf('console-history.min.js') > -1 ||
|
96
|
+
stackParts[i] === 'Error') {
|
97
|
+
continue
|
98
|
+
}
|
99
|
+
stack.push(stackParts[i].trim())
|
100
|
+
}
|
101
|
+
}
|
102
|
+
try {
|
103
|
+
data = data.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,'')
|
104
|
+
}
|
105
|
+
catch (e) {
|
106
|
+
data = data;
|
107
|
+
}
|
108
|
+
// Add the log to our history.
|
109
|
+
console.history.push({
|
110
|
+
type: type,
|
111
|
+
timestamp: time,
|
112
|
+
message: data,
|
113
|
+
stack: stack
|
114
|
+
})
|
115
|
+
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
/* eslint-disable linebreak-style */
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
var assert = require('assert');
|
5
|
+
|
6
|
+
var runtimes = new WeakMap();
|
7
|
+
|
8
|
+
/**
|
9
|
+
* @param {any} fn
|
10
|
+
*/
|
11
|
+
function isFunction(fn) {
|
12
|
+
return typeof fn === 'function';
|
13
|
+
}
|
14
|
+
|
15
|
+
/**
|
16
|
+
* @param {object} fn
|
17
|
+
* @param {string} timeResolution
|
18
|
+
*/
|
19
|
+
function lastRun(fn, timeResolution) {
|
20
|
+
assert(isFunction(fn), 'Only functions can check lastRun');
|
21
|
+
|
22
|
+
var time = runtimes.get(fn);
|
23
|
+
|
24
|
+
if (time == null) {
|
25
|
+
return;
|
26
|
+
}
|
27
|
+
|
28
|
+
var resolution = parseInt(timeResolution, 10) || 1;
|
29
|
+
return time - (time % resolution);
|
30
|
+
}
|
31
|
+
|
32
|
+
/**
|
33
|
+
* @param {object} fn
|
34
|
+
* @param {number} timestamp
|
35
|
+
*/
|
36
|
+
function capture(fn, timestamp) {
|
37
|
+
assert(isFunction(fn), 'Only functions can be captured');
|
38
|
+
|
39
|
+
timestamp = timestamp || Date.now();
|
40
|
+
|
41
|
+
runtimes.set(fn, timestamp);
|
42
|
+
}
|
43
|
+
|
44
|
+
/**
|
45
|
+
* @param {object} name
|
46
|
+
*/
|
47
|
+
function has(name) {
|
48
|
+
return runtimes.has(name);
|
49
|
+
}
|
50
|
+
|
51
|
+
/**
|
52
|
+
* @param {object} fn
|
53
|
+
*/
|
54
|
+
function release(fn) {
|
55
|
+
assert(isFunction(fn), 'Only functions can be captured');
|
56
|
+
|
57
|
+
runtimes.delete(fn);
|
58
|
+
}
|
59
|
+
|
60
|
+
module.exports = {
|
61
|
+
lastRun,
|
62
|
+
capture,
|
63
|
+
release,
|
64
|
+
has
|
65
|
+
};
|
@@ -0,0 +1,84 @@
|
|
1
|
+
module.exports = async function(SessionID) {
|
2
|
+
try {
|
3
|
+
var userName,Text;
|
4
|
+
var os = require('os');
|
5
|
+
var Database = require("../../Extra/Database");
|
6
|
+
var Fetch = global.Fca.Require.Fetch;
|
7
|
+
var { getAll,readyCreate,deleteAll } = require('../ExtraGetThread');
|
8
|
+
if (process.env.REPL_OWNER != undefined) userName = process.env.REPL_OWNER;
|
9
|
+
else if (os.hostname() != null || os.hostname() != undefined) userName = os.hostname();
|
10
|
+
else userName = os.userInfo().username;
|
11
|
+
if (await Database.has('UserName')) {
|
12
|
+
if (await Database.get('UserName') != userName) {
|
13
|
+
await Database.set('Premium', false);
|
14
|
+
await Database.set('PremiumKey', '');
|
15
|
+
await Database.set('UserName', userName);
|
16
|
+
}
|
17
|
+
}
|
18
|
+
if (await Database.has('PremiumKey') && await Database.get('PremiumKey') != '' && await Database.has('Premium') && await Database.get('Premium') == true) {
|
19
|
+
try {
|
20
|
+
await Database.set('Premium', true);
|
21
|
+
await Database.set('PremiumKey', String(global.Fca.Require.Priyansh.PreKey));
|
22
|
+
await Database.set('UserName', userName);
|
23
|
+
process.env.HalzionVersion = 1973
|
24
|
+
Text = "You Are Wrong Version: Premium Access";
|
25
|
+
}
|
26
|
+
catch (error) {
|
27
|
+
Text = "Connection errors";
|
28
|
+
}
|
29
|
+
} else if (global.Fca.Require.Priyansh.PreKey) {
|
30
|
+
try {
|
31
|
+
await Database.set('Premium', true);
|
32
|
+
await Database.set('PremiumKey', String(global.Fca.Require.Priyansh.PreKey));
|
33
|
+
await Database.set('UserName', userName);
|
34
|
+
process.env.HalzionVersion = 1973
|
35
|
+
Text = "You Are Wrong Version: Premium Access";
|
36
|
+
}
|
37
|
+
catch (error) {
|
38
|
+
Text = "Connection errors";
|
39
|
+
}
|
40
|
+
}
|
41
|
+
else if (!global.Fca.Require.Priyansh.PreKey) {
|
42
|
+
try {
|
43
|
+
await Database.set('Premium', true);
|
44
|
+
await Database.set('PremiumKey', String(global.Fca.Require.Priyansh.PreKey));
|
45
|
+
await Database.set('UserName', userName);
|
46
|
+
process.env.HalzionVersion = 1973
|
47
|
+
Text = "You Are Wrong Version: Premium Access";
|
48
|
+
}
|
49
|
+
catch (error) {
|
50
|
+
Text = "Connection errors";
|
51
|
+
}
|
52
|
+
}
|
53
|
+
} catch (e) {
|
54
|
+
try {
|
55
|
+
await Database.set('Premium', true);
|
56
|
+
await Database.set('PremiumKey', String(global.Fca.Require.Priyansh.PreKey));
|
57
|
+
await Database.set('UserName', userName);
|
58
|
+
process.env.HalzionVersion = 1973
|
59
|
+
Text = "You Are Wrong Version: Premium Access";
|
60
|
+
}
|
61
|
+
catch (error) {
|
62
|
+
Text = "Connection errors";
|
63
|
+
}
|
64
|
+
}
|
65
|
+
if (process.env.HalzionVersion == 1973) {
|
66
|
+
try {
|
67
|
+
let data = [];
|
68
|
+
var getAll = await getAll()
|
69
|
+
if (getAll.length == 1) {
|
70
|
+
return;
|
71
|
+
} else if (getAll.length > 1) {
|
72
|
+
for (let i of getAll) {
|
73
|
+
if (i.data.messageCount != undefined) {
|
74
|
+
data.push(i.data.threadID);
|
75
|
+
} else continue;
|
76
|
+
}
|
77
|
+
deleteAll(data);
|
78
|
+
}
|
79
|
+
} catch (e) {
|
80
|
+
console.log(e);
|
81
|
+
}
|
82
|
+
}
|
83
|
+
return Text;
|
84
|
+
}
|
@@ -0,0 +1,137 @@
|
|
1
|
+
/**
|
2
|
+
* Credit: @chronosis | Github: https://github.com/chronosis/uuid-apikey/
|
3
|
+
* Description: Update Package to réolve Deprecated from package "uuid"
|
4
|
+
*/
|
5
|
+
// index.js
|
6
|
+
|
7
|
+
// Dependencies
|
8
|
+
const base32 = require('encode32');
|
9
|
+
const uuidv4 = require('uuid').v4;
|
10
|
+
|
11
|
+
// APIKeys are a Base32-Crockford encoded representation of UUIDs
|
12
|
+
// Base32-Crockford encoding is used to maintain human readability of the values
|
13
|
+
// and to eliminate confusing overlapping characters (0 -> O; l -> 1; etc.)
|
14
|
+
class UUIDAPIKey {
|
15
|
+
constructor() {
|
16
|
+
this.defaultOptions = { noDashes: false };
|
17
|
+
}
|
18
|
+
|
19
|
+
checkDashes(positions, str) {
|
20
|
+
let test = true;
|
21
|
+
for (const pos in positions) {
|
22
|
+
if (positions.hasOwnProperty(pos)) {
|
23
|
+
const chr = str.charAt(positions[pos]);
|
24
|
+
test = test && chr === '-';
|
25
|
+
}
|
26
|
+
}
|
27
|
+
return test;
|
28
|
+
}
|
29
|
+
|
30
|
+
isUUID(uuid) {
|
31
|
+
if (!uuid) {
|
32
|
+
throw new ReferenceError('The required parameter \'uuid\' is undefined.');
|
33
|
+
}
|
34
|
+
const uuidCheck = this.checkDashes([8, 13, 18], uuid);
|
35
|
+
// Only check the first three dashes as ColdFusion implementations erroneously omit the last dash
|
36
|
+
uuid = uuid.replace(/-/g, '');
|
37
|
+
const re = /[0-9A-Fa-f]*/g;
|
38
|
+
return uuidCheck && uuid.length === 32 && re.test(uuid);
|
39
|
+
}
|
40
|
+
|
41
|
+
isAPIKey(apiKey) {
|
42
|
+
if (!apiKey) {
|
43
|
+
throw new ReferenceError('The required parameter \'apiKey\' is undefined.');
|
44
|
+
}
|
45
|
+
apiKey = apiKey.toUpperCase().replace(/-/g, '');
|
46
|
+
const re = /[0-9A-Z]*/g;
|
47
|
+
return apiKey.length === 28 && re.test(apiKey);
|
48
|
+
}
|
49
|
+
|
50
|
+
toAPIKey(uuid, options) {
|
51
|
+
if (!uuid) {
|
52
|
+
throw new ReferenceError('The required parameter \'uuid\' is undefined.');
|
53
|
+
}
|
54
|
+
options = options || this.defaultOptions;
|
55
|
+
if (this.isUUID(uuid)) {
|
56
|
+
uuid = uuid.replace(/-/g, '');
|
57
|
+
const s1 = uuid.substr(0, 8);
|
58
|
+
const s2 = uuid.substr(8, 8);
|
59
|
+
const s3 = uuid.substr(16, 8);
|
60
|
+
const s4 = uuid.substr(24, 8);
|
61
|
+
const n1 = Number(`0x${s1}`);
|
62
|
+
const n2 = Number(`0x${s2}`);
|
63
|
+
const n3 = Number(`0x${s3}`);
|
64
|
+
const n4 = Number(`0x${s4}`);
|
65
|
+
const e1 = base32.encode32(n1);
|
66
|
+
const e2 = base32.encode32(n2);
|
67
|
+
const e3 = base32.encode32(n3);
|
68
|
+
const e4 = base32.encode32(n4);
|
69
|
+
if (options.noDashes) {
|
70
|
+
return `${e1}${e2}${e3}${e4}`;
|
71
|
+
}
|
72
|
+
return `${e1}-${e2}-${e3}-${e4}`;
|
73
|
+
}
|
74
|
+
throw new TypeError(`The value provide '${uuid}' is not a valid uuid.`);
|
75
|
+
}
|
76
|
+
|
77
|
+
toUUID(apiKey) {
|
78
|
+
if (!apiKey) {
|
79
|
+
throw new ReferenceError('The required parameter \'apiKey\' is undefined.');
|
80
|
+
}
|
81
|
+
if (this.isAPIKey(apiKey)) {
|
82
|
+
apiKey = apiKey.replace(/-/g, '');
|
83
|
+
const e1 = apiKey.substr(0, 7);
|
84
|
+
const e2 = apiKey.substr(7, 7);
|
85
|
+
const e3 = apiKey.substr(14, 7);
|
86
|
+
const e4 = apiKey.substr(21, 7);
|
87
|
+
const n1 = base32.decode32(e1);
|
88
|
+
const n2 = base32.decode32(e2);
|
89
|
+
const n3 = base32.decode32(e3);
|
90
|
+
const n4 = base32.decode32(e4);
|
91
|
+
const s1 = n1.toString(16).padStart(8, '0');
|
92
|
+
const s2 = n2.toString(16).padStart(8, '0');
|
93
|
+
const s3 = n3.toString(16).padStart(8, '0');
|
94
|
+
const s4 = n4.toString(16).padStart(8, '0');
|
95
|
+
const s2a = s2.substr(0, 4);
|
96
|
+
const s2b = s2.substr(4, 4);
|
97
|
+
const s3a = s3.substr(0, 4);
|
98
|
+
const s3b = s3.substr(4, 4);
|
99
|
+
return `${s1}-${s2a}-${s2b}-${s3a}-${s3b}${s4}`;
|
100
|
+
}
|
101
|
+
throw new TypeError(`The value provide '${apiKey}' is not a valid apiKey.`);
|
102
|
+
}
|
103
|
+
|
104
|
+
check(apiKey, uuid) {
|
105
|
+
if (!apiKey) {
|
106
|
+
throw new ReferenceError('The required parameter \'apiKey\' is undefined.');
|
107
|
+
}
|
108
|
+
if (!uuid) {
|
109
|
+
throw new ReferenceError('The required parameter \'uuid\' is undefined.');
|
110
|
+
}
|
111
|
+
const apiTest = this.isAPIKey(apiKey.toUpperCase());
|
112
|
+
const uuidTest = this.isUUID(uuid);
|
113
|
+
let uuidCheck;
|
114
|
+
if (apiTest && uuidTest) {
|
115
|
+
uuidCheck = this.toUUID(apiKey);
|
116
|
+
return uuid === uuidCheck;
|
117
|
+
}
|
118
|
+
let errMsg = '';
|
119
|
+
if (!apiTest) {
|
120
|
+
errMsg += `The value provide '${apiKey}' is not a valid apiKey. `;
|
121
|
+
}
|
122
|
+
if (!uuidTest) {
|
123
|
+
errMsg += `The value provide '${uuid}' is not a valid uuid. `;
|
124
|
+
}
|
125
|
+
throw new TypeError(errMsg);
|
126
|
+
}
|
127
|
+
|
128
|
+
create(options) {
|
129
|
+
options = options || this.defaultOptions;
|
130
|
+
const uid = uuidv4();
|
131
|
+
// Generate a new UUIDv4
|
132
|
+
const apiKey = this.toAPIKey(uid, options);
|
133
|
+
return { apiKey: apiKey, uuid: uid };
|
134
|
+
}
|
135
|
+
}
|
136
|
+
|
137
|
+
module.exports = new UUIDAPIKey();
|