
CAPTCHA prova que você é humano. HATCHA prova que você não é.
CAPTCHA prova que você é humano. HATCHA prova que você não é.
HATCHA (Hyperfast Agent Test for Computational Heuristic Assessment) é um CAPTCHA reverso que bloqueia o acesso por meio de desafios triviais para agentes de IA, mas dolorosos para humanos — multiplicação de números grandes, reversão de strings, decodificação binária e muito mais.
npm install @mondaycom/hatcha-react @mondaycom/hatcha-server
// app/api/hatcha/[...hatcha]/route.ts
import { createHatchaHandler } from "@mondaycom/hatcha-server/nextjs";
const handler = createHatchaHandler({
secret: process.env.HATCHA_SECRET!,
});
export const GET = handler;
export const POST = handler;
// app/layout.tsx
import { HatchaProvider } from "@mondaycom/hatcha-react";
import "@mondaycom/hatcha-react/styles.css";
export default function RootLayout({ children }) {
return (
<html lang="en">
<body>
<HatchaProvider>{children}</HatchaProvider>
</body>
</html>
);
}
"use client";
import { useHatcha } from "@mondaycom/hatcha-react";
function AgentModeButton() {
const { requestVerification } = useHatcha();
return (
<button
onClick={() =>
requestVerification((token) => {
console.log("Agent verified!", token);
})
}
>
Enter Agent Mode
</button>
);
}
# .env.local
HATCHA_SECRET=your-random-secret-here
Client Server
│ │
│ GET /api/hatcha/challenge │
│────────────────────────────────►│
│ │ Generate challenge
│ │ Hash answer
│ │ HMAC-sign { hash, expiry }
│ { challenge (no answer), token }
│◄────────────────────────────────│
│ │
│ Agent solves the challenge │
│ │
│ POST /api/hatcha/verify │
│ { answer, token } │
│────────────────────────────────►│
│ │ Verify HMAC signature
│ │ Check expiry
│ │ Compare answer hash
│ { success, verificationToken } │
│◄────────────────────────────────│
A resposta nunca chega ao cliente. O token assinado é opaco e contém apenas uma resposta com hash + expiração. A verificação é sem estado — nenhum banco de dados necessário.
| Tipo | Ícone | O que faz | Limite de tempo |
|---|---|---|---|
math | × | Multiplicação de 5 dígitos × 5 dígitos | 30 s |
string | ↔ | Inverter uma string aleatória de 60–80 caracteres | 30 s |
count | # | Contar um caractere específico em ~250 caracteres | 30 s |
sort | ⇅ | Ordenar 15 números, retornar o k-ésimo menor | 30 s |
binary | 01 | Decodificar octetos binários para ASCII | 30 s |
import { registerChallenge } from "@mondaycom/hatcha-server";
registerChallenge({
type: "hex",
generate() {
const n = Math.floor(Math.random() * 0xffffff);
return {
display: {
type: "hex",
icon: "0x",
title: "Hex Decode",
description: "Convert this hex number to decimal.",
prompt: `0x${n.toString(16).toUpperCase()}`,
timeLimit: 30,
answer: String(n),
},
answer: String(n),
};
},
});
HATCHA usa propriedades CSS personalizadas com escopo sob --hatcha-*. Substitua-as em qualquer elemento pai:
[data-hatcha-theme] {
--hatcha-accent: #3b82f6;
--hatcha-accent-light: #60a5fa;
--hatcha-bg: #060b18;
--hatcha-fg: #e4eaf6;
--hatcha-success: #22c55e;
--hatcha-danger: #ef4444;
}
Passe theme="dark", theme="light" ou theme="auto" para <HatchaProvider> ou <Hatcha>.
import express from "express";
import { hatchaRouter } from "@mondaycom/hatcha-server/express";
const app = express();
app.use(express.json());
app.use("/api/hatcha", hatchaRouter({ secret: process.env.HATCHA_SECRET! }));
app.listen(3000);
| Pacote | Descrição |
|---|---|
@mondaycom/hatcha-core | Geração de desafios e verificação criptográfica |
@mondaycom/hatcha-react | Componente React, provider e estilos |
@mondaycom/hatcha-server | Handlers de servidor Next.js e Express |
git clone https://github.com/mondaycom/HATCHA.git
cd HATCHA
pnpm install
pnpm build
cd examples/nextjs-app
pnpm dev
Contribuições são bem-vindas! Consulte CONTRIBUTING.md para instruções de configuração e diretrizes.