How ch-jack/fxap_only works
Purpose and Entry Point
FXAP Decryptor is a Node.js 18+ CLI for decrypting authorized FiveM FXAP resources, copying plaintext assets, and optionally decompiling Lua bytecode and repairing selected model vertex data. The executable entry point is index.js; orchestration implementation is centered in src/decryptor.js.
CLI Orchestration and Resource Discovery
Argument handling supports optional CFX Key, resource/root directory, Java path, and --vertex-fix. The tool discovers either a single FXAP-containing resource or multiple child resources, writes output beside the input as <name>_decrypted, and aggregates resource/file outcomes into documented exit codes.
Paths: index.js, src/discover.js, src/decryptor.js.
Key Acquisition Boundary
Key material is resolved per FXAP resource ID. An optional CFX Key is validated through official Cfx.re Keymaster; valid keys are imported into the grants service. Missing local grants or grants_clk triggers a grants API lookup. Existing usable material permits continued processing if lookup fails.
Paths: src/keymaster.js, src/grants-api.js, src/constants.js.
Cloudflare Client-Key Derivation
Client-side encrypted content requires grants_clk. The repository delegates derivation to Cloudflare’s external /v1/derive endpoint and consumes its returned 32-byte key; the actual derivation algorithm is deliberately not local. API URLs and credentials can be overridden through environment variables.
Paths: src/cloudflare-grants.js, src/crypto.js, .env.example.
FXAP Parsing and Decryption Pipeline
The decryptor reads FXAP/resource metadata, obtains server grants and derived client keys, and decrypts standard FXAP and RSC stream paths while preserving directory layout. Non-encrypted files are copied. Per-file failures are separated from total resource failure so callers can distinguish partial output from failed resources.
Paths: src/decryptor.js, src/crypto.js, src/constants.js.
Lua Bytecode Post-Processing
After decryption, Lua 5.4 bytecode may be passed to the bundled unluac54.jar through an externally supplied or discovered Java runtime. Failure to find Java or decompile does not invalidate the decrypted artifact: .luac remains, with assembly output retained when available.
Paths: src/java-decompiler.js, tools/unluac54.jar, src/decryptor.js.
Optional Vertex-Fix Isolation
--vertex-fix operates only on fully decrypted FXAP resources. It creates a separate sibling copy of the decrypted output and invokes the packaged Windows/.NET 8 CLI against .ydr, .yft, and .ydd assets; it never overwrites the base decrypted directory.
Paths: src/vertex-fixer.js, tools/vertex-fixer/FivemDecryptFixer.Cli.exe, src/decryptor.js.
Distribution and Runtime Dependencies
There are no npm runtime dependencies. Required runtime is Node.js; Java is optional for Lua processing; .NET 8 is externally required for vertex fixing. GitHub Actions builds/tests/releases a component package consumed on demand by CK Free Toolbox, with release contents defined by the PowerShell build process and component manifest.
Paths: component-manifest.json, tools/Build-Release.ps1, .github/workflows/release.yml.
Main entry points: decryptor.js Decryptor orchestrator · crypto.js Crypto pipeline · vertex-fixer.js Vertex-fix adapter · java-decompiler.js Lua decompiler
Components 19
CLI & Discovery
- CLI entry point
index.js - Resource discovery · Finds one FXAP resource or child resources.
src/discover.js
Key Resolution
- Cfx.re Keymaster · Validates and imports an optional CFX Key.
src/keymaster.js - Grants API · Looks up missing grants material by resource ID.
src/grants-api.js - Cloudflare derive API · Returns the 32-byte client key; derivation is not local.
src/cloudflare-grants.js
FXAP Processing
- Decryptor orchestrator · Aggregates resource and file outcomes into exit codes.
src/decryptor.js - Crypto pipeline · Decrypts encrypted streams and copies plaintext files.
src/crypto.js - Protocol constants
src/constants.js - Decrypted output · Written beside input as <name>_decrypted.
Optional Post-Processing
- Lua decompiler · Keeps .luac when Java discovery or decompilation fails.
src/java-decompiler.js - unluac54
tools/unluac54.jar - Java runtime · Supplied or discovered for Lua post-processing.
- Vertex-fix adapter · Runs only after a fully decrypted resource succeeds.
src/vertex-fixer.js - FivemDecryptFixer CLI · Repairs .ydr, .yft, and .ydd assets.
tools/vertex-fixer/FivemDecryptFixer.Cli.exe - .NET 8 runtime
- Vertex-fixed copy · Separate copy; never overwrites decrypted output.
Distribution
- Component manifest
component-manifest.json - Release build · Defines release contents.
tools/Build-Release.ps1 - Release workflow · Builds, tests, and releases the component package.
.github/workflows/release.yml
Connections 21
- CLI entry point → Resource discovery: selects resources
- CLI entry point → Decryptor orchestrator: starts
- Resource discovery → Decryptor orchestrator: resource inputs
- Decryptor orchestrator → Cfx.re Keymaster: optional CFX Key
- Cfx.re Keymaster → Grants API: imports validated key
- Decryptor orchestrator → Grants API: missing local grants lookup
- Decryptor orchestrator → Cloudflare derive API: requests grants_clk key
- Grants API → Crypto pipeline: server grants
- Cloudflare derive API → Crypto pipeline: derived client key
- Protocol constants → Crypto pipeline: formats and metadata
- Decryptor orchestrator → Crypto pipeline: file streams
- Crypto pipeline → Decrypted output: decrypts or copies
- Decrypted output → Lua decompiler: Lua bytecode
- Lua decompiler → Java runtime: launches
- Lua decompiler → unluac54: executes
- Decrypted output → Vertex-fix adapter: fully decrypted only
- Vertex-fix adapter → FivemDecryptFixer CLI: invokes
- Vertex-fix adapter → .NET 8 runtime: requires
- Vertex-fix adapter → Vertex-fixed copy: creates sibling copy
- Release workflow → Release build: runs
- Release build → Component manifest: packages per manifest