{"id":15689614,"url":"https://github.com/luraph/luraph-node","last_synced_at":"2025-05-05T21:33:45.409Z","repository":{"id":143888138,"uuid":"400346868","full_name":"Luraph/luraph-node","owner":"Luraph","description":"Luraph API binding for Node.JS","archived":false,"fork":false,"pushed_at":"2024-06-26T19:42:38.000Z","size":129,"stargazers_count":3,"open_issues_count":8,"forks_count":6,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-10T13:18:28.824Z","etag":null,"topics":["javascript","lua","luraph","nodejs","obfuscation","obfuscator","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Luraph.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-27T00:56:25.000Z","updated_at":"2025-02-07T10:09:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"64d227a6-0c66-4176-b09d-5e6d03317639","html_url":"https://github.com/Luraph/luraph-node","commit_stats":{"total_commits":29,"total_committers":1,"mean_commits":29.0,"dds":0.0,"last_synced_commit":"1d18c54f2665b5329c84d74d909ee278f9c0b80d"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Luraph%2Fluraph-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Luraph%2Fluraph-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Luraph%2Fluraph-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Luraph%2Fluraph-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Luraph","download_url":"https://codeload.github.com/Luraph/luraph-node/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252580131,"owners_count":21771268,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","lua","luraph","nodejs","obfuscation","obfuscator","typescript"],"created_at":"2024-10-03T18:03:34.465Z","updated_at":"2025-05-05T21:33:45.353Z","avatar_url":"https://github.com/Luraph.png","language":"TypeScript","readme":"# luraph-node\n\n[![Version](https://img.shields.io/npm/v/luraph.svg)](https://www.npmjs.org/package/luraph)\n[![Downloads](https://img.shields.io/npm/dm/luraph.svg)](https://www.npmjs.com/package/luraph)\n[![Bundle Size](https://img.shields.io/bundlephobia/minzip/luraph)](https://bundlephobia.com/package/luraph)\n[![Build Status](https://github.com/Luraph/luraph-node/actions/workflows/release.yml/badge.svg)](https://github.com/Luraph/luraph-node/actions/workflows/release.yml)\n[![License](https://img.shields.io/github/license/Luraph/luraph-node)](LICENSE)\n\nThis repository hosts the official SDK for interacting with the Luraph API from Node.js environments.\n\n**Luraph API access is only available for accounts under certain plans. For more information, please check out the pricing plans on the [Luraph website](https://lura.ph/#pricing).**\n\n## Installation\n\nInstall the [luraph](https://npmjs.org/package/luraph) package from npm using your package manager of choice.\n\nExample:\n```sh\nnpm install luraph\n# or\nyarn add luraph\n# or\npnpm install luraph\n```\n\n## Usage\n\n*The official [Luraph API documentation](https://lura.ph/dashboard/documents/apidoc) contains the most up-to-date and complete information and instructions for integrating with the Luraph API.*\n\n#### [Basic](examples/basic.js)\n\n```js\nconst { Luraph } = require(\"luraph\");\n\nconst apiKey = process.env.LPH_API_KEY; //replace with your api key\nconst luraph = new Luraph(apiKey);\n\nconst obfuscate = async (script, fileName) =\u003e {\n    console.log(`[*] file name: ${fileName}`);\n\n    const nodes = await luraph.getNodes();\n    console.log(`[*] recommended node: ${nodes.recommendedId}`);\n\n    const node = nodes.nodes[nodes.recommendedId];\n    console.log(`[*] cpu usage: ${node.cpuUsage}`);\n\n    const { jobId } = await luraph.createNewJob(nodes.recommendedId, script, fileName, {});\n    console.log(`[*] job id: ${jobId}`);\n\n    const { success, error } = await luraph.getJobStatus(jobId);\n    console.log(`[*] job status: ${success ? \"success\" : \"error\"}`);\n\n    if(success){\n        const {fileName: resultName, data} = await luraph.downloadResult(jobId);\n        console.log(`[*] result name: ${resultName}`);\n        \n        return data;\n    }else{\n        throw error; //error is a string\n    }\n};\n\nobfuscate(\"print'Hello World!'\", `luraph-node-${Date.now()}.lua`)\n    .then(result =\u003e console.log(`[*] obfuscation successful: ${result.split(\"\\n\")[0]}`))\n    .catch(error =\u003e console.error(`[*] obfuscation failed: ${error}`));\n```\n\n#### [List Options](examples/list_options.js)\n\n```js\nconst { Luraph } = require(\"luraph\");\n\nconst apiKey = process.env.LPH_API_KEY; //replace with your api key\nconst luraph = new Luraph(apiKey);\n\nconst listOptions = async () =\u003e {\n    const nodes = await luraph.getNodes();\n    console.log(`[*] recommended node: ${nodes.recommendedId}`);\n\n    const node = nodes.nodes[nodes.recommendedId];\n    console.log(`[*] cpu usage: ${node.cpuUsage}`);\n    \n    console.log(\"[*] options:\");\n    for(const [optionId, optionInfo] of Object.entries(node.options)){\n        console.log(\"  *\", optionId, \"-\", optionInfo.name + \":\");\n        console.log(\"  |- desc:\", optionInfo.description);\n        console.log(\"  |- type:\", optionInfo.type);\n        console.log(\"  |- tier:\", optionInfo.tier);\n        console.log(\"  |- choices:\", `[${optionInfo.choices.join(\", \")}]`);\n        console.log(\"  |- required:\", optionInfo.required);\n        if(optionInfo.dependencies) console.log(\"  |- dependencies: \", optionInfo.dependencies);\n    }\n};\n\nlistOptions();\n```\n\n#### [Setting Options](examples/set_options.js)\n\n```js\nconst { Luraph } = require(\"luraph\");\n\nconst apiKey = process.env.LPH_API_KEY; //replace with your api key\nconst luraph = new Luraph(apiKey);\n\nconst obfuscate = async (script, fileName) =\u003e {\n    console.log(`[*] file name: ${fileName}`);\n\n    const nodes = await luraph.getNodes();\n    console.log(`[*] recommended node: ${nodes.recommendedId}`);\n\n    const node = nodes.nodes[nodes.recommendedId];\n    console.log(`[*] cpu usage: ${node.cpuUsage}`);\n\n    const { jobId } = await luraph.createNewJob(nodes.recommendedId, script, fileName, {\n        \"TARGET_VERSION\": \"Lua 5.2\"\n    });\n    console.log(`[*] job id: ${jobId}`);\n\n    const { success, error } = await luraph.getJobStatus(jobId);\n    console.log(`[*] job status: ${success ? \"success\" : \"error\"}`);\n\n    if(success){\n        const {fileName: resultName, data} = await luraph.downloadResult(jobId);\n        console.log(`[*] result name: ${resultName}`);\n        \n        return data;\n    }else{\n        throw error; //error is a string\n    }\n};\n\nobfuscate(\"print'Hello World!'\", `luraph-node-${Date.now()}.lua`)\n    .then(result =\u003e console.log(`[*] obfuscation successful: ${result.split(\"\\n\")[0]}`))\n    .catch(error =\u003e console.error(`[*] obfuscation failed: ${error}`));\n```\n\n## Documentation\n\n*The official [Luraph API documentation](https://lura.ph/dashboard/documents/apidoc) contains the most up-to-date and complete information and instructions for integrating with the Luraph API.*\n\n### class Luraph\n\n#### constructor(apiKey: string): Luraph\n\nDescription: Creates an instance of the SDK.\n\nParameters:\n- **apiKey** - API key to authenticate your requests. You can fetch your API key from your [account page](https://lura.ph/dashboard/account).\n\nReturns: An instance of the Luraph class allowing API requests to be made.\n\n---\n\n#### getNodes(): Promise\u003c{ nodes: {[nodeId: string]: LuraphNode}; recommendedId: string | null }\u003e\n\nDescription: Obtains a list of available obfuscation nodes.\n\nParameters: *None!*\n\nReturns: *\u0026lt;object\u0026gt;*\n- **recommendedId** - The most suitable node to perform an obfuscation based on current service load and other possible factors.\n- **nodes** - A list of all available nodes to submit obfuscation jobs to. For more information on the structure of this field, please refer to the [Luraph API documentation](https://lura.ph/dashboard/documents/apidoc).\n\n---\n\n#### createNewJob(node: string, script: string, fileName: string, options: LuraphOptionList, useTokens = false, enforceSettings = false): Promise\u003c{ jobId: string }\u003e\n\nDescription: Queues a new obfuscation task.\n\nParameters:\n- **node**: The node to assign the obfuscation job to.\n- **script**: The script to be obfuscated.\n- **fileName**: A file name to associate with this script. The maximum file name is 255 characters.\n- **options**: An object containing keys that represent the option identifiers, and values that represent the desired settings. Unless `enforceSettings` is set to false, all options supported by the node must have a value specified, else the endpoint will error.\n- **useTokens** - A boolean on whether you'd like to use tokens regardless of your active subscription.\n- **enforceSettings** - A boolean on whether you'd like the `options` field to require *every* option requested by the server to be present with a valid value. If this is false, your integration will not break when invalid options are provided; however, updates that change Luraph's options will result in your integration using default settings when invalid values are specified. By default, this is set to `true`.\n\nReturns: *\u0026lt;object\u0026gt;*\n- **jobId** - A unique identifier for the queued obfuscation job.\n\n---\n\n#### getJobStatus(jobId: string): Promise\u003c({ success: true, error: null } | { success: false, error: string })\u003e\n\nDescription: This endpoint does not return until the referenced obfuscation job is complete. The maximum timeout is 60 seconds, and this endpoint can be called a **maximum** of 3 times per job.\n\nParameters:\n- **jobId** - The job ID of the obfuscation to wait for.\n\nReturns: *\u0026lt;object\u0026gt;*\n- **success** - A boolean indicating whether the job was successful.\n- **error** - An error message if the job failed, or null if the job succeeded.\n\n---\n\n#### downloadResult(jobId: string): Promise\u003c{ data: string; fileName: string }\u003e\n\nDescription: Downloads the resulting file associated with an obfuscation job.\n\nParameters:\n- **jobId** - The job ID of the obfuscation to download.\n\nReturns: *\u0026lt;object\u0026gt;*\n- **fileName** - A sanitized version of the initial filename, including a suffix to differentiate it from the original filename.\n- **data** - The obfuscated script.\n\n---\n\n### interface LuraphOptionInfo\n\nFields:\n- **name** - The human readable name associated with an option.\n- **description** - The markdown formatted description for an option.\n- **tier** - One of `CUSTOMER_ONLY`, `PREMIUM_ONLY`, `ADMIN_ONLY`.\n- **type** - One of `CHECKBOX`, `DROPDOWN`, `TEXT`.\n- **required** - If creating a user interface to integrate with Luraph, settings that contain a value of `true` for this field should be explicitly set by the user, since they have a high chance of causing incorrect output when not set properly.\n- **choices** - An array of acceptable option values when `type == DROPDOWN`.\n- **dependencies** - An array of required prerequisite values before this setting can be changed from the default value.\n\n---\n\n### interface LuraphNode\n\nFields:\n- **cpuUsage** - The current CPU usage of the node.\n- **options** - An object with option identifiers as keys and `LuraphOptionInfo` as values.\n\n---\n\n### interface LuraphOptionList\n\nAn array of string keys, and values that may either be a string or boolean.\n\n---\n\n### interface LuraphError\n\nFields:\n- **param** - The parameter associated with the cause of the error.\n- **message** - A human readable error message.\n\n---\n\n### class LuraphException extends Error\n\nFields:\n- **errors** - An array of `LuraphError`.\n- **message** - A human readable collection of error messages returned by a request.\n\n## Useful Links\n- [Visit the Luraph Website](https://lura.ph/ \"Luraph - Online Lua Obfuscation\")\n- [Join the Luraph Discord](https://discord.lura.ph/ \"Luraph Discord Server\")\n- [Read the Luraph Documentation](https://lura.ph/dashboard/documents \"Luraph Documentation\")\n- [Read the Luraph FAQs](https://lura.ph/dashboard/faq \"Luraph Frequently Asked Questions\")","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluraph%2Fluraph-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluraph%2Fluraph-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluraph%2Fluraph-node/lists"}