open-index/open-npm huggingface dataset:
npm package: @supertokens-plugins/captcha-nodejs
Description: SuperTokens plugin for adding CAPTCHA support in your Node.js application.
Latest version: 0.2.1

# SuperTokens Plugin Captcha

Add CAPTCHA verification to SuperTokens authentication flows.
This plugin integrates with **reCAPTCHA v2**, **reCAPTCHA v3**, and **Cloudflare Turnstile** to protect authentication endpoints from automated attacks.

## Installation

```bash
npm install @supertokens-plugins/captcha-nodejs
```

## Quick Start

Initialize the plugin in your SuperTokens backend configuration:

```typescript
import SuperTokens from "supertokens-node";
import CaptchaPlugin from "@supertokens-plugins/captcha-nodejs";

SuperTokens.init({
  supertokens: {
    connectionURI: "...",
  },
  appInfo: {
    // your app info
  },
  recipeList: [
    // your recipes
  ],
  plugins: [
    CaptchaPlugin.init({
      type: "reCAPTCHAv3", // or "reCAPTCHAv2" or "turnstile"
      captcha: {
        secretKey: "your-secret-key",
      },
    }),
  ],
});
```

> [!IMPORTANT]  
> You also have to install and configure the frontend plugin.

## Protected Flows

The plugin automatically protects these authentication flows:

| Recipe          | Authentication Flow        | API Function                     |
| --------------- | -------------------------- | -------------------------------- |
| `EmailPassword` | User sign in               | `signInPOST`                     |
| `EmailPassword` | User registration          | `signUpPOST`                     |
| `EmailPassword` | Password reset request     | `generatePasswordResetTokenPOST` |
| `EmailPassword` | Password reset submission  | `passwordResetPOST`              |
| `Passwordless`  | Generate verification code | `createCodePOST`                 |
| `Passwordless`  | Verify code and sign in    | `consumeCodePOST`                |

## Customization

### Conditional Validation

Control when CAPTCHA validation occurs using the `shouldValidate` function:

```typescript
import { ShouldValidate } from "@supertokens-plugins/captcha-nodejs";

const shouldValidate: ShouldValidate = (api, input) => {
  // Only require CAPTCHA for sign up
  if (api === "signUpPOST") {
    return true;
  }

  // Check request headers for suspicious activity
  if (api === "signInPOST") {
    const userAgent = input.options.req.getHeaderValue("user-agent");
    return !userAgent || userAgent.includes("bot");
  }

  return false;
};
```
npm package: @supertokens-plugins/opentelemetry-nodejs
Description: SuperTokens plugin for adding OpenTelemetry logging in your Node.js application.
Latest version: 0.1.2

# SuperTokens Plugin Captcha

Add OpenTelemetry logging to all SuperTokens APIs and function calls.

## Installation

```bash
npm install @supertokens-plugins/opentelemetry-nodejs
```

## Quick Start

Initialize the plugin in your SuperTokens backend configuration:

```typescript
import SuperTokens from "supertokens-node";
import OpenTelemetryPlugin from "@supertokens-plugins/opentelemetry-nodejs";

SuperTokens.init({
  supertokens: {
    connectionURI: "...",
  },
  appInfo: {
    // your app info
  },
  recipeList: [
    // your recipes
  ],
  experimental: {
    plugins: [OpenTelemetryPlugin.init()],
  },
});
```

> [!IMPORTANT]  
> You also have to install and configure the OpenTelemetry SDK. See here for more details: https://opentelemetry.io/docs/languages/js/getting-started/nodejs/#instrumentation

## Traces added

This plugin manually adds traces to all overrideable functions and APIs. By initializing the OpenTelemetry SDK, you automatically get API level. Debug logs are currently not part of the logged events.

## Customization

### Removing sensitive data

By default the plugin removes the following fields from traces: "password", "email", "phoneNumber", "email", "emails", "phoneNumbers", "accessToken", "refreshToken"
You can add (or remove) items from this list by overriding the `getSensitiveFields` function:

```typescript
import SuperTokens from "supertokens-node";
import OpenTelemetryPlugin from "@supertokens-plugins/opentelemetry-nodejs";

SuperTokens.init({
  supertokens: {
    connectionURI: "...",
  },
  appInfo: {
    // your app info
  },
  recipeList: [
    // your recipes
  ],
  experimental: {
    plugins: [
      OpenTelemetryPlugin.init({
        override: (oI) => ({
          ...oI,
          getSensitiveFields: (defaultSensitiveFields: string[]) => [...defaultSensitiveFields, "randomField"],
        }),
      }),
    ],
  },
});
```

### Other ways of protecting sensitive data

You can achieve this in two ways:

1. You can explicitly control how things are transformed into attributes by overriding `transformInputToAttributes` and `transformResultToAttributes`.
2. Opt-out of the built-in data removal by overriding `getSensitiveFields` to return an empty array and configure data protection as as described here: https://opentelemetry.io/docs/security/handling-sensitive-data/