npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@webdecoy/node

v0.1.1

Published

Web Decoy SDK for Node.js - Bot detection with TLS fingerprinting

Downloads

241

Readme

@webdecoy/node

Core Web Decoy SDK for Node.js applications - Advanced bot detection with TLS fingerprinting.

npm version License: MIT

Installation

npm install @webdecoy/node
# or
yarn add @webdecoy/node

Quick Start

import { WebDecoy } from '@webdecoy/node';

const webdecoy = new WebDecoy({
  apiKey: process.env.WEBDECOY_API_KEY,
});

const result = await webdecoy.protect({
  method: 'GET',
  path: '/api/data',
  ip: '203.0.113.42',
  user_agent: req.headers['user-agent'],
  headers: req.headers,
  timestamp: Date.now(),
});

if (!result.allowed) {
  // Block the request
  return res.status(403).json({ error: 'Access denied' });
}

Configuration Options

const webdecoy = new WebDecoy({
  // Required: Your API key from the dashboard
  apiKey: 'sk_live_xxxxx',

  // Optional: API endpoint (defaults to production)
  apiUrl: 'https://api.webdecoy.com',

  // Optional: Enable TLS fingerprinting (default: true)
  enableTLSFingerprinting: true,

  // Optional: Threat score threshold for blocking (default: 80)
  threatScoreThreshold: 70,

  // Optional: Request timeout in milliseconds (default: 5000)
  timeout: 5000,

  // Optional: Enable debug logging (default: false)
  debug: false,

  // Optional: Reject unauthorized TLS certificates (default: true)
  tlsRejectUnauthorized: true,
});

API Reference

WebDecoy

Main SDK class for bot detection.

protect(metadata: RequestMetadata, options?: ProtectOptions): Promise<ProtectResult>

Analyze and protect a request.

const result = await webdecoy.protect({
  method: 'GET',
  path: '/api/data',
  ip: '203.0.113.42',
  user_agent: 'Mozilla/5.0...',
  headers: { /* request headers */ },
  timestamp: Date.now(),
});

Returns:

interface ProtectResult {
  allowed: boolean;
  detection: {
    decision: 'allow' | 'block' | 'challenge';
    confidence: number; // 0-100 threat score
    threat_level: 'MINIMAL' | 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL';
    bot_detected: boolean;
    bot_type?: string;
    detection_id: string;
    rule_enforced: boolean;
  };
  error?: string;
}

validateConfig(): Promise<{ valid: boolean; error?: string }>

Validate your API key and configuration.

getConfig(): Readonly<Required<WebDecoyConfig>>

Get the current configuration.

Types

All TypeScript types are exported:

import type {
  WebDecoyConfig,
  RequestMetadata,
  SDKDetectionResponse,
  ProtectResult,
  ProtectOptions,
  TLSInfo,
  LocalAnalysis,
  SDKDetectionRequest,
} from '@webdecoy/node';

Framework Integrations

For Express.js, use the dedicated middleware package:

npm install @webdecoy/express

See @webdecoy/express for details.

Getting an API Key

  1. Sign up at app.webdecoy.com
  2. Create a new organization and property
  3. Generate an API key in Settings

API keys start with sk_live_ for production or sk_test_ for testing.

Documentation

For full documentation, visit the GitHub repository.

License

MIT