API リファレンス
API キーの取得
- ダッシュボード にログインします
- Settings → API Keys に移動します
- 「Create Key」をクリックして API キーをコピーします
- 安全に保管します(環境変数を推奨)
推奨される REST API の使い方
推奨: NPM パッケージを使う
ほとんどのユースケースでは、javascript-obfuscator npm パッケージ(v5.3.0 以降)を CLI または Node.js API から直接使用することを推奨します。これは、4.4MB を超えるファイルを難読化する、公式にサポートされた唯一の方法でもあります。
インストール
npm install -g javascript-obfuscator例
# Basic usage (standard obfuscation)
javascript-obfuscator input.js --output output.js
# VM obfuscation (requires Pro API token)
javascript-obfuscator input.js --output output.js \
--pro-api-token=<YOUR_PRO_API_TOKEN> \
--vm-obfuscation=true \
--options-preset=vm-medium-obfuscation
# VM obfuscation with a specific version (requires Pro API token)
javascript-obfuscator input.js --output output.js \
--pro-api-token=<YOUR_PRO_API_TOKEN> \
--pro-api-version=5.0.3 \
--vm-obfuscation=true \
--vm-bytecode-format=binary
# Obfuscation with Parse HTML option (requires Pro API token)
javascript-obfuscator input.js --output output.js \
--pro-api-token=<YOUR_PRO_API_TOKEN> \
--parse-html=true \
--compact=true \
--control-flow-flattening=true \
--dead-code-injection=true \
--string-array=true
# Standard obfuscation (no token needed)
javascript-obfuscator input.js --output output.js \
--compact=true \
--control-flow-flattening=true \
--dead-code-injection=true \
--string-array=trueすべての利用可能なオプションについては CLI ドキュメント を参照してください。
REST API を手動で使う
エンドポイント
https://obfuscator.io/api/v1/obfuscate
メソッド
POSTヘッダー
Content-Type: application/json
Authorization: Bearer YOUR_API_TOKEN
クエリパラメータ
version optional - 使用する難読化ツールのバージョン
デフォルトは最新版(7.8.0)です。
レスポンス形式
この API は NDJSON ストリーミング(application/x-ndjson)を使用します。大きな結果は確実な配信のために自動的に 1MB 単位のチャンクに分割されます。
code required - 難読化する JavaScript コード
options - 難読化オプションのオブジェクト
少なくとも 1 つの Pro 機能が必要です: vmObfuscation: true または parseHtml: true
利用可能なオプション: compact、controlFlowFlattening、deadCodeInjection、stringArray、sourceMap、
その他多数。
利用可能なオプションの完全な一覧は、オプションリファレンスのセクションを参照してください。
