botstop
v0.3.1
Published
Language-agnostic client for the BotStop captcha HTTP API.
Readme
botstop
TypeScript/JavaScript client for the BotStop HTTP API.
Install
pnpm add botstop
# or
npm install botstopUsage
import { BotStopClient, mountBotStopWidget } from "botstop";
const client = new BotStopClient({
baseUrl: "http://127.0.0.1:8787",
apiKey: process.env.BOTSTOP_API_KEY,
});
const challenge = await client.createChallenge();
console.log(challenge.gif_url);
const result = await client.verifyChallenge(challenge.challenge_id, "4829");Drop-in widget
import { BotStopClient, mountBotStopWidget } from "botstop";
const client = new BotStopClient({ baseUrl: "http://127.0.0.1:8787" });
mountBotStopWidget(client, {
target: document.getElementById("captcha")!,
onVerified: (result) => {
if (result.ok) submitForm();
},
});API
BotStopClient—createChallenge(),refreshChallenge(previousId?),verifyChallenge(id, answer)mountBotStopWidget(client, options)— minimal UI with refresh + verify
