Skip to main content
A clearance is one signed record of a probe, or of a probe and the ceremony that followed it. It is a JWT signed with Ed25519 under a key pair that belongs to your site. Your server or edge verifies it with the site’s public key from GET /v1/clearance/keys; Heretic is never in the request path. Heretic signs what it measured, including a contradicted verdict, and never withholds or reads back the token. A probe-only token is typically about 1.1 KB; a ceremony adds its device record. Each measurement session opened counts as a probe, and each ceremony minted counts as a challenge against your plan. Reading a clearance cookie does not start another measurement.

Hosted page

Redirect an uncleared request to the hosted page. It runs the probe, escalates per the site’s clearance settings, and returns to your URL with heretic_clearance=<jwt> appended to the query.
return must be https://, or loopback http://, on the site’s registered domain. Any other value is refused on the page and never redirected. Start with the complete Cloudflare Worker gate in examples/cloudflare-worker/. Its README and configuration template cover installation on an existing website. The download also includes Node, Python and PHP verifiers for an application gate.
  1. Create a site and verify its domain in the dashboard.
  2. Set the hosted page’s lifetime and escalation settings on that site’s panel.
  3. Configure the gate with the site’s public key and protected routes, then choose your admission rule.
  4. Deploy the gate at your edge or in your application. Heretic hosts the verification page; your gate handles redirects and cookies.
The example binds the return to a random browser state, verifies the signed record, applies its admission rule, and sets an HttpOnly, Secure, host-only cookie. It strips the token from the URL before serving content. A rejected result receives 403. A key-service failure receives 503. Requests with bodies receive 403 until clearance is established, so a redirect never discards or replays a form submission. Protect every intended route, including API and export URLs. Keep public exceptions explicit. Restrict direct origin access so visitors cannot bypass your gate. Exclude callback tokens from access logs and analytics. For managed background preparation, reuse and action-time challenges, use the application SDK. The widget interface below remains available for custom integrations.

Background

Load guard.js with data-clearance="true". The embed starts the probe automatically; it may display a ceremony according to your escalation settings. Then data-clearance-callback receives the JWT. Post it to your own endpoint, which verifies it and sets the cookie for the next request.
heretic.getClearance(id) reads the JWT of a widget rendered with the script API.

Guarded action

For a fresh single-use check, a form keeps the five-minute proof and siteverify. To reuse clearance, verify its cookie and apply your rule in the form handler instead. Clearance JWTs are not accepted by siteverify. Keep authentication, CSRF checks and action deduplication in your application. Configure the widget on the challenge widget page.

What the token contains

Header: alg is EdDSA, typ is JWT, and kid is site_<id>/<version>.
When a ceremony ran:
device is the device the ceremony cleared: the desktop in a QR hand-off, otherwise the phone. Its identity hashes are in the challenge scope. Compare them only with other ceremony devices, never with probe.identity.

Your rule

Verify the signature, iss, aud, iat, exp and site key, then apply your own rule. This example accepts an uncontradicted probe without concealment, or a passed ceremony, and requires the live request to come from the measured address and network. It is this site’s rule, not a Heretic threshold.

Facts

The hosted page is the only placement that gates the first request. It adds a wait of a few seconds for each fresh probe; a ceremony takes longer. The page is distributed globally, and measurements currently run against the Warsaw sensor. A client that does not run the collector is never cleared. That includes search crawlers. What happens to an uncleared request is your rule. Findings and concealment indicators are not in the token. The visitor can read the token. Read them with your secret key at GET /v1/verdict/{request_id}.

Dashboard settings

On the site’s panel in the dashboard:

Verifiers

The server examples include node/clearance.mjs, python/clearance.py, php/Clearance.php, and a Cloudflare Worker gate at examples/cloudflare-worker/clearance-gate.js.