diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 43bca6e..1acaac9 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -55,6 +55,34 @@ jobs:
- name: Build
run: npm run build
+ - name: Verify SDK distribution
+ run: npm run check:sdk-dist
+
+ - name: Load the classic and module distributions in Chrome
+ run: |
+ python3 -m http.server 8765 --bind 127.0.0.1 --directory dist >/dev/null 2>&1 &
+ server=$!
+ trap 'kill "$server"' EXIT
+ node scripts/check-sdk-browser.mjs http://127.0.0.1:8765/
+
+ - name: Exercise the Java runtime provider
+ run: |
+ archive="$RUNNER_TEMP/graaljs.tar.gz"
+ release=https://github.com/oracle/graaljs/releases/download/graal-25.0.1
+ curl -fsSL "$release/graaljs-community-jvm-25.0.1-linux-amd64.tar.gz" -o "$archive"
+ echo "7dfa228b2e9af3ad4fad77635aa105d55a31838ba522200772131db7d4560af5 $archive" | sha256sum -c -
+ mkdir "$RUNNER_TEMP/graaljs"
+ tar -xzf "$archive" --strip-components=1 -C "$RUNNER_TEMP/graaljs"
+ "$RUNNER_TEMP/graaljs/bin/js" -e '
+ load("dist/api.js");
+ if (DecodeBox.capabilities().runtime !== "graaljs-java") throw Error("Java provider missing");
+ DecodeBox.executeOperation("sha-256", "abc").then(print);
+ ' | grep -Fx ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
+ node_modules/.bin/rolldown src/engine/tests/java-key-handles.check.js \
+ --format iife --platform neutral --file "$RUNNER_TEMP/key-handles.js"
+ "$RUNNER_TEMP/graaljs/bin/js" "$RUNNER_TEMP/key-handles.js" | tee "$RUNNER_TEMP/key-handles.log"
+ grep -Fxq 'Java key handles passed' "$RUNNER_TEMP/key-handles.log"
+
- name: Report bundle size
run: |
{
@@ -67,7 +95,7 @@ jobs:
} >> "$GITHUB_STEP_SUMMARY"
- name: Upload build output
- if: matrix.node-version == '22'
+ if: matrix.node-version == '24'
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: dist
@@ -113,7 +141,7 @@ jobs:
- name: Use Node LTS
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
- node-version: '22'
+ node-version-file: '.nvmrc'
cache: npm
- name: Install clean packages
diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml
index f694709..8e3b5f0 100644
--- a/.github/workflows/deploy-pages.yml
+++ b/.github/workflows/deploy-pages.yml
@@ -16,9 +16,7 @@ name: Deploy to GitHub Pages
# nothing at all — the site was blank for an afternoon while every check passed.
#
# The branch is force-pushed as a single orphan commit each time. The output is
-# 2.7 MB and every file in it is content-hashed, so keeping its history would
-# add that much to the repository on every deploy, and not one byte of it would
-# ever be read again.
+# generated from source. Each tree carries its immutable SDK release directories forward.
on:
push:
@@ -44,6 +42,7 @@ jobs:
# The only privilege in this workflow, and it exists for one command: the
# push to gh-pages at the end.
contents: write
+ pages: read
steps:
- name: Checkout
@@ -56,7 +55,7 @@ jobs:
- name: Use Node LTS
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
- node-version: '22'
+ node-version-file: '.nvmrc'
cache: npm
- name: Install clean packages
@@ -65,44 +64,47 @@ jobs:
- name: Build
run: npm run build
- # The build ships no CNAME, so no repository claims a domain it does not
- # control. Relative asset paths support both the configured custom domain
- # and a github.io project URL when no custom domain is configured.
- #
- # On a branch-served site the CNAME file *is* the custom domain setting,
- # and this branch is force-pushed. A repository that has a domain
- # configured would lose it the moment it deploys: Pages reads the setting
- # back from a file that is no longer there and quietly unsets it. That is
- # how a staging site once turned into a 404 in the middle of a release,
- # with every check in this workflow green.
- #
- # So whatever domain the repository has configured is carried forward.
- # Pages is asked what it currently is, with the branch's own file as a
- # second opinion in case that read is not permitted.
- - name: Keep this repository's own custom domain
+ - name: Check new SDK artifacts and retain published versions
env:
GH_TOKEN: ${{ github.token }}
run: |
- rm -f dist/CNAME
-
- raw="https://raw.githubusercontent.com/$GITHUB_REPOSITORY/gh-pages/CNAME"
-
- domain=$(gh api "repos/$GITHUB_REPOSITORY/pages" --jq '.cname // empty' 2>/dev/null || true)
- if [ -z "$domain" ]; then
- domain=$(curl -fsSL --max-time 30 "$raw" 2>/dev/null | tr -d '[:space:]' || true)
+ npm run check:sdk-dist
+ settings=$(gh api "repos/$GITHUB_REPOSITORY/pages")
+ jq -e '.source.branch == "gh-pages" and .source.path == "/"' <<< "$settings" >/dev/null
+ domain=$(jq -r '.cname // empty' <<< "$settings")
+ previous_ref=$(git ls-remote --heads origin refs/heads/gh-pages)
+ if [[ -n "$previous_ref" ]]; then
+ git fetch --no-tags --depth=1 origin refs/heads/gh-pages
+ if [[ -z "$domain" ]] && git cat-file -e FETCH_HEAD:CNAME 2>/dev/null; then
+ domain=$(git show FETCH_HEAD:CNAME)
+ fi
+ if git cat-file -e FETCH_HEAD:sdk 2>/dev/null; then
+ previous=$(mktemp -d)
+ git archive FETCH_HEAD sdk | tar -x -C "$previous"
+ for series in "$previous"/sdk/v*; do
+ [[ -d "$series" ]] || continue
+ name=$(basename "$series")
+ [[ "$name" =~ ^v[0-9]+$ ]] || continue
+ for release in "$series"/*/; do
+ target="dist/sdk/$name/$(basename "$release")"
+ if [[ -d "$release" && -d "$target" ]]; then
+ diff -qr "$release" "$target"
+ fi
+ done
+ mkdir -p "dist/sdk/$name"
+ cp -an "$series/." "dist/sdk/$name/"
+ done
+ fi
fi
-
- if [ -n "$domain" ]; then
- echo "$domain" > dist/CNAME
- echo "Keeping the custom domain $domain."
- else
- echo "No custom domain is configured, so the site stays on github.io."
+ rm -f dist/CNAME
+ if [[ -n "$domain" ]]; then
+ printf '%s\n' "$domain" > dist/CNAME
fi
- name: Verify the build is static and complete
run: |
- test -f dist/index.html || { echo "::error::dist/index.html is missing"; exit 1; }
- test -f dist/decodebox.html || { echo "::error::dist/decodebox.html is missing - the download button would 404"; exit 1; }
+ test -s dist/index.html || { echo "::error::dist/index.html is missing"; exit 1; }
+ test -s dist/decodebox.html || { echo "::error::dist/decodebox.html is missing - the download button would 404"; exit 1; }
# The application must never call out to a third party at runtime. This is a
# coarse check, but it catches an accidental CDN reference before it ships.
if grep -rIloE 'https?://(cdn|unpkg|jsdelivr)' dist --include='*.js' --include='*.html' | head -1 | grep -q .; then
@@ -176,9 +178,11 @@ jobs:
case "$body" in
*"$entry"*)
echo "$url is serving this build."
+ npm run check:sdk-dist -- dist "$url"
+ node scripts/check-sdk-browser.mjs "${url%/}/"
exit 0
;;
- *src/main.tsx*)
+ *src/app/main.tsx*)
# This one never resolves itself: it means Pages is pointed at
# the source branch, so there is no reason to keep waiting.
echo "::error::$url is serving this repository's source index.html instead of the build, so the page is blank. Set Settings -> Pages -> Build and deployment -> Source to 'Deploy from a branch', branch 'gh-pages' / (root)."
diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml
index ae8e286..ded32a9 100644
--- a/.github/workflows/release-please.yml
+++ b/.github/workflows/release-please.yml
@@ -105,7 +105,8 @@ jobs:
if: steps.target.outputs.tag != ''
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
- node-version: '22.23.5'
+ # Rebuild historical pre-SDK tags with their original toolchain.
+ node-version: ${{ hashFiles('released-source/scripts/build-sdk.mjs') != '' && '24.18.0' || '22.23.5' }}
package-manager-cache: false
- name: Build the standalone edition
@@ -150,6 +151,26 @@ jobs:
.tag_name == $tag and .name == ("OWASP DecodeBox " + $tag) and
any(.assets[]; .name == $name and .state == "uploaded" and .digest == $digest)'
+ - name: Attach SDK integrity manifest to the tagged release
+ if: steps.target.outputs.tag != ''
+ working-directory: released-source
+ env:
+ GH_TOKEN: ${{ github.token }}
+ RELEASE_TAG: ${{ steps.target.outputs.tag }}
+ run: |
+ # Historical tags predate the SDK distribution.
+ if [[ -f scripts/check-sdk-dist.mjs ]]; then
+ npm run check:sdk-dist
+ manifest="dist/sdk/v1/${RELEASE_TAG#v}/SHA256SUMS"
+ asset="DecodeBox-SDK-$RELEASE_TAG-SHA256SUMS"
+ cp "$manifest" "$RUNNER_TEMP/$asset"
+ if gh release view "$RELEASE_TAG" --json assets --jq '.assets[].name' | grep -Fx "$asset"; then
+ gh release download "$RELEASE_TAG" --pattern "$asset" --output - | cmp - "$manifest"
+ else
+ gh release upload "$RELEASE_TAG" "$RUNNER_TEMP/$asset"
+ fi
+ fi
+
- name: Create or update the Release Please PR
if: inputs.release_tag == ''
env:
diff --git a/.github/workflows/sbom.yml b/.github/workflows/sbom.yml
index 965dbcb..3693389 100644
--- a/.github/workflows/sbom.yml
+++ b/.github/workflows/sbom.yml
@@ -29,7 +29,7 @@ jobs:
- name: Use Node LTS
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
- node-version: '22'
+ node-version-file: '.nvmrc'
cache: npm
- name: Install clean packages
diff --git a/.nvmrc b/.nvmrc
index 2bd5a0a..a45fd52 100644
--- a/.nvmrc
+++ b/.nvmrc
@@ -1 +1 @@
-22
+24
diff --git a/README.md b/README.md
index 609157e..bf43a97 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,7 @@
# OWASP DecodeBox
+
+
[](https://owasp.org/projects/)
[](LICENSE)
[](https://decodebox.owasp.org/)
@@ -21,23 +23,36 @@ evidence you can inspect, and the steps that reach a layer can become an editabl
- **Detection.** Follow nested encodings, including encoded fields inside structured data.
The analysis shows where it found each indicator and what triggered each security finding.
-- **Recipes.** Choose from 504 operations to convert formats, decompress data, compute hashes,
+- **Recipes.** Use the operation catalogue to convert formats, decompress data, compute hashes,
or extract values. Adjust the arguments, reorder steps, and save the recipe for another input.
- **Capture the flag (CTF).** Search decoded layers for flag patterns, review ranked hints for
the next transformation, and copy the findings into a Markdown report.
-## Development
+## JavaScript SDK
+
+Embed operation discovery, recipes and multilayer analysis in a browser or Java-enabled GraalJS.
+The SDK uses the same local processing engine as the workbench. Run `npm ci` and
+`npm run build` with Node.js 24. Save this example as `dist/example.html`, open it in a
+browser and check the console for `Hello`.
+
+```html
+
+
+
+```
-For local development, clone the [source repository](https://github.com/OWASP/DecodeBox)
-and run these commands from its root with Node.js **22.12.0 or later**.
+See the [SDK guide](docs/sdk/README.md) for versioned downloads, module imports and integrity
+verification. See [runtime integrations](docs/sdk/integrations.md) for TypeScript and ZAP.
-```sh
-npm ci
-npm run dev
-```
+## Development
-Run `npm test -- --run` to execute the 1,205 tests. Run `npm run build` to produce the static
-site and the standalone edition.
+Use Node.js 24, run `npm ci`, then `npm run dev`. The [development guide](docs/development.md)
+covers regression tests and builds for the site, standalone application and SDK. See the
+[documentation index](docs/README.md) for the project layout and API reference.
## Standalone Edition
@@ -60,20 +75,6 @@ Contributions to operations should include test vectors. Follow the
[OWASP contributing guidelines](https://github.com/OWASP/.github/blob/master/CONTRIBUTING.md)
and [Code of Conduct](https://policy.owasp.org/operational/code-of-conduct).
-
-Source layout
-
-- The [engine interface] exposes decoding and analysis to the React [interface components].
-- The engine separates [operations], [format detection], and [recursive analysis].
-
-
-
-[Interface components]: src/components/
-[engine interface]: src/engine/index.ts
-[operations]: src/engine/operations/
-[format detection]: src/engine/detection/
-[recursive analysis]: src/engine/analysis/
-
## Project Leader
[Mohammad Hossein Sadeghian](https://github.com/m4sh-wacker)
diff --git a/docs/README.md b/docs/README.md
new file mode 100644
index 0000000..53efa8b
--- /dev/null
+++ b/docs/README.md
@@ -0,0 +1,10 @@
+# DecodeBox documentation
+
+Use the [workbench](https://decodebox.owasp.org/) to inspect data interactively, or embed the
+same operations and analysis engine in an application.
+
+- [Architecture](architecture.md) describes the workbench, worker, engine and runtime providers.
+- [Development](development.md) covers local development, tests, builds and publishing.
+- [JavaScript SDK](sdk/README.md) covers installation-free loading, distribution and versioning.
+- [API reference](sdk/api-reference.md) documents inputs, options, results and failure handling.
+- [Integrations](sdk/integrations.md) covers browsers, TypeScript, GraalJS and ZAP.
diff --git a/docs/architecture.md b/docs/architecture.md
new file mode 100644
index 0000000..bc011cd
--- /dev/null
+++ b/docs/architecture.md
@@ -0,0 +1,24 @@
+# Architecture
+
+The React entry point lives in [src/app](../src/app/). Components, hooks, Zustand state,
+translations and styles have their own directories under `src/`. UI conveniences such as
+favorites, recipe sharing and browser storage belong to the application.
+
+The application calls the [engine façade](../src/engine/index.ts), which loads the processing
+code on demand. The [worker](../src/engine/worker/) handles work away from the UI thread.
+The standalone HTML embeds its scripts, styles and fonts and runs the engine on the main thread.
+
+The [operation registry](../src/engine/operations/index.ts) owns operation IDs, arguments,
+metadata and implementations. [Core](../src/engine/core/) executes recipes and handles bytes.
+Detection, recursive analysis, inspection and CTF hints use these same operations.
+Engine regression tests live in [src/engine/tests](../src/engine/tests/).
+
+The [SDK](../src/sdk/index.ts) validates requests and exposes detached registry metadata.
+The classic entry point installs the global object. The module entry point exports the same API.
+Neither calls React, the application store or the worker client.
+
+Platform services implement the [runtime interface](../src/engine/runtime/provider.ts).
+The web provider uses native browser primitives. The SDK selects the Java provider when GraalJS
+exposes Java interop. It uses JCA, SecureRandom, in-memory ZIP streams and Java time zone rules.
+Bundled encoding and URL parsers cover APIs that plain GraalJS lacks. The host controls access
+to Java classes. New adapters belong behind this internal interface.
diff --git a/docs/development.md b/docs/development.md
new file mode 100644
index 0000000..40b487a
--- /dev/null
+++ b/docs/development.md
@@ -0,0 +1,44 @@
+# Development
+
+Use Node.js 24 for development and distribution. CI also verifies Node.js 22.12 or later in the
+22.x series. Install the locked dependencies at the repository root.
+
+```sh
+npm ci
+npm run dev
+```
+
+Before submitting changes, run the same checks as CI.
+
+```sh
+npm run lint
+npm run typecheck
+npm test -- --run
+npm run build
+npm run check:sdk-dist
+```
+
+The build writes the site to `dist/`, the offline application to `dist/decodebox.html`, and
+the SDK to the [distribution paths](sdk/README.md#distribution). Use `npm run preview` for
+the site, or open the standalone file from disk. `npm run build:sdk` rebuilds the SDK alone.
+The distribution check executes both module formats and verifies alias bytes and release hashes.
+CI also loads every JavaScript entry point in Chrome and checks SHA-256 with the Java provider.
+To run the browser check against a local preview, use the URL printed by Vite.
+
+```sh
+node scripts/check-sdk-browser.mjs http://localhost:4173/
+```
+
+## Changes and releases
+
+Add operations to the existing registry and supply operation-specific regression vectors.
+Keep platform-dependent services in the runtime providers. Changes to public SDK functions
+also need contract tests in [src/sdk/sdk.test.ts](../src/sdk/sdk.test.ts) and an API reference
+update. Submit changes on a temporary branch targeting `main`.
+
+Release Please manages the project version. The SDK's API major is independent of that version.
+The Pages workflow builds from source, carries forward previous SDK releases and the configured
+custom domain, and publishes generated files to the root of `gh-pages`. It stops if an existing
+version directory would change. A changed release artifact needs a new engine version through
+the normal release process. For tags that contain the SDK, the release workflow attaches
+the matching checksum manifest. Production bundles and test output stay outside the source tree.
diff --git a/docs/sdk/README.md b/docs/sdk/README.md
new file mode 100644
index 0000000..f27fc61
--- /dev/null
+++ b/docs/sdk/README.md
@@ -0,0 +1,59 @@
+# JavaScript SDK
+
+DecodeBox exposes the workbench engine to browsers and Java-enabled GraalJS. Processing takes
+place in the consuming runtime. The `/api` resource distributes the classic JavaScript SDK.
+There is no REST endpoint for submitting data.
+
+## Quick start
+
+From the repository root with Node.js 24 installed, run `npm ci` and `npm run build`.
+Save the following as `dist/example.html`, alongside the generated `api.js`. Open it in
+a browser and look for `Hello` in the developer console. This example works offline once built.
+
+```html
+
+
+
+```
+
+## Distribution
+
+| Format | Following the current build | Fixed engine release |
+| --- | --- | --- |
+| Classic | `/api`, `/api.js`, `/sdk/decodebox.js`, `/sdk/v1/decodebox.js` | `/sdk/v1/{engineVersion}/decodebox.js` |
+| ES module | `/sdk/decodebox.mjs`, `/sdk/v1/decodebox.esm.js` | `/sdk/v1/{engineVersion}/decodebox.mjs` |
+| Module declarations | `/sdk/decodebox.d.mts` | `/sdk/v1/{engineVersion}/decodebox.d.mts` |
+
+The integration build also emits `/sdk/v1/{engineVersion}/SHA256SUMS`. The API version tracks
+the public contract. The engine version follows the project's release. Applications that rely
+on particular operation behavior can pin a release and verify its bytes.
+
+Publication at `https://decodebox.owasp.org` is pending deployment. GitHub Pages controls
+the response type of `/api`. Use `/api.js` for hosts that require a JavaScript MIME type
+and the module path for imports. The classic bundle carries a UTF-8 signature for pages with
+a legacy character encoding.
+
+## Integrity and offline use
+
+For an official release that includes the SDK, obtain `DecodeBox-SDK-vX.Y.Z-SHA256SUMS`
+from the corresponding [OWASP release](https://github.com/OWASP/DecodeBox/releases).
+Download the three versioned files into one directory and run the following there,
+substituting the actual release tag.
+
+```sh
+sha256sum -c DecodeBox-SDK-vX.Y.Z-SHA256SUMS
+```
+
+Use the hash of the exact file your integration loads. A digest fetched alongside a file can
+detect corruption. Establish provenance through a separately trusted release or a pin supplied
+by your administrator. The Pages manifest alone cannot authenticate the publisher.
+
+You can serve the verified files from your own static origin, next to the consuming app, or
+load the classic bundle from disk. A local copy includes the engine and its dependencies.
+Processing requires no external network access or package installation.
+
+See the [API reference](api-reference.md) and [runtime integrations](integrations.md).
diff --git a/docs/sdk/api-reference.md b/docs/sdk/api-reference.md
new file mode 100644
index 0000000..de9d301
--- /dev/null
+++ b/docs/sdk/api-reference.md
@@ -0,0 +1,74 @@
+# SDK API reference
+
+The classic bundle exposes `globalThis.DecodeBox`. ES modules provide a default export,
+a named `DecodeBox`, individual methods and the `DecodeBoxError` class. Initialization installs
+the classic namespace synchronously. Await `ready` before beginning work.
+
+| Member | Result |
+| --- | --- |
+| `apiVersion`, `engineVersion` | Public contract and engine release version strings. |
+| `capabilities()` | Active runtime, available crypto, randomness, compression formats, charsets and size limits. |
+| `listOperations()` | Detached operation definitions with stable IDs, aliases and argument metadata. |
+| `getOperation(id)` | One definition, or `null` for an unknown ID. |
+| `executeOperation(id, input, args?)` | Promise of a string. Rejects on validation or execution failure. |
+| `bake(input, recipe)` | Promise of output, output type, byte length, elapsed time, completed operation IDs and an optional step error. |
+| `detect(input)` | Ranked candidates with evidence, previews and recipe steps. |
+| `autoDecode(input, options?)` | Tree of decoded layers with stopping reasons. |
+| `identify(input)` | Hash identification or `null`. |
+| `analyse(input, options?)` | Analysis tree, indicators, findings and truncation information. |
+| `inspect(input, {decode?, analyse?}?)` | Decoded root and analysis together. |
+| `hints(input, options?)` | CTF flags and suggested transformations. |
+
+Processing and analysis methods return promises. Discovery and capability methods are synchronous.
+
+## Discovery, arguments and recipes
+
+```js
+const op = DecodeBox.getOperation("to-base64");
+console.log(op.id, op.args.map(({ name, value }) => [name, value]));
+const digest = await DecodeBox.executeOperation("sha-256", "abc");
+const recipe = [{ opId: "gzip" }, { opId: "gunzip" }, { opId: "to-base64" }];
+const result = await DecodeBox.bake(Uint8Array.of(0, 128, 255), recipe);
+if (result.error) throw new Error(result.error.message);
+console.log(digest, result.output); // binary round trip: AID/
+```
+
+Omitted arguments use the values in the operation definition. Supply exact argument names
+and the declared types, options and ranges. A toggle-string accepts a string or
+`{ value, format }` using one of its `toggleValues`. A recipe accepts an array of
+`{ opId, args?, disabled? }`, engine steps returned by detection, or an object with a
+`steps` array. Unknown IDs, unknown arguments and invalid option values fail validation.
+
+Strings carry text. Supply a `Uint8Array` or `ArrayBuffer` for bytes; views preserve their
+offset and length. Binary operation results are strings with one code unit per byte.
+Convert a binary result with `Uint8Array.from(output, c => c.charCodeAt(0))`. For Unicode text,
+use the operation's charset setting where available. The output type on a recipe is descriptive.
+
+## Detection and bounded analysis
+
+```js
+const input = "U0dWc2JHOD0=";
+const candidates = await DecodeBox.detect(input);
+const { root, analysis } = await DecodeBox.inspect(input, {
+ decode: { maxDepth: 4 }, analyse: { maxNodes: 32 },
+});
+console.log(candidates.length, root, analysis);
+```
+
+Automatic decoding defaults to depth 64, 10,000 ms and confidence threshold 0.55. Analysis
+defaults to depth 64, 128 nodes, 10,000 ms and threshold 0.5. Both accept up to 60,000 ms.
+Analysis accepts at most 1,024 nodes. Hints accept a format string, depth and time budget.
+
+## Errors and limits
+
+Inspect `error.code` on rejected SDK validation and operation calls. Codes are
+`INVALID_INPUT`, `UNKNOWN_OPERATION`, `LIMIT_EXCEEDED` and `OPERATION_FAILED`.
+A recipe that fails inside the engine resolves with `error.stepIndex` and `error.message`;
+validation can reject the recipe before execution begins. Check both outcomes.
+
+Inputs and aggregate string arguments are limited to 4 MiB in bytes or UTF-16 code units.
+Recipes accept up to 128 steps. Step output and decompression are bounded at 16 MiB.
+Some formats and algorithms impose tighter limits. Time budgets are cooperative. A synchronous
+regular expression, KDF or host operation can occupy its thread until it returns. Execute
+untrusted recipes in a terminable worker or a resource-limited host process when a hard wall
+clock or memory limit is required.
diff --git a/docs/sdk/integrations.md b/docs/sdk/integrations.md
new file mode 100644
index 0000000..f17f38f
--- /dev/null
+++ b/docs/sdk/integrations.md
@@ -0,0 +1,82 @@
+# Runtime integrations
+
+## Browser and TypeScript
+
+Load a classic script as shown in the [quick start](README.md#quick-start), or import the ES
+module in a module script. Serve the file with a JavaScript MIME type. Cross-origin imports
+also require CORS. For a restrictive CSP, serve a verified copy from an allowed origin.
+Browser cryptography requires the host's secure-context APIs.
+
+```js
+import DecodeBox from "./sdk/decodebox.mjs";
+await DecodeBox.ready;
+const encoded = await DecodeBox.executeOperation("to-base64", "Hello");
+console.log(encoded); // SGVsbG8=
+```
+
+For TypeScript, keep `decodebox.d.mts` next to `decodebox.mjs` and use a resolver that
+understands ESM declarations, such as `NodeNext` or `Bundler`.
+
+```ts
+import sdk, { type Step } from "./sdk/decodebox.mjs";
+const steps: Step[] = [{ opId: "from-base64" }];
+const result = await sdk.bake("SGVsbG8=", steps);
+if (result.error) throw new Error(result.error.message);
+console.log(result.output); // Hello
+```
+
+Node.js 22.12+ and 24 can also import the locally built `./sdk/decodebox.mjs` from an
+ES module beside the `sdk` directory. The example above uses only the shared Web APIs.
+
+The web provider uses Web Crypto, secure random bytes, platform encoders, URL parsing and
+compression streams. Inspect `capabilities()` for the actual host. Updating browser or JDK
+time zone data can change historical abbreviations.
+
+## GraalJS
+
+Supply the verified classic bundle as a local script to a Java-enabled GraalJS context.
+Shell-style `load` and `print` must be available for this example.
+
+```js
+load("decodebox.js");
+DecodeBox.ready
+ .then(() => DecodeBox.executeOperation("sha-256", "abc"))
+ .then(print);
+```
+
+Java class lookup and access to the provider's JCA, time, encoding, byte-array and compression
+services must be permitted by the embedding host. Restrict host access to trusted scripts.
+Loading by URL requires host I/O and a GraalJS configuration permitting `js.load-from-url`.
+A locally verified bundle avoids granting remote-loading permission. Processing makes no
+outbound requests. Promises settle at the owning context's microtask checkpoints. Operations
+that sleep or call synchronous Java code occupy that thread. The provider checks its deadline
+after a blocking call returns. Hosts that require a hard deadline must enforce it externally.
+
+The Java adapter keeps JCA keys and secret bytes in the provider instance that created them.
+Handles carry read-only metadata. Only an extractable key can be exported. For JWK conversion,
+the adapter accepts two-prime RSA private keys with complete CRT fields, and P-256, P-384 or
+P-521 EC keys. It checks declared uses, algorithm identifiers and public/private components.
+Choose the matching RSA hash in the JWK to PEM operation.
+
+## ZAP
+
+In the Script Console, select **Stand Alone** and **ECMAScript : Graal.js**. Set the
+`DECODEBOX_SDK` environment variable to the absolute path to a verified local classic bundle
+before starting ZAP. Run this script and check its output in the console.
+
+```js
+const path = Java.type("java.lang.System").getenv("DECODEBOX_SDK");
+if (!path) throw new Error("Set DECODEBOX_SDK to a verified local file");
+load(String(path));
+DecodeBox.ready.then(async () => {
+ const output = await DecodeBox.executeOperation("from-base64", "SGVsbG8gWkFQ");
+ if (output !== "Hello ZAP") throw new Error("Unexpected decoded text");
+ print(output);
+});
+```
+
+The separate [native ZAP add-on](https://github.com/m4sh-wacker/DecodeBox-ZAP-Addon)
+has its own trust policy. It checks SDK size, API major and SHA-256. A changed bundle needs
+a separately trusted digest or the add-on's supported approval process. A plain checksum list
+does not satisfy its signed-manifest mode. Host permissions and trusted pins are managed by the
+consumer. See [integrity and offline use](README.md#integrity-and-offline-use).
diff --git a/eslint.config.js b/eslint.config.js
index 461c0ee..ee2dd75 100644
--- a/eslint.config.js
+++ b/eslint.config.js
@@ -6,6 +6,17 @@ import reactRefresh from 'eslint-plugin-react-refresh';
export default tseslint.config(
{ ignores: ['dist', 'node_modules'] },
+ {
+ files: ['scripts/*.mjs', 'src/engine/runtime/*.js'],
+ extends: [js.configs.recommended],
+ languageOptions: { globals: { ...globals.node, Java: 'readonly' } },
+ rules: {
+ 'no-empty': ['error', { allowEmptyCatch: true }],
+ 'no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
+ 'no-eval': 'error',
+ 'no-new-func': 'error',
+ },
+ },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
diff --git a/index.html b/index.html
index 38bba43..33e0149 100644
--- a/index.html
+++ b/index.html
@@ -50,6 +50,6 @@
DecodeBox runs entirely in your browser and needs JavaScript enabled. Nothing you paste is
ever uploaded — the processing has to happen locally, which is the point.
-
+