@infopeak/captcha
v1.0.1
Published
Server-side verification for InfoPeak Captcha - the privacy-first, EU-hosted captcha. No tracking, no cookies, no puzzles.
Downloads
26
Maintainers
Readme
InfoPeak Captcha for Node.js
Server-side verification for InfoPeak Captcha - the privacy-first, EU-hosted captcha. No tracking, no cookies, no image puzzles.
Install
npm install @infopeak/captchaRequires Node.js 18+ (uses the built-in fetch). Zero dependencies. Ships ESM, CommonJS and TypeScript types.
Usage
Add the widget to your form (full guide):
<form action="/signup" method="POST">
<input type="email" name="email" required>
<div class="infopeak-captcha" data-sitekey="YOUR_SITEKEY"></div>
<button type="submit">Sign up</button>
</form>
<script src="https://captcha.infopeak.io/infopeak-captcha.js" defer></script>Verify the token when the form is submitted (Express example):
import { verify, FIELD } from '@infopeak/captcha';
app.post('/signup', async (req, res) => {
const ok = await verify(req.body[FIELD], {
sitekey: 'YOUR_SITEKEY',
secret: process.env.INFOPEAK_CAPTCHA_SECRET,
});
if (!ok) {
return res.status(400).send('Captcha verification failed');
}
// ... proceed
});Need quota information too?
import { verifyDetailed, FIELD } from '@infopeak/captcha';
const { valid, overLimit } = await verifyDetailed(token, { sitekey, secret });Verification fails closed: network errors and non-200 responses return valid: false.
Testing
Public test credentials that work on any domain and never count against a quota (never use in production):
sitekey: ipk_test_sitekey
secret: ipk_test_secretLinks
- Get a free sitekey - 10,000 verifications/month at no cost
- Developer documentation
License
MIT
