feat(client): silent wd_clearance minting — closes the #124 loop (SDK half)#6
Merged
Conversation
… half) Real browsers now earn and carry a wd_clearance cookie during normal browsing, so the decoy → deny-list binding (#124, server side already shipped) works in monitor / allow-and-observe mode, not just after an enforce-mode challenge. - clearance.ts: computeDeviceFP (pure — consumes the collector's canvas + WebGL output, does no canvas/WebGL of its own; stable subset only, no UA) and startClearance (deferred to idle, at most once per session, skips when a fresh cookie exists, refreshes before the 30-min expiry, never solves a PoW). - global.ts: the standalone script auto-starts clearance from a data-site-key attribute (data-ingest / data-scope optional). - clearance.test.ts: locks the fp contract — canonical string, a GOLDEN hash the edge challenge page cross-asserts, the no-canvas guarantee, and graceful "na" degradation. The fp algorithm is a cross-repo CONTRACT with the edge challenge page (app: edge/clearance-worker) — identical version prefix "wdfp1", field order, canvas 32-bit hash, and WebGL extraction. Verified: SDK, worker, and golden vector all produce the same hash.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The SDK half of the decoy → deny-list loop (app-side #124 shipped the server half). Real browsers now silently earn and carry a
wd_clearancecookie during normal browsing, so the loop works in monitor / allow-and-observe mode — not just after an enforce-mode challenge.What's added (
@webdecoy/client)clearance.tscomputeDeviceFP(env)— pure: consumes the collector's already-computed canvas + WebGL signals and does no canvas/WebGL of its own. Stable device subset only (canvas, WebGL, screen, timezone, platform, language); no User-Agent (avoids churn on browser auto-update).startClearance(opts)— deferred to browser idle, at most once per session, skips when a fresh cookie already exists, refreshes before the 30-min expiry, and never solves a proof-of-work. Zero page-load cost.global.ts— the standalone script auto-starts clearance from adata-site-keyattribute (data-ingest/data-scopeoptional).clearance.test.ts— locks the fp contract: the canonical string, a golden hash the edge challenge page cross-asserts, the no-canvas guarantee, and gracefulnadegradation.The cross-repo contract
The fp algorithm is byte-identical to the edge challenge page (app repo
edge/clearance-worker, companion PR): samewdfp1version prefix, field order, canvas 32-bit rolling hash (matchingEnvironmentalCollector._getCanvasHash), and WebGL extraction. Verified: the SDK, the worker, and the golden vector all produce the same hash. If either side drifts, the golden-vector test fails.Performance
Per the constraints on the tracking issue: one deferred background request + one small hash + one cookie write, once per session, riding on signals the collector already gathers. No new fingerprinting, no new PoW, no blocking main-thread work.
Verify
tsc --noEmitclean;turbo buildgreen (IIFE + CJS + ESM + DTS); full client jest suite passes (10/10, incl. 4 new).