ACCUZ® Brand Guard™ / SDK 1.3.3 / HTTP API v1

Cloudflare deployment

Start here

Prepare one approved entry

Use Node.js ≥22.12 and npm (validated with Node 24.16 and Wrangler 4.163.0). The site must be an active Cloudflare zone in the account that will own this Worker and its SQLite Durable Objects. Use a Worker Route in front of your existing HTTPS origin. If your site uses Cloudflare Pages or another Worker, integrate and test the origin/ASSETS passthrough first. Existing product HTML, header and footer remain on your site.

Copy config/site.example.json to config/site.local.json. Replace websiteOrigin with the exact approved HTTPS origin, apiOrigin with the administrator-assigned API origin, and encodingVersionId with its issued 1–32 visible ASCII identifier. Keep entryPath /v only if that is the approved path written to the tags. Keep regionEnabled false unless separately authorized. Never put token values in this JSON.

Edit wrangler.toml: choose your Worker name once, replace website.example in all route patterns and zone_name, and preserve SESSIONS, VerificationSession and the v1 SQLite migration. If using a subdomain, route the exact subdomain and use its parent Cloudflare zone_name. Preserve the same Worker name and namespace on upgrades; a different Worker starts separate state. The /v* route includes dynamic query strings; code handles only the exact configured entry. If you change the first-hop route, always retain the fixed /v/result* and /bg/* routes: neutral results remain at /v/result, and /bg/* serves the component and saved results.

node --version
npm --version
npm exec --yes --package=wrangler@4.163.0 -- wrangler --version

Run locally and check the bundle

From the extracted SDK root, run the simulator, then open its loopback URL. It uses synthetic data and sends no verification API requests. Stop it with Ctrl+C. npm test is dependency-free; npm run test:full installs pinned native tooling on its first run and executes real workerd/SQLite tests. Registry access is required. Reports stay in test-output/.

The dry-run below compiles the actual Worker without deploying, logging in or contacting the verification API. It does not prove route ownership, configured secrets, customer-site behavior or physical acceptance. Do not use a production-origin config at http://localhost and interpret origin rejection as a tag failure.

node reference/node-server.mjs
# Stop the simulator before continuing.
npm test
npm run test:full
npm exec --yes --package=wrangler@4.163.0 -- wrangler deploy --config wrangler.toml --dry-run --outdir test-output/worker-dry-run

Create the private secret file

Obtain the verification token through the agreed secret channel. Run the helper below in an interactive terminal: it validates the config and prompts for BRANDGUARD_VERIFICATION_TOKEN with input hidden. Automated environments may set that named environment variable in their secret manager. Do not paste its value into commands. The output file contains SITE_CONFIG and the token together, is ignored by Git, and is created without overwriting an existing file.

Keep the private file outside public assets and access limited to the deploying account. It is a local secret, never an attachment to this setup form or a published artifact. If it already exists, verify and deliberately retire the old private copy before generating another; the helper refuses to overwrite. Windows file permissions follow the containing directory ACL, so use a private user directory/working copy.

node scripts/worker-secrets.mjs --config config/site.local.json --out .worker.secrets.local.json

Deploy code and required secrets together

These commands change your Cloudflare account. Review the actual hostname, Worker name and private config before you run them. Login selects your own account; secrets-file uploads SITE_CONFIG and BRANDGUARD_VERIFICATION_TOKEN with the Worker in one deployment. The [secrets].required declaration prevents a real deployment with missing required secrets. Do not use separate secret put steps to deploy an initially incomplete Worker.

After deployment, open an ordinary product page directly: no new verified badge should appear. Perform the anonymous probe in the first-live guide, then use one fresh physical tap with the assigned encoding and compare verificationId, itemId, decidedAt and the decision with the administrator. Refresh and language switching retain the original time/count. A copied URL or used reading must not create a new pass. Remove the local secret file after confirming it is safely retained in your authorized secret store; never publish it.

npm exec --yes --package=wrangler@4.163.0 -- wrangler login
npm exec --yes --package=wrangler@4.163.0 -- wrangler deploy --config wrangler.toml --secrets-file .worker.secrets.local.json

Rotate a credential on an already complete Worker

After the Worker already has its complete valid SITE_CONFIG and required secrets, use the command below for an issued replacement credential. Wrangler prompts for the value; enter it there, never in the command. secret put immediately creates and deploys a new Worker version. Coordinate credential activation/revocation with the administrator and verify a fresh tap. This is a customer-operated production change, not a local test.

For the advanced template, rotate the intended named binding A or B with --config wrangler.advanced.toml. Do not replace one entry credential with another or use this to publish an initially incomplete Worker.

npm exec --yes --package=wrangler@4.163.0 -- wrangler secret put BRANDGUARD_VERIFICATION_TOKEN --config wrangler.toml

Advanced multiple exact entries

Only if two approved encodings require separate paths, start from config/advanced-multi-entry.example.json and wrangler.advanced.toml. Save the edited config to config/site.local.json. entrypoints replaces entryPath/encodingVersionId; do not mix both schemas. Supply separate BRANDGUARD_VERIFICATION_TOKEN_A and BRANDGUARD_VERIFICATION_TOKEN_B bindings. Replace every placeholder, including /scan/verify if your approved path differs. Keep the same Worker name for an upgrade. This cannot change any already-written tag.

For local advanced simulation only, set BG_SITE_CONFIG to config/advanced-multi-entry.example.json before starting the Node simulator. For live setup, rerun the same helper with your private advanced config; it prompts for both bindings. Use the advanced template in both dry-run and real deploy. One path selects exactly one encoding and secret before knowing the SKU; the adapter never tries alternatives.

npm exec --yes --package=wrangler@4.163.0 -- wrangler deploy --config wrangler.advanced.toml --dry-run --outdir test-output/advanced-worker-dry-run
# After private config and both secrets are ready:
npm exec --yes --package=wrangler@4.163.0 -- wrangler deploy --config wrangler.advanced.toml --secrets-file .worker.secrets.local.json

CLI and configuration references: Wrangler configuration · Worker secrets