From f181f1bfc73e49a07cad97c12e1c2e3b8485b33a Mon Sep 17 00:00:00 2001
From: mannubaveja007 <23bis70088@cuchd.in>
Date: Tue, 1 Dec 2026 17:24:22 +0530
Subject: [PATCH 1/5] Build the DecodeBox Developer Portal and generated
references
---
.github/workflows/ci.yml | 11 +
.github/workflows/deploy-pages.yml | 28 +-
README.md | 30 +-
docs/.gitignore | 5 +
docs/README.md | 43 +-
docs/architecture.md | 24 -
docs/content/guide/browser.md | 36 +
docs/content/guide/changelog.md | 10 +
docs/content/guide/examples.md | 56 +
docs/content/guide/index.md | 16 +
docs/content/guide/node.md | 56 +
docs/content/guide/quick-start.md | 28 +
docs/content/index.mdx | 49 +
docs/development.md | 44 -
docs/package-lock.json | 3775 ++++++++++++++++++++++++++++
docs/package.json | 28 +
docs/rspress.config.ts | 47 +
docs/scripts/check.mjs | 91 +
docs/scripts/generate.mjs | 110 +
docs/sdk/README.md | 114 -
docs/sdk/api-reference.md | 74 -
docs/sdk/integrations.md | 92 -
docs/theme/style.css | 101 +
docs/tsconfig.json | 8 +
docs/typedoc.tsconfig.json | 4 +
25 files changed, 4496 insertions(+), 384 deletions(-)
create mode 100644 docs/.gitignore
delete mode 100644 docs/architecture.md
create mode 100644 docs/content/guide/browser.md
create mode 100644 docs/content/guide/changelog.md
create mode 100644 docs/content/guide/examples.md
create mode 100644 docs/content/guide/index.md
create mode 100644 docs/content/guide/node.md
create mode 100644 docs/content/guide/quick-start.md
create mode 100644 docs/content/index.mdx
delete mode 100644 docs/development.md
create mode 100644 docs/package-lock.json
create mode 100644 docs/package.json
create mode 100644 docs/rspress.config.ts
create mode 100644 docs/scripts/check.mjs
create mode 100644 docs/scripts/generate.mjs
delete mode 100644 docs/sdk/README.md
delete mode 100644 docs/sdk/api-reference.md
delete mode 100644 docs/sdk/integrations.md
create mode 100644 docs/theme/style.css
create mode 100644 docs/tsconfig.json
create mode 100644 docs/typedoc.tsconfig.json
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1acaac9..7a12ca6 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -39,6 +39,9 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: npm
+ cache-dependency-path: |
+ package-lock.json
+ docs/package-lock.json
- name: Install clean packages
run: npm clean-install
@@ -55,6 +58,14 @@ jobs:
- name: Build
run: npm run build
+ - name: Build and verify the Developer Portal
+ if: matrix.node-version == '24'
+ working-directory: docs
+ run: |
+ npm ci
+ npm run build:site
+ npm run typecheck
+
- name: Verify SDK distribution
run: npm run check:sdk-dist
diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml
index 8e3b5f0..a64d0c1 100644
--- a/.github/workflows/deploy-pages.yml
+++ b/.github/workflows/deploy-pages.yml
@@ -57,6 +57,9 @@ jobs:
with:
node-version-file: '.nvmrc'
cache: npm
+ cache-dependency-path: |
+ package-lock.json
+ docs/package-lock.json
- name: Install clean packages
run: npm clean-install
@@ -64,6 +67,13 @@ jobs:
- name: Build
run: npm run build
+ - name: Build the Developer Portal
+ working-directory: docs
+ run: |
+ npm ci
+ npm run build:site
+ npm run typecheck
+
- name: Check new SDK artifacts and retain published versions
env:
GH_TOKEN: ${{ github.token }}
@@ -105,6 +115,7 @@ jobs:
run: |
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; }
+ test -s dist/docs/index.html || { echo "::error::dist/docs/index.html is missing"; 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
@@ -173,14 +184,19 @@ jobs:
# that finishes does the CDN start serving the new files. It usually
# takes a minute; it has taken twenty. Eight attempts over 160 seconds
# was calling that a failure, which is a check that cries wolf.
+ docs_url="${url%/}/docs/"
+ docs_body=$(mktemp)
+ trap 'rm -f "$docs_body"' EXIT
for attempt in $(seq 1 24); do
body=$(curl -fsSL --max-time 30 "$url" || true)
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
+ if curl -fsSL --max-time 30 "$docs_url" -o "$docs_body" && cmp -s dist/docs/index.html "$docs_body"; then
+ echo "$url and $docs_url are serving this build."
+ npm run check:sdk-dist -- dist "$url"
+ node scripts/check-sdk-browser.mjs "${url%/}/"
+ exit 0
+ fi
;;
*src/app/main.tsx*)
# This one never resolves itself: it means Pages is pointed at
@@ -189,8 +205,8 @@ jobs:
exit 1
;;
esac
- echo "Attempt $attempt/24: $url is not serving $entry yet."
+ echo "Attempt $attempt/24: the application and Developer Portal are not both serving this build yet."
sleep 20
done
- echo "::error::$url did not serve $entry within eight minutes. gh-pages has the build - check whether GitHub's own 'pages build and deployment' run is still queued, and re-run this job once it has finished."
+ echo "::error::$url and $docs_url did not serve the expected build within eight minutes. gh-pages has the build - check whether GitHub's own 'pages build and deployment' run is still queued, and re-run this job once it has finished."
exit 1
diff --git a/README.md b/README.md
index e5bafb4..f6cf0d4 100644
--- a/README.md
+++ b/README.md
@@ -26,32 +26,18 @@ evidence you can inspect, and the steps that reach a layer can become an editabl
- **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.
-## JavaScript SDK
-
-Use the workbench’s operations, recipes and multilayer analysis in browsers or Java-enabled GraalJS.
-**Official SDK deployment is pending.** Once published, add this snippet to an HTML page
-and open the console to see `Hello`. The hosted SDK runs in the browser without a local build.
-
-```html
-
-
-
-```
+## Documentation
-The [SDK guide](docs/sdk/README.md) explains the distribution paths and versioning.
-To use the SDK before deployment, follow
-[local and offline setup](docs/sdk/README.md#local-development--offline-usage).
+[DecodeBox Developer Portal](https://decodebox.owasp.org/docs)
## Development
-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.
+Use Node.js 24. Install dependencies and start the development server:
+
+```bash
+npm ci
+npm run dev
+```
## Standalone Edition
diff --git a/docs/.gitignore b/docs/.gitignore
new file mode 100644
index 0000000..a6a6ca9
--- /dev/null
+++ b/docs/.gitignore
@@ -0,0 +1,5 @@
+.rspress/
+generated/
+content/operations/
+content/sdk-reference/
+content/public/
diff --git a/docs/README.md b/docs/README.md
index d3a5cd6..f4b5629 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -1,10 +1,37 @@
-# DecodeBox documentation
+# DecodeBox Developer Portal
-Use the [workbench](https://decodebox.owasp.org/) to inspect data interactively, or embed the
-same operations and analysis engine in an application.
+The portal uses Rspress and is published under
+[decodebox.owasp.org/docs](https://decodebox.owasp.org/docs).
-- [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 the hosted Quick Start, distribution paths and offline use.
-- [API reference](sdk/api-reference.md) documents inputs, options, results and failure handling.
-- [Integrations](sdk/integrations.md) covers browsers, TypeScript, GraalJS and ZAP.
+## Local development
+
+Use Node.js 24. From the repository root, install the application dependencies,
+then start the documentation development server:
+
+```bash
+npm ci
+cd docs
+npm ci
+npm run dev
+```
+
+Open the URL printed by Rspress at the `/docs/` path. Restart the server after
+changing the SDK to regenerate the references and refresh the local SDK bundle.
+
+## Production build
+
+From the repository root:
+
+```bash
+npm run build
+npm --prefix docs run build:site
+npm run preview
+```
+
+The root build creates the application, standalone edition and official SDK.
+The portal build generates SDK and operation Markdown from that SDK and places
+the website under `dist/docs/`. Open `/docs/` on the Vite preview server to
+preview the complete artifact with the SDK served from the same origin.
+
+Edit the authored pages in `content/`. The build recreates the reference pages
+and navigation, so changes to those belong in the SDK or generator.
diff --git a/docs/architecture.md b/docs/architecture.md
deleted file mode 100644
index bc011cd..0000000
--- a/docs/architecture.md
+++ /dev/null
@@ -1,24 +0,0 @@
-# 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/content/guide/browser.md b/docs/content/guide/browser.md
new file mode 100644
index 0000000..90ec421
--- /dev/null
+++ b/docs/content/guide/browser.md
@@ -0,0 +1,36 @@
+# Browser integration
+
+## Classic script
+
+The hosted `/api.js` bundle exposes the global `DecodeBox` object. Use it with a classic script tag
+and await `DecodeBox.ready` before calling the SDK.
+
+```html
+
+
+```
+
+The extensionless `/api` alias serves the same classic bundle and is used by the existing ZAP
+add-on. SDK calls run in the application that loads the script.
+
+## ES module
+
+Import the SDK in an external module or a `
+
+