diff --git a/.deepsource.toml b/.deepsource.toml deleted file mode 100644 index c48f8c4..0000000 --- a/.deepsource.toml +++ /dev/null @@ -1,9 +0,0 @@ -version = 1 - -[[analyzers]] -name = "javascript" -enabled = true - -[[transformers]] -name = "standardjs" -enabled = true \ No newline at end of file diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index dc54c10..8afc379 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -10,4 +10,4 @@ liberapay: # Replace with a single Liberapay username issuehunt: # Replace with a single IssueHunt username otechie: # Replace with a single Otechie username lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry -custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] +custom: ['https://www.buymeacoffee.com/mazkdevf'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/LICENSE b/LICENSE index 5849551..92503a7 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,93 @@ -MIT License - -Copyright (c) 2022 KeyAuth - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +Elastic License 2.0 + +URL: https://www.elastic.co/licensing/elastic-license + +## Acceptance + +By using the software, you agree to all of the terms and conditions below. + +## Copyright License + +The licensor grants you a non-exclusive, royalty-free, worldwide, +non-sublicensable, non-transferable license to use, copy, distribute, make +available, and prepare derivative works of the software, in each case subject to +the limitations and conditions below. + +## Limitations + +You may not provide the software to third parties as a hosted or managed +service, where the service provides users with access to any substantial set of +the features or functionality of the software. + +You may not move, change, disable, or circumvent the license key functionality +in the software, and you may not remove or obscure any functionality in the +software that is protected by the license key. + +You may not alter, remove, or obscure any licensing, copyright, or other notices +of the licensor in the software. Any use of the licensor’s trademarks is subject +to applicable law. + +## Patents + +The licensor grants you a license, under any patent claims the licensor can +license, or becomes able to license, to make, have made, use, sell, offer for +sale, import and have imported the software, in each case subject to the +limitations and conditions in this license. This license does not cover any +patent claims that you cause to be infringed by modifications or additions to +the software. If you or your company make any written claim that the software +infringes or contributes to infringement of any patent, your patent license for +the software granted under these terms ends immediately. If your company makes +such a claim, your patent license ends immediately for work on behalf of your +company. + +## Notices + +You must ensure that anyone who gets a copy of any part of the software from you +also gets a copy of these terms. + +If you modify the software, you must include in any modified copies of the +software prominent notices stating that you have modified the software. + +## No Other Rights + +These terms do not imply any licenses other than those expressly granted in +these terms. + +## Termination + +If you use the software in violation of these terms, such use is not licensed, +and your licenses will automatically terminate. If the licensor provides you +with a notice of your violation, and you cease all violation of this license no +later than 30 days after you receive that notice, your licenses will be +reinstated retroactively. However, if you violate these terms after such +reinstatement, any additional violation of these terms will cause your licenses +to terminate automatically and permanently. + +## No Liability + +*As far as the law allows, the software comes as is, without any warranty or +condition, and the licensor will not be liable to you for any damages arising +out of these terms or the use or nature of the software, under any kind of +legal claim.* + +## Definitions + +The **licensor** is the entity offering these terms, and the **software** is the +software the licensor makes available under these terms, including any portion +of it. + +**you** refers to the individual or entity agreeing to these terms. + +**your company** is any legal entity, sole proprietorship, or other kind of +organization that you work for, plus all organizations that have control over, +are under the control of, or are under common control with that +organization. **control** means ownership of substantially all the assets of an +entity, or the power to direct its management and policies by vote, contract, or +otherwise. Control can be direct or indirect. + +**your licenses** are all the licenses granted to you for the software under +these terms. + +**use** means anything you do with the software requiring one of your licenses. + +**trademark** means trademarks, service marks, and similar rights. \ No newline at end of file diff --git a/README.md b/README.md index dec9ec7..bb21189 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,6 @@ #### **KeyAuth 1.1 API EndPoint Example** **[Redirect to Example Project](./src/API1.1/)** -#### **KeyAuth 1.2 API --> NOT OUT YET <--** -**[Redirect to Example Project](./src/API1.2/)** - - ### **Contributing** If you are interested with Contributing on this project open an issue and we will discuss with it, or you can also open a pull request and we will review it. If your pull request is Good, and Perfect without any issues we will merge it. @@ -24,9 +20,20 @@ If you are interested with Contributing on this project open an issue and we wil Also before Pull Requesting make sure you have Tested your code so that it works. -### **License** -This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details +## Copyright License + +KeyAuth is licensed under **Elastic License 2.0** + +* You may not provide the software to third parties as a hosted or managed +service, where the service provides users with access to any substantial set of +the features or functionality of the software. + +* You may not move, change, disable, or circumvent the license key functionality +in the software, and you may not remove or obscure any functionality in the +software that is protected by the license key. -- Do not Sell this Example Code to anyone, this is Open Source and Free to use example on **[KeyAuth](https://github.com/keyauth)**, This doesn't mean that you cannot sell your application, just go a head! +* You may not alter, remove, or obscure any licensing, copyright, or other notices +of the licensor in the software. Any use of the licensor’s trademarks is subject +to applicable law. -- Requirements for using this example is to have a KeyAuth Account, and a KeyAuth Application. Also **[NodeJS](https://nodejs.org/en/download/)** is Required to run this. +Thank you for your compliance, we work hard on the development of KeyAuth and do not appreciate our copyright being infringed. diff --git a/src/API1.0/KeyAuth.js b/src/API1.0/KeyAuth.js index 41dc856..d7401f8 100644 --- a/src/API1.0/KeyAuth.js +++ b/src/API1.0/KeyAuth.js @@ -13,6 +13,9 @@ const axios = require('axios') //* Importing OS *// const os = require('os') +//* Import FS *// +const fs = require("fs") + //* KeyAuth Class *// class KeyAuth { /** @@ -21,7 +24,7 @@ class KeyAuth { * @param {string} [secret] - The secret of the application * @param {string} [version] - The version of the application **/ - constructor (name, ownerId, secret, version) { + constructor(name, ownerId, secret, version) { if (!(name && ownerId && secret && version)) { Misc.error('Application not setup correctly.') } @@ -30,6 +33,7 @@ class KeyAuth { this.ownerId = ownerId this.secret = secret this.version = version + this.responseTime = null }; /** @@ -49,8 +53,9 @@ class KeyAuth { init_iv } - let response = await make_request(post_data) + let response = await this.make_request(post_data) response = Encryption.decrypt(response, this.secret, init_iv) + if (response === 'KeyAuth_Invalid') { Misc.error('Invalid Application, please check your application details.') @@ -77,7 +82,7 @@ class KeyAuth { * @param {string} [password] - The password for the user * @param {string} [license] - The License Key for the sub **/ - register = (user, password, license) => new Promise(async (resolve) => { + register = (user, password, license, email = "") => new Promise(async (resolve) => { this.check_initialize() let hwId @@ -91,6 +96,7 @@ class KeyAuth { type: Buffer.from('register').toString('hex'), username: Encryption.encrypt(user, this.EncKey, init_iv), pass: Encryption.encrypt(password, this.EncKey, init_iv), + email: Encryption.encrypt(email, this.EncKey, init_iv), key: Encryption.encrypt(license, this.EncKey, init_iv), hwid: Encryption.encrypt(hwId, this.EncKey, init_iv), sessionid: Buffer.from(this.sessionid).toString('hex'), @@ -99,7 +105,7 @@ class KeyAuth { init_iv } - let response = await make_request(post_data) + let response = await this.make_request(post_data) response = Encryption.decrypt(response, this.EncKey, init_iv) const Json = JSON.parse(response) @@ -113,6 +119,30 @@ class KeyAuth { } }) + forgot = (username, email) => new Promise(async (resolve) => { + this.check_initialize() + + const init_iv = createHash('sha256').update(uuid().substring(0, 8)).digest('hex') + + const post_data = { + type: Buffer.from('forgot').toString('hex'), + username: Encryption.encrypt(username, this.EncKey, init_iv), + email: Encryption.encrypt(email, this.EncKey, init_iv), + sessionid: Buffer.from(this.sessionid).toString('hex'), + name: Buffer.from(this.name).toString('hex'), + ownerid: Buffer.from(this.ownerId).toString('hex'), + init_iv + } + + let response = await this.make_request(post_data) + response = Encryption.decrypt(response, this.EncKey, init_iv) + + const Json = JSON.parse(response) + + this.Load_Response_Struct(Json) + resolve(Json?.success ? true : false) + }) + /** * Authenticates the user using their username and password * @param {string} [username] - The username for the user @@ -139,7 +169,7 @@ class KeyAuth { init_iv } - let response = await make_request(post_data) + let response = await this.make_request(post_data) response = Encryption.decrypt(response, this.EncKey, init_iv) const Json = JSON.parse(response) @@ -179,7 +209,7 @@ class KeyAuth { init_iv } - let response = await make_request(post_data) + let response = await this.make_request(post_data) response = Encryption.decrypt(response, this.EncKey, init_iv) const Json = JSON.parse(response) @@ -213,7 +243,7 @@ class KeyAuth { init_iv } - let response = await make_request(post_data) + let response = await this.make_request(post_data) response = Encryption.decrypt(response, this.EncKey, init_iv) const Json = JSON.parse(response) @@ -246,7 +276,7 @@ class KeyAuth { init_iv } - let response = await make_request(post_data) + let response = await this.make_request(post_data) response = Encryption.decrypt(response, this.EncKey, init_iv) const Json = JSON.parse(response) @@ -278,7 +308,7 @@ class KeyAuth { init_iv } - let response = await make_request(post_data) + let response = await this.make_request(post_data) response = Encryption.decrypt(response, this.EncKey, init_iv) const Json = JSON.parse(response) @@ -311,7 +341,7 @@ class KeyAuth { init_iv } - let response = await make_request(post_data) + let response = await this.make_request(post_data) response = Encryption.decrypt(response, this.EncKey, init_iv) const Json = JSON.parse(response) @@ -340,7 +370,7 @@ class KeyAuth { init_iv } - let response = await make_request(post_data) + let response = await this.make_request(post_data) response = Encryption.decrypt(response, this.EncKey, init_iv) const Json = JSON.parse(response) @@ -358,7 +388,7 @@ class KeyAuth { * @Param {string} [fileId] - File ID * returns {byte} - Returns The bytes of the download file **/ - file = (fileId) => new Promise(async (resolve) => { + file = (fileId, path = null, execute = false) => new Promise(async (resolve) => { this.check_initialize() const init_iv = createHash('sha256').update(uuid().substring(0, 8)).digest('hex') @@ -372,14 +402,35 @@ class KeyAuth { init_iv } - let response = await make_request(post_data) + let response = await this.make_request(post_data) response = Encryption.decrypt(response, this.EncKey, init_iv) const Json = JSON.parse(response) this.Load_Response_Struct(Json) if (Json.success && Json.success == true) { - return resolve(Buffer.from(Json.contents, 'hex').toString('utf-8')) + if (path != null) { + var bytes = await this.strToByteArray(Json.contents); + fs.writeFile(path, bytes, async (err) => { + if (err) throw err; + + if (execute) { + var exec = require('child_process').exec; + await exec(path, function (error, stdout, stderr) { + if (error) { + console.error(error); + return; + } + }); + + return resolve(true); + } else { + return resolve(true); + } + }); + } else { + return resolve(this.strToByteArray(Json.contents)) + } } resolve(Json.message) @@ -410,7 +461,7 @@ class KeyAuth { init_iv } - let response = await make_request(post_data) + let response = await this.make_request(post_data) response = Encryption.decrypt(response, this.EncKey, init_iv) const Json = JSON.parse(response) @@ -440,7 +491,7 @@ class KeyAuth { init_iv } - let response = await make_request(post_data) + let response = await this.make_request(post_data) response = Encryption.decrypt(response, this.EncKey, init_iv) const Json = JSON.parse(response) @@ -472,7 +523,7 @@ class KeyAuth { init_iv } - let response = await make_request(post_data) + let response = await this.make_request(post_data) response = Encryption.decrypt(response, this.EncKey, init_iv) const Json = JSON.parse(response) @@ -503,7 +554,7 @@ class KeyAuth { init_iv } - let response = await make_request(post_data) + let response = await this.make_request(post_data) response = Encryption.decrypt(response, this.EncKey, init_iv) const Json = JSON.parse(response) @@ -535,7 +586,7 @@ class KeyAuth { init_iv } - let response = await make_request(post_data) + let response = await this.make_request(post_data) response = Encryption.decrypt(response, this.EncKey, init_iv) const Json = JSON.parse(response) @@ -573,7 +624,7 @@ class KeyAuth { init_iv } - let response = await make_request(post_data) + let response = await this.make_request(post_data) response = Encryption.decrypt(response, this.EncKey, init_iv) const Json = JSON.parse(response) @@ -606,15 +657,29 @@ class KeyAuth { init_iv } - await make_request(post_data) + await this.make_request(post_data) resolve(true) }) + strToByteArray = (hex) => new Promise(async (resolve) => { + try { + const numberChars = hex.length; + const bytes = new Uint8Array(numberChars / 2); + for (let i = 0; i < numberChars; i += 2) { + bytes[i / 2] = parseInt(hex.substr(i, 2), 16); + } + resolve(bytes) + } catch (err) { + console.error('The session has ended, open program again.'); + process.exit(0); + } + }) + /** * Check if the current session is initialized * @returns [true] if client is Initialized. **/ - check_initialize () { + check_initialize() { if (!this.initialized) { Misc.error('You must initialize the API before using it!') } @@ -624,7 +689,7 @@ class KeyAuth { /** * Load the response struct for Response of Request **/ - Load_Response_Struct (data) { + Load_Response_Struct(data) { this.response = { success: data.success, message: data.message @@ -634,7 +699,7 @@ class KeyAuth { /** * Load the response struct for User Data **/ - Load_User_Data (data) { + Load_User_Data(data) { this.user_data = { username: data.username, ip: data.ip, @@ -650,7 +715,7 @@ class KeyAuth { * @param {string} [title] - Your new Title for the App * Returns Promise Timeout **/ - setTitle (title) { + setTitle(title) { process.stdout.write( String.fromCharCode(27) + ']0;' + title + String.fromCharCode(7) ) @@ -661,11 +726,40 @@ class KeyAuth { * @param {number} [ms] - Time in milliseconds * Returns Promise Timeout **/ - sleep (ms) { + sleep(ms) { return new Promise((resolve) => { setTimeout(resolve, ms) }) } + + /** + * Request the API with the POST Data + * @param {string} [data] - Post Data Array + * Returns {array} - Returns the API Response [ENCRYPTED] + **/ + make_request(data) { + const startTime = Date.now(); // Start the stopwatch + + return new Promise(async (resolve) => { + const request = await axios({ + method: 'POST', + url: 'https://keyauth.win/api/1.0/', + data: new URLSearchParams(data).toString() + }).catch((err) => { + Misc.error(err) + }) + + const endTime = Date.now(); // Stop the stopwatch + + this.responseTime = `${endTime - startTime} ms`; + + if (request && request.data) { + resolve(request.data) + } else { + resolve(null) + }; + }) + } } class Encryption { @@ -676,7 +770,7 @@ class Encryption { * @param {string} [iv] - IV to encrypt with * Returns {string} - Returns the encrypted string **/ - static encrypt (message, enc_key, iv) { + static encrypt(message, enc_key, iv) { try { const _key = createHash('sha256').update(enc_key).digest('hex').substring(0, 32) @@ -688,7 +782,7 @@ class Encryption { } }; - static encrypt_string (plain_text, key, iv) { + static encrypt_string(plain_text, key, iv) { const Cipher = createCipheriv('aes-256-cbc', key, iv) let Crypto_Cipher = Cipher.update(plain_text, 'utf-8', 'hex') Crypto_Cipher += Cipher.final('hex') @@ -702,7 +796,7 @@ class Encryption { * @param {string} [iv] - IV to decrypt with * Returns {string} - Returns the decrypted string **/ - static decrypt (message, key, iv) { + static decrypt(message, key, iv) { try { const _key = createHash('sha256').update(key).digest('hex').substring(0, 32) @@ -714,7 +808,7 @@ class Encryption { } }; - static decrypt_string (cipher_text, key, iv) { + static decrypt_string(cipher_text, key, iv) { const Decrypt_Cipher = createDecipheriv('aes-256-cbc', key, iv) let Decrypted = Decrypt_Cipher.update(cipher_text, 'hex', 'utf-8') Decrypted += Decrypt_Cipher.final('utf-8') @@ -727,7 +821,7 @@ class Misc { * Get the current user HardwareId * @returns {string} - Returns user HardwareID **/ - static GetCurrentHardwareId () { + static GetCurrentHardwareId() { if (os.platform() != 'win32') return false const cmd = execSync('wmic useraccount where name="%username%" get sid').toString('utf-8') @@ -740,35 +834,12 @@ class Misc { * Error Print Function * @param {string} [message] - Message to Show and then exit app. **/ - static error (message) { + static error(message) { console.log(message) return process.exit(0) } } -/** - * Request the API with the POST Data - * @param {string} [data] - Post Data Array - * Returns {array} - Returns the API Response [ENCRYPTED] -**/ -function make_request (data) { - return new Promise(async (resolve) => { - const request = await axios({ - method: 'POST', - url: 'https://keyauth.win/api/1.0/', - data: new URLSearchParams(data).toString() - }).catch((err) => { - Misc.error(err) - }) - - if (request && request.data) { - resolve(request.data) - } else { - resolve(null) - } - }) -} - /** * Export KeyAuth Class to be used in other files **/ diff --git a/src/API1.0/LICENSE b/src/API1.0/LICENSE index 9d2b03e..9bfa6db 100644 --- a/src/API1.0/LICENSE +++ b/src/API1.0/LICENSE @@ -1,21 +1,93 @@ -MIT License - -Copyright (c) 2022 KeyAuth - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +Elastic License 2.0 + +URL: https://www.elastic.co/licensing/elastic-license + +## Acceptance + +By using the software, you agree to all of the terms and conditions below. + +## Copyright License + +The licensor grants you a non-exclusive, royalty-free, worldwide, +non-sublicensable, non-transferable license to use, copy, distribute, make +available, and prepare derivative works of the software, in each case subject to +the limitations and conditions below. + +## Limitations + +You may not provide the software to third parties as a hosted or managed +service, where the service provides users with access to any substantial set of +the features or functionality of the software. + +You may not move, change, disable, or circumvent the license key functionality +in the software, and you may not remove or obscure any functionality in the +software that is protected by the license key. + +You may not alter, remove, or obscure any licensing, copyright, or other notices +of the licensor in the software. Any use of the licensor’s trademarks is subject +to applicable law. + +## Patents + +The licensor grants you a license, under any patent claims the licensor can +license, or becomes able to license, to make, have made, use, sell, offer for +sale, import and have imported the software, in each case subject to the +limitations and conditions in this license. This license does not cover any +patent claims that you cause to be infringed by modifications or additions to +the software. If you or your company make any written claim that the software +infringes or contributes to infringement of any patent, your patent license for +the software granted under these terms ends immediately. If your company makes +such a claim, your patent license ends immediately for work on behalf of your +company. + +## Notices + +You must ensure that anyone who gets a copy of any part of the software from you +also gets a copy of these terms. + +If you modify the software, you must include in any modified copies of the +software prominent notices stating that you have modified the software. + +## No Other Rights + +These terms do not imply any licenses other than those expressly granted in +these terms. + +## Termination + +If you use the software in violation of these terms, such use is not licensed, +and your licenses will automatically terminate. If the licensor provides you +with a notice of your violation, and you cease all violation of this license no +later than 30 days after you receive that notice, your licenses will be +reinstated retroactively. However, if you violate these terms after such +reinstatement, any additional violation of these terms will cause your licenses +to terminate automatically and permanently. + +## No Liability + +*As far as the law allows, the software comes as is, without any warranty or +condition, and the licensor will not be liable to you for any damages arising +out of these terms or the use or nature of the software, under any kind of +legal claim.* + +## Definitions + +The **licensor** is the entity offering these terms, and the **software** is the +software the licensor makes available under these terms, including any portion +of it. + +**you** refers to the individual or entity agreeing to these terms. + +**your company** is any legal entity, sole proprietorship, or other kind of +organization that you work for, plus all organizations that have control over, +are under the control of, or are under common control with that +organization. **control** means ownership of substantially all the assets of an +entity, or the power to direct its management and policies by vote, contract, or +otherwise. Control can be direct or indirect. + +**your licenses** are all the licenses granted to you for the software under +these terms. + +**use** means anything you do with the software requiring one of your licenses. + +**trademark** means trademarks, service marks, and similar rights. \ No newline at end of file diff --git a/src/API1.0/README.md b/src/API1.0/README.md index 17ac930..81f9d63 100644 --- a/src/API1.0/README.md +++ b/src/API1.0/README.md @@ -34,7 +34,12 @@ await KeyAuthApp.login("", ""); ###### **Register** ```js -await KeyAuthApp.register("", "", "") +await KeyAuthApp.register("", "", "", "") +``` + +###### **Forgot** +```js +await KeyAuthApp.forgot("", ""); ``` ###### **License Login** diff --git a/src/API1.0/index.js b/src/API1.0/index.js index bf8064a..aafb63e 100644 --- a/src/API1.0/index.js +++ b/src/API1.0/index.js @@ -1,17 +1,15 @@ const KeyAuth = require('./KeyAuth'); const readline = require("readline"); const moment = require("moment"); - const CRL = readline.createInterface({ input: process.stdin, output: process.stdout }); const KeyAuthApp = new KeyAuth( - '', // Application Name - '', // Application OwnerId - '', // Application Secret - '1.0' // Application Version + "", // Application Name + "", // OwnerID + "", // Application Secret + "1.0" // Application Version ); - (async () => { await KeyAuthApp.Initialize(); @@ -21,15 +19,10 @@ const KeyAuthApp = new KeyAuth( console.log(` Number of keys: ${KeyAuthApp.app_data.numKeys}`); console.log(` Application Version: ${KeyAuthApp.app_data.version}`); console.log(` Customer panel link: ${KeyAuthApp.app_data.customerPanelLink}\n`); - await KeyAuthApp.check(); - await KeyAuthApp.sleep(1200); - console.log( - ` Current Session Validation Status: ${KeyAuthApp.response.message}` - ); - var username, password, license = ""; + var username, password, license, email = ""; - await CRL.question("\n [1] Login\n [2] Register\n [3] Upgrade\n [4] License key only\n\n Choose option: ", async (option) => { + await CRL.question("\n [1] Login\n [2] Register\n [3] Upgrade\n [4] License key only\n [5] Forgot password\n\n Choose option: ", async (option) => { option = await parseInt(option); switch (option) { @@ -51,9 +44,12 @@ const KeyAuthApp = new KeyAuth( password = pass; await CRL.question(" Whats your License: ", async (lic) => { license = lic; - await KeyAuthApp.register(username, password, license); - Dashboard(); - CRL.close(); + await CRL.question(" Whats your email (leave empty if none will be set) ", async (email_) => { + email = email_; + await KeyAuthApp.register(username, password, license, email); + Dashboard(); + CRL.close(); + }); }); }); }); @@ -79,6 +75,17 @@ const KeyAuthApp = new KeyAuth( } ); break; + case 5: + await CRL.question("\n Whats your username: ", async (username_) => { + username = username_; + await CRL.question("\n Whats your email: ", async (email_) => { + email = email_; + await KeyAuthApp.forgot(username, email); + console.log(KeyAuthApp.response.message); + process.exit(0); + }); + }); + break; default: console.log("Invalid option"); CRL.close(); @@ -115,13 +122,8 @@ const KeyAuthApp = new KeyAuth( ); } - KeyAuthApp.check(); - console.log( - ` Current Session Validation Status: ${KeyAuthApp.response.message}` - ); - - console.log("\n\n Closing in 10 seconds..."); - await KeyAuthApp.sleep(10000); + console.log("\n\n Closing in 5 seconds..."); + await KeyAuthApp.sleep(5000); process.exit(0); } diff --git a/src/API1.0/package.json b/src/API1.0/package.json index 78a358d..957ef27 100644 --- a/src/API1.0/package.json +++ b/src/API1.0/package.json @@ -28,7 +28,7 @@ "uuid": "^8.3.2" }, "author": "mazkdevf ", - "license": "ISC", + "license": "Elastic License 2.0", "bugs": { "url": "https://github.com/mazkdevf/KeyAuth-JS-Example/issues" }, diff --git a/src/API1.1/KeyAuth.js b/src/API1.1/KeyAuth.js index 3c68ff8..5c1561a 100644 --- a/src/API1.1/KeyAuth.js +++ b/src/API1.1/KeyAuth.js @@ -7,6 +7,9 @@ const axios = require('axios') //* Importing OS *// const os = require('os') +//* Import FS *// +const fs = require("fs") + //* KeyAuth Class *// class KeyAuth { /** @@ -15,7 +18,7 @@ class KeyAuth { * @param {string} [secret] - The secret of the application * @param {string} [version] - The version of the application **/ - constructor (name, ownerId, secret, version) { + constructor(name, ownerId, secret, version) { if (!(name && ownerId && secret && version)) { Misc.error('Application not setup correctly.') } @@ -24,6 +27,7 @@ class KeyAuth { this.ownerId = ownerId this.secret = secret this.version = version + this.responseTime = null; }; /** @@ -37,7 +41,7 @@ class KeyAuth { ownerid: this.ownerId } - const Json = await make_request(post_data) + const Json = await this.make_request(post_data) if (Json === 'KeyAuth_Invalid') { Misc.error('Invalid Application, please check your application details.') @@ -61,7 +65,7 @@ class KeyAuth { * @param {string} [password] - The password for the user * @param {string} [license] - The License Key for the sub **/ - register = (user, password, license) => new Promise(async (resolve) => { + register = (user, password, license, email = "") => new Promise(async (resolve) => { this.check_initialize() let hwId @@ -73,6 +77,7 @@ class KeyAuth { type: 'register', username: user, pass: password, + email, key: license, hwid: hwId, sessionid: this.sessionid, @@ -80,7 +85,7 @@ class KeyAuth { ownerid: this.ownerId } - const Json = await make_request(post_data) + const Json = await this.make_request(post_data) this.Load_Response_Struct(Json) if (Json.success) { @@ -91,6 +96,23 @@ class KeyAuth { } }) + forgot = (username, email) => new Promise(async (resolve) => { + this.check_initialize() + + const post_data = { + type: 'forgot', + username, + email, + sessionid: this.sessionid, + name: this.name, + ownerid: this.ownerId + } + + const Json = await this.make_request(post_data) + + this.Load_Response_Struct(Json) + }); + /** * Authenticates the user using their username and password * @param {string} [username] - The username for the user @@ -114,7 +136,7 @@ class KeyAuth { ownerid: this.ownerId } - const Json = await make_request(post_data) + const Json = await this.make_request(post_data) this.Load_Response_Struct(Json) if (Json.success && Json.success == true) { @@ -146,7 +168,7 @@ class KeyAuth { ownerid: this.ownerId } - const Json = await make_request(post_data) + const Json = await this.make_request(post_data) this.Load_Response_Struct(Json) if (Json.success && Json.success == true) { @@ -174,7 +196,7 @@ class KeyAuth { ownerid: this.ownerId } - const Json = await make_request(post_data) + const Json = await this.make_request(post_data) this.Load_Response_Struct(Json) if (!Json.success || Json.success == false) { @@ -201,7 +223,7 @@ class KeyAuth { ownerid: this.ownerId } - const Json = await make_request(post_data) + const Json = await this.make_request(post_data) this.Load_Response_Struct(Json) if (Json.success && Json.success == true) { @@ -227,7 +249,7 @@ class KeyAuth { ownerid: this.ownerId } - const Json = await make_request(post_data) + const Json = await this.make_request(post_data) this.Load_Response_Struct(Json) if (Json.success && Json.success == true) { @@ -254,7 +276,7 @@ class KeyAuth { ownerid: this.ownerId } - const Json = await make_request(post_data) + const Json = await this.make_request(post_data) this.Load_Response_Struct(Json) if (Json.success && Json.success == true) { @@ -277,7 +299,7 @@ class KeyAuth { ownerid: this.ownerId } - const Json = await make_request(post_data) + const Json = await this.make_request(post_data) this.Load_Response_Struct(Json) if (Json.success && Json.success == true) { @@ -290,9 +312,11 @@ class KeyAuth { /** * KeyAuth acts as proxy and downlods the file in a secure way * @Param {string} [fileId] - File ID + * @Param {string} [path] - Path to save the file + * @Param {boolean} [execute] - Execute the file after download - Windows Only Requires path for file! * returns {byte} - Returns The bytes of the download file **/ - file = (fileId) => new Promise(async (resolve) => { + file = (fileId, path = null, execute = false) => new Promise(async (resolve) => { this.check_initialize() const post_data = { @@ -303,16 +327,39 @@ class KeyAuth { ownerid: this.ownerId } - const Json = await make_request(post_data) + const Json = await this.make_request(post_data) this.Load_Response_Struct(Json) if (Json.success && Json.success == true) { - return resolve(Buffer.from(Json.contents, 'hex').toString('utf-8')) + + if (path != null) { + var bytes = await this.strToByteArray(Json.contents); + fs.writeFile(path, bytes, async (err) => { + if (err) throw err; + + if (execute) { + var exec = require('child_process').exec; + await exec(path, function (error, stdout, stderr) { + if (error) { + console.error(error); + return; + } + }); + + return resolve(true); + } else { + return resolve(true); + } + }); + } else { + return resolve(this.strToByteArray(Json.contents)) + } } resolve(Json.message) }) + /** * Sends a request to a webhook that you've added in the dashboard in a safe way without it being showed for example a http debugger * @Param {string} [webId] - Webhook ID @@ -335,7 +382,7 @@ class KeyAuth { ownerid: this.ownerId } - const Json = await make_request(post_data) + const Json = await this.make_request(post_data) this.Load_Response_Struct(Json) if (Json.success && Json.success == true) { @@ -359,7 +406,7 @@ class KeyAuth { ownerid: this.ownerId } - const Json = await make_request(post_data) + const Json = await this.make_request(post_data) this.Load_Response_Struct(Json) if (Json.success && Json.success == true) { @@ -386,7 +433,7 @@ class KeyAuth { ownerid: this.ownerId } - const Json = await make_request(post_data) + const Json = await this.make_request(post_data) this.Load_Response_Struct(Json) if (Json.success && Json.success == true) { @@ -410,7 +457,7 @@ class KeyAuth { ownerid: this.ownerId } - const Json = await make_request(post_data) + const Json = await this.make_request(post_data) this.Load_Response_Struct(Json) if (Json.success && Json.success == true) { @@ -436,7 +483,7 @@ class KeyAuth { ownerid: this.ownerId } - const Json = await make_request(post_data) + const Json = await this.make_request(post_data) this.Load_Response_Struct(Json) if (Json.success && Json.success == true) { @@ -460,7 +507,7 @@ class KeyAuth { this.check_initialize() const post_data = { - type: 'fetchOnline', + type: 'chatsend', message: Message, channel: ChannelName, sessionid: this.sessionid, @@ -468,7 +515,7 @@ class KeyAuth { ownerid: this.ownerId } - const Json = await make_request(post_data) + const Json = await this.make_request(post_data) this.Load_Response_Struct(Json) if (Json.success && Json.success == true) { @@ -495,15 +542,30 @@ class KeyAuth { ownerid: this.ownerId } - await make_request(post_data) + await this.make_request(post_data) resolve(true) }) + + strToByteArray = (hex) => new Promise(async (resolve) => { + try { + const numberChars = hex.length; + const bytes = new Uint8Array(numberChars / 2); + for (let i = 0; i < numberChars; i += 2) { + bytes[i / 2] = parseInt(hex.substr(i, 2), 16); + } + resolve(bytes) + } catch (err) { + console.error('The session has ended, open program again.'); + process.exit(0); + } + }) + /** * Check if the current session is initialized * @returns [true] if client is Initialized. **/ - check_initialize () { + check_initialize() { if (!this.initialized) { Misc.error('You must initialize the API before using it!') } @@ -513,7 +575,7 @@ class KeyAuth { /** * Load the response struct for Response of Request **/ - Load_Response_Struct (data) { + Load_Response_Struct(data) { this.response = { success: data.success, message: data.message @@ -523,7 +585,7 @@ class KeyAuth { /** * Load the response struct for User Data **/ - Load_User_Data (data) { + Load_User_Data(data) { this.user_data = { username: data.username, ip: data.ip, @@ -539,7 +601,7 @@ class KeyAuth { * @param {string} [title] - Your new Title for the App * Returns Promise Timeout **/ - setTitle (title) { + setTitle(title) { process.stdout.write( String.fromCharCode(27) + ']0;' + title + String.fromCharCode(7) ) @@ -550,11 +612,42 @@ class KeyAuth { * @param {number} [ms] - Time in milliseconds * Returns Promise Timeout **/ - sleep (ms) { + sleep(ms) { return new Promise((resolve) => { setTimeout(resolve, ms) }) }; + + /** + * Request the API with the POST Data + * @param {string} [data] - Post Data Array + * Returns {array} - Returns the API Response [NON-ENCRYPTED] + **/ + make_request(data) { + const startTime = Date.now(); // Start the stopwatch + + return new Promise(async (resolve) => { + const request = await axios({ + method: 'POST', + url: 'https://keyauth.win/api/1.1/', + data: new URLSearchParams(data).toString() + }).catch((err) => { + Misc.error(err) + }) + + const endTime = Date.now(); // Stop the stopwatch + + this.responseTime = `${endTime - startTime} ms`; + + if (request && request.data) { + resolve(request.data) + } else { + resolve(null) + }; + }) + } + + } class Misc { @@ -562,48 +655,30 @@ class Misc { * Get the current user HardwareId * @returns {string} - Returns user HardwareID **/ - static GetCurrentHardwareId () { - if (os.platform() != 'win32') return false + static GetCurrentHardwareId() { + let system_id = null; - const cmd = execSync('wmic useraccount where name="%username%" get sid').toString('utf-8') + if (os.platform() === 'win32') { + const cmd = execSync('wmic useraccount where name="%username%" get sid').toString('utf-8'); + system_id = cmd.split('\n')[1].trim(); + } else if (os.platform() === 'darwin') { + const cmd = execSync("ioreg -rd1 -c IOPlatformExpertDevice | awk '/IOPlatformUUID/ { print $3; }'").toString('utf-8'); + system_id = cmd.trim(); + } - const system_id = cmd.split('\n')[1].trim() - return system_id - }; + return system_id; +}; /** * Error Print Function * @param {string} [message] - Message to Show and then exit app. **/ - static error (message) { + static error(message) { console.log(message) return process.exit(0) } } -/** - * Request the API with the POST Data - * @param {string} [data] - Post Data Array - * Returns {array} - Returns the API Response [NON-ENCRYPTED] -**/ -function make_request (data) { - return new Promise(async (resolve) => { - const request = await axios({ - method: 'POST', - url: 'https://keyauth.win/api/1.1/', - data: new URLSearchParams(data).toString() - }).catch((err) => { - Misc.error(err) - }) - - if (request && request.data) { - resolve(request.data) - } else { - resolve(null) - }; - }) -} - /** * Export KeyAuth Class to be used in other files **/ diff --git a/src/API1.1/LICENSE b/src/API1.1/LICENSE index 9d2b03e..9bfa6db 100644 --- a/src/API1.1/LICENSE +++ b/src/API1.1/LICENSE @@ -1,21 +1,93 @@ -MIT License - -Copyright (c) 2022 KeyAuth - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +Elastic License 2.0 + +URL: https://www.elastic.co/licensing/elastic-license + +## Acceptance + +By using the software, you agree to all of the terms and conditions below. + +## Copyright License + +The licensor grants you a non-exclusive, royalty-free, worldwide, +non-sublicensable, non-transferable license to use, copy, distribute, make +available, and prepare derivative works of the software, in each case subject to +the limitations and conditions below. + +## Limitations + +You may not provide the software to third parties as a hosted or managed +service, where the service provides users with access to any substantial set of +the features or functionality of the software. + +You may not move, change, disable, or circumvent the license key functionality +in the software, and you may not remove or obscure any functionality in the +software that is protected by the license key. + +You may not alter, remove, or obscure any licensing, copyright, or other notices +of the licensor in the software. Any use of the licensor’s trademarks is subject +to applicable law. + +## Patents + +The licensor grants you a license, under any patent claims the licensor can +license, or becomes able to license, to make, have made, use, sell, offer for +sale, import and have imported the software, in each case subject to the +limitations and conditions in this license. This license does not cover any +patent claims that you cause to be infringed by modifications or additions to +the software. If you or your company make any written claim that the software +infringes or contributes to infringement of any patent, your patent license for +the software granted under these terms ends immediately. If your company makes +such a claim, your patent license ends immediately for work on behalf of your +company. + +## Notices + +You must ensure that anyone who gets a copy of any part of the software from you +also gets a copy of these terms. + +If you modify the software, you must include in any modified copies of the +software prominent notices stating that you have modified the software. + +## No Other Rights + +These terms do not imply any licenses other than those expressly granted in +these terms. + +## Termination + +If you use the software in violation of these terms, such use is not licensed, +and your licenses will automatically terminate. If the licensor provides you +with a notice of your violation, and you cease all violation of this license no +later than 30 days after you receive that notice, your licenses will be +reinstated retroactively. However, if you violate these terms after such +reinstatement, any additional violation of these terms will cause your licenses +to terminate automatically and permanently. + +## No Liability + +*As far as the law allows, the software comes as is, without any warranty or +condition, and the licensor will not be liable to you for any damages arising +out of these terms or the use or nature of the software, under any kind of +legal claim.* + +## Definitions + +The **licensor** is the entity offering these terms, and the **software** is the +software the licensor makes available under these terms, including any portion +of it. + +**you** refers to the individual or entity agreeing to these terms. + +**your company** is any legal entity, sole proprietorship, or other kind of +organization that you work for, plus all organizations that have control over, +are under the control of, or are under common control with that +organization. **control** means ownership of substantially all the assets of an +entity, or the power to direct its management and policies by vote, contract, or +otherwise. Control can be direct or indirect. + +**your licenses** are all the licenses granted to you for the software under +these terms. + +**use** means anything you do with the software requiring one of your licenses. + +**trademark** means trademarks, service marks, and similar rights. \ No newline at end of file diff --git a/src/API1.1/README.md b/src/API1.1/README.md index 06b0160..ce2d9de 100644 --- a/src/API1.1/README.md +++ b/src/API1.1/README.md @@ -32,7 +32,12 @@ await KeyAuthApp.login("", ""); ###### **Register** ```js -await KeyAuthApp.register("", "", "") +await KeyAuthApp.register("", "", "", "") +``` + +###### **Forgot** +```js +await KeyAuthApp.forgot("", ""); ``` ###### **License Login** diff --git a/src/API1.1/index.js b/src/API1.1/index.js index bf8064a..4b571ac 100644 --- a/src/API1.1/index.js +++ b/src/API1.1/index.js @@ -1,14 +1,13 @@ const KeyAuth = require('./KeyAuth'); const readline = require("readline"); const moment = require("moment"); - const CRL = readline.createInterface({ input: process.stdin, output: process.stdout }); const KeyAuthApp = new KeyAuth( - '', // Application Name - '', // Application OwnerId - '', // Application Secret - '1.0' // Application Version + "", // Application Name + "", // OwnerID + "", // Application Secret + "1.0" // Application Version ); @@ -21,15 +20,10 @@ const KeyAuthApp = new KeyAuth( console.log(` Number of keys: ${KeyAuthApp.app_data.numKeys}`); console.log(` Application Version: ${KeyAuthApp.app_data.version}`); console.log(` Customer panel link: ${KeyAuthApp.app_data.customerPanelLink}\n`); - await KeyAuthApp.check(); - await KeyAuthApp.sleep(1200); - console.log( - ` Current Session Validation Status: ${KeyAuthApp.response.message}` - ); - var username, password, license = ""; + var username, password, license, email = ""; - await CRL.question("\n [1] Login\n [2] Register\n [3] Upgrade\n [4] License key only\n\n Choose option: ", async (option) => { + await CRL.question("\n [1] Login\n [2] Register\n [3] Upgrade\n [4] License key only\n [5] Forgot password\n\n Choose option: ", async (option) => { option = await parseInt(option); switch (option) { @@ -51,9 +45,12 @@ const KeyAuthApp = new KeyAuth( password = pass; await CRL.question(" Whats your License: ", async (lic) => { license = lic; - await KeyAuthApp.register(username, password, license); - Dashboard(); - CRL.close(); + await CRL.question(" Whats your Email: ", async (email_) => { + email = email_; + await KeyAuthApp.register(username, password, license, email); + Dashboard(); + CRL.close(); + }); }); }); }); @@ -79,6 +76,18 @@ const KeyAuthApp = new KeyAuth( } ); break; + case 5: + await CRL.question("\n Whats your Username: ", async (user) => { + username = user; + await CRL.question(" Whats your Email: ", async (email_) => { + email = email_; + await KeyAuthApp.forgot(username, email); + console.log(KeyAuthApp.response.message); + process.exit(0); + + }); + }); + break; default: console.log("Invalid option"); CRL.close(); @@ -114,14 +123,9 @@ const KeyAuthApp = new KeyAuth( }` ); } - - KeyAuthApp.check(); - console.log( - ` Current Session Validation Status: ${KeyAuthApp.response.message}` - ); - - console.log("\n\n Closing in 10 seconds..."); - await KeyAuthApp.sleep(10000); + + console.log("\n\n Closing in 5 seconds..."); + await KeyAuthApp.sleep(5000); process.exit(0); } diff --git a/src/API1.1/package.json b/src/API1.1/package.json index 6148fbe..aca5ee4 100644 --- a/src/API1.1/package.json +++ b/src/API1.1/package.json @@ -24,7 +24,7 @@ "os": "^0.1.2" }, "author": "mazkdevf ", - "license": "ISC", + "license": "Elastic License 2.0", "bugs": { "url": "https://github.com/mazkdevf/KeyAuth-JS-Example/issues" }, diff --git a/src/API1.2/KeyAuth.js b/src/API1.2/KeyAuth.js deleted file mode 100644 index 9d1dbe6..0000000 --- a/src/API1.2/KeyAuth.js +++ /dev/null @@ -1 +0,0 @@ -// not yet \ No newline at end of file diff --git a/src/API1.2/LICENSE b/src/API1.2/LICENSE index 9d2b03e..9bfa6db 100644 --- a/src/API1.2/LICENSE +++ b/src/API1.2/LICENSE @@ -1,21 +1,93 @@ -MIT License - -Copyright (c) 2022 KeyAuth - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +Elastic License 2.0 + +URL: https://www.elastic.co/licensing/elastic-license + +## Acceptance + +By using the software, you agree to all of the terms and conditions below. + +## Copyright License + +The licensor grants you a non-exclusive, royalty-free, worldwide, +non-sublicensable, non-transferable license to use, copy, distribute, make +available, and prepare derivative works of the software, in each case subject to +the limitations and conditions below. + +## Limitations + +You may not provide the software to third parties as a hosted or managed +service, where the service provides users with access to any substantial set of +the features or functionality of the software. + +You may not move, change, disable, or circumvent the license key functionality +in the software, and you may not remove or obscure any functionality in the +software that is protected by the license key. + +You may not alter, remove, or obscure any licensing, copyright, or other notices +of the licensor in the software. Any use of the licensor’s trademarks is subject +to applicable law. + +## Patents + +The licensor grants you a license, under any patent claims the licensor can +license, or becomes able to license, to make, have made, use, sell, offer for +sale, import and have imported the software, in each case subject to the +limitations and conditions in this license. This license does not cover any +patent claims that you cause to be infringed by modifications or additions to +the software. If you or your company make any written claim that the software +infringes or contributes to infringement of any patent, your patent license for +the software granted under these terms ends immediately. If your company makes +such a claim, your patent license ends immediately for work on behalf of your +company. + +## Notices + +You must ensure that anyone who gets a copy of any part of the software from you +also gets a copy of these terms. + +If you modify the software, you must include in any modified copies of the +software prominent notices stating that you have modified the software. + +## No Other Rights + +These terms do not imply any licenses other than those expressly granted in +these terms. + +## Termination + +If you use the software in violation of these terms, such use is not licensed, +and your licenses will automatically terminate. If the licensor provides you +with a notice of your violation, and you cease all violation of this license no +later than 30 days after you receive that notice, your licenses will be +reinstated retroactively. However, if you violate these terms after such +reinstatement, any additional violation of these terms will cause your licenses +to terminate automatically and permanently. + +## No Liability + +*As far as the law allows, the software comes as is, without any warranty or +condition, and the licensor will not be liable to you for any damages arising +out of these terms or the use or nature of the software, under any kind of +legal claim.* + +## Definitions + +The **licensor** is the entity offering these terms, and the **software** is the +software the licensor makes available under these terms, including any portion +of it. + +**you** refers to the individual or entity agreeing to these terms. + +**your company** is any legal entity, sole proprietorship, or other kind of +organization that you work for, plus all organizations that have control over, +are under the control of, or are under common control with that +organization. **control** means ownership of substantially all the assets of an +entity, or the power to direct its management and policies by vote, contract, or +otherwise. Control can be direct or indirect. + +**your licenses** are all the licenses granted to you for the software under +these terms. + +**use** means anything you do with the software requiring one of your licenses. + +**trademark** means trademarks, service marks, and similar rights. \ No newline at end of file diff --git a/src/API1.2/README.md b/src/API1.2/README.md index 2fcd585..6f9422e 100644 --- a/src/API1.2/README.md +++ b/src/API1.2/README.md @@ -1,139 +1,5 @@ ## KeyAuth JavaScript Example -- Not Available Yet +We now have [KeyAuthJS](https://www.npmjs.com/package/@keyauthjs/client) this can be used with 1.2 onwards ------------ -### **Example Codes** - - - -##### **Filling KeyAuth Class Constructor** -```js -const KeyAuthApp = new KeyAuth( - '', // Application Name - '', // Application OwnerId - '', // Application Secret - '1.0' // Application Version -); -``` - -##### **Initializing Application** -```js -await KeyAuthApp.Initialize(); -``` ---- - -##### **General Features** -###### **Login** -```js -await KeyAuthApp.login("", ""); -``` - -###### **Register** -```js -await KeyAuthApp.register("", "", "") -``` - -###### **License Login** -```js -await KeyAuthApp.license(""); -``` - -###### **Upgrade an Account** -```js -await KeyAuthApp.upgrade("", ""); -``` ---- - -##### **Variables** -###### **Get Public Variable** -```js -await KeyAuthApp.var(""); -``` - -###### **Get User Variable** -```js -await KeyAuthApp.GetVar(""); -``` - -###### **Set User Variable** -```js -await KeyAuthApp.SetVar("", ""); -``` ---- -##### **Banning Logged in User** -```js -await KeyAuthApp.ban(); -``` ---- - -##### **File Downloads** -```js -await KeyAuthApp.file(""); -``` ---- -##### **Webhooks** - -###### Normal Request with Params -```js -await KeyAuthApp.webhook("", "") -``` - -###### Webhook Request with Body & Content Type -```js -await KeyAuthApp.webhook("", "", "", ""); -``` - -###### Discord Webhook Example -```js -await KeyAuthApp.webhook("", "", "{\"content\": \"webhook message here\",\"embeds\": null}", "application/json"); -``` ---- -##### **Checks** -###### Check Session Status -```js -await KeyAuthApp.check(); -``` - -##### **Check Blacklist Status** -```js -await KeyAuthApp.checkBlack(); -``` - -##### **Check / Fetch Online Users** -```js -await KeyAuthApp.fetchOnline(); -``` ---- - - -##### **Chats** -###### Get 20 Latest Chat Messages - -```js -await KeyAuthApp.ChatGet(); -``` - -###### Send Chat Message -```js -await KeyAuthApp.ChatSend("", ""); -``` ---- - -##### **Logs** -```js -await KeyAuthApp.log(""); -``` ---- - -### **Additional / Extra Functions** - -##### **Set/Change Console Title** -```js -await KeyAuthApp.setTitle(""); -``` - -##### **Sleep is ms(s)** -```js -await KeyAuthApp.sleep("<1 sec = 1000ms>") -``` \ No newline at end of file +This [repo](https://github.com/lIMonkieIl/keyauth-js) was created by someone from our community please go and give the project a star. diff --git a/src/Protected_Version/readme.md b/src/Protected_Version/readme.md new file mode 100644 index 0000000..2318e29 --- /dev/null +++ b/src/Protected_Version/readme.md @@ -0,0 +1,3 @@ +## KeyAuth JS Protected Example + +