You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@private-captcha/private-captcha-js

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@private-captcha/private-captcha-js

JS client for server-side usage of Private Captcha API

0.0.6
latest
Source
npmnpm
Version published
Maintainers
0
Created
Source

private-captcha-js

NPM Version badge CI

JavaScript client for server-side Private Captcha verification.

Installation

npm install private-captcha-js

Usage

Basic Verification

import { createClient } from 'private-captcha-js';

const client = createClient({ apiKey: 'your-api-key' });

const result = await client.verify({ solution: 'captcha-solution-from-client' });
if (result.success) {
    console.log('Captcha verified!');
}

Express.js Middleware

import express from 'express';
import { createClient } from 'private-captcha-js';

const app = express();
app.use(express.urlencoded({ extended: true })); // Required

const client = createClient({ apiKey: 'your-api-key' });

// Protect route with middleware
app.post('/submit', client.middleware(), (req, res) => {
    res.send('Form submitted successfully!');
});

// Or verify manually
app.post('/verify', async (req, res) => {
    try {
        const result = await client.verifyRequest(req);
        res.json({ success: result.success });
    } catch (error) {
        res.status(403).json({ error: error.message });
    }
});

Configuration

const client = createClient({
    apiKey: 'your-api-key',                 // Required
    formField: 'private-captcha-solution',  // Field from where to read the solution
    failedStatusCode: 403,                  // HTTP status code for failed verifications (middleware)
    domain: 'api.privatecaptcha.com'        // Override for EU isolation or for self-hosting
});

Retry configuration

client.verify({
    solution: 'solution',
    maxBackoffSeconds: 10,
    attempts: 10
});

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For issues with this Javascript client, please open an issue on GitHub.

For Private Captcha service questions, visit privatecaptcha.com.

Keywords

anti-bot

FAQs

Package last updated on 22 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts