Skip to main content

@supertokens-plugins/captcha-nodejs

Classes

CaptchaPluginError

Defined in: supertokens-plugins/packages/captcha-nodejs/src/errors.ts:3

Extends

Constructors

Constructor
new CaptchaPluginError(type: CaptchaPluginErrorType, message: string): CaptchaPluginError;

Defined in: supertokens-plugins/packages/captcha-nodejs/src/errors.ts:4

Parameters
ParameterType
typeCaptchaPluginErrorType
messagestring
Returns

CaptchaPluginError

Overrides
Error.constructor

Properties

PropertyModifierTypeDefined in
typepublicCaptchaPluginErrorTypesupertokens-plugins/packages/captcha-nodejs/src/errors.ts:4

Interfaces

ShouldValidate()

Defined in: supertokens-plugins/packages/captcha-nodejs/src/types.ts:4

Call Signature

ShouldValidate(api: "signInPOST", input: {
}):
| boolean
| Promise<boolean>;

Defined in: supertokens-plugins/packages/captcha-nodejs/src/types.ts:5

Parameters
ParameterType
api"signInPOST"
input{ }
Returns

| boolean | Promise<boolean>

Call Signature

ShouldValidate(api: "signUpPOST", input: {
}):
| boolean
| Promise<boolean>;

Defined in: supertokens-plugins/packages/captcha-nodejs/src/types.ts:9

Parameters
ParameterType
api"signUpPOST"
input{ }
Returns

| boolean | Promise<boolean>

Call Signature

ShouldValidate(api: "passwordResetPOST", input: {
}):
| boolean
| Promise<boolean>;

Defined in: supertokens-plugins/packages/captcha-nodejs/src/types.ts:13

Parameters
ParameterType
api"passwordResetPOST"
input{ }
Returns

| boolean | Promise<boolean>

Call Signature

ShouldValidate(api: "generatePasswordResetTokenPOST", input: {
}):
| boolean
| Promise<boolean>;

Defined in: supertokens-plugins/packages/captcha-nodejs/src/types.ts:17

Parameters
ParameterType
api"generatePasswordResetTokenPOST"
input{ }
Returns

| boolean | Promise<boolean>

Call Signature

ShouldValidate(api: "consumeCodePOST", input: 
| {
}
| {
} & {
}):
| boolean
| Promise<boolean>;

Defined in: supertokens-plugins/packages/captcha-nodejs/src/types.ts:21

Parameters
ParameterType
api"consumeCodePOST"
input| { } | { } & { }
Returns

| boolean | Promise<boolean>

Call Signature

ShouldValidate(api: "createCodePOST", input: 
| {
}
| {
} & {
}):
| boolean
| Promise<boolean>;

Defined in: supertokens-plugins/packages/captcha-nodejs/src/types.ts:25

Parameters
ParameterType
api"createCodePOST"
input| { } | { } & { }
Returns

| boolean | Promise<boolean>

Call Signature

ShouldValidate(api: "consumeCodePOST", input: 
| {
}
| {
} & {
}):
| boolean
| Promise<boolean>;

Defined in: supertokens-plugins/packages/captcha-nodejs/src/types.ts:29

Parameters
ParameterType
api"consumeCodePOST"
input| { } | { } & { }
Returns

| boolean | Promise<boolean>

Type Aliases

ReCaptchaV2Response

type ReCaptchaV2Response = {
action: string;
challenge_ts: string;
error-codes: string[];
success: boolean;
};

Defined in: supertokens-plugins/packages/captcha-nodejs/src/types.ts:54

Properties

ReCaptchaV3Response

type ReCaptchaV3Response = {
action: string;
challenge_ts: string;
error-codes: string[];
hostname: string;
score: number;
success: boolean;
};

Defined in: supertokens-plugins/packages/captcha-nodejs/src/types.ts:45

Properties

SuperTokensPluginCaptchaConfig

type SuperTokensPluginCaptchaConfig = {
captcha: {
secretKey: string;
};
shouldValidate?: ShouldValidate;
type: "reCAPTCHAv3" | "reCAPTCHAv2" | "turnstile";
};

Defined in: supertokens-plugins/packages/captcha-nodejs/src/types.ts:35

Properties

PropertyTypeDescriptionDefined in
captcha{ secretKey: string; }-supertokens-plugins/packages/captcha-nodejs/src/types.ts:37
captcha.secretKeystring-supertokens-plugins/packages/captcha-nodejs/src/types.ts:38
shouldValidate?ShouldValidateBy default the captcha validation is performed on all the form submit actions Use this property to specify when to perform the validationsupertokens-plugins/packages/captcha-nodejs/src/types.ts:42
type"reCAPTCHAv3" | "reCAPTCHAv2" | "turnstile"-supertokens-plugins/packages/captcha-nodejs/src/types.ts:36

TurnstileResponse

type TurnstileResponse = {
challenge_ts: string;
error-codes: string[];
hostname: string;
success: boolean;
};

Defined in: supertokens-plugins/packages/captcha-nodejs/src/types.ts:61

Properties

Variables

default

default: {
init: (config: SuperTokensPluginCaptchaConfig) => SuperTokensPlugin;
};

Defined in: supertokens-plugins/packages/captcha-nodejs/src/index.ts:5

Type Declaration

PLUGIN_ID

const PLUGIN_ID: "supertokens-plugin-captcha" = "supertokens-plugin-captcha";

Defined in: supertokens-plugins/packages/captcha-nodejs/src/config.ts:3

PLUGIN_SDK_VERSION

const PLUGIN_SDK_VERSION: ">=23.0.0" = ">=23.0.0";

Defined in: supertokens-plugins/packages/captcha-nodejs/src/config.ts:4

SupportedCaptchaTypes

const SupportedCaptchaTypes: string[];

Defined in: supertokens-plugins/packages/captcha-nodejs/src/captcha.ts:4

Functions

init()

function init(config: SuperTokensPluginCaptchaConfig): SuperTokensPlugin;

Defined in: supertokens-plugins/packages/captcha-nodejs/src/plugin.ts:6

Parameters

Returns

SuperTokensPlugin

validateCaptcha()

function validateCaptcha(body: Record<string, unknown>, config: SuperTokensPluginCaptchaConfig): Promise<void>;

Defined in: supertokens-plugins/packages/captcha-nodejs/src/captcha.ts:15

Parameters

ParameterType
bodyRecord<string, unknown>
configSuperTokensPluginCaptchaConfig

Returns

Promise<void>

validatePluginConfig()

function validatePluginConfig(config: SuperTokensPluginCaptchaConfig): void;

Defined in: supertokens-plugins/packages/captcha-nodejs/src/config.ts:6

Parameters

Returns

void