{% extends "base.html" %} {% block title %}AI CAPTCHA — Embed Demo{% endblock %} {% block og_title %}AI CAPTCHA — Embed Demo{% endblock %} {% block content %}

Embed Demo

A live, working example of the iframe embed. This page creates a throwaway embed site, frames the challenge widget, and shows the postMessage events + a real /api/siteverify call.

🧩 The Widget (iframe)

This is the actual <iframe> served by GET /embed?sitekey=…&origin=…. Solve the puzzles to earn a token.

Creating embed site & loading widget…

Sitekey: —

📡 postMessage Events

The iframe posts these to the host. The host must check event.origin + event.source and verify the token server-side.

(waiting for events…)

🔐 Server-side Verification (POST /api/siteverify)

The security-critical step: the host backend calls /api/siteverify with the secretkey + token. A forged or replayed token is rejected. This demo calls it from the browser so you can see the response — in production the secretkey never leaves your server.

No token yet — solve the widget first.

📋 Copy-paste embed snippet

Use this on any site (replace YOUR_SITEKEY with a real one from POST /api/embed/sites).


    
{% endblock %}