Skip to content

nsuite v2.2.1


nsuite / generateSvgCaptcha

Function: generateSvgCaptcha()

generateSvgCaptcha(options?): ReturnGenerateSvgCaptcha

Defined in: UtilsCaptcha.ts:55

Generates an SVG captcha with a mathematical expression.

Parameters

options?

ConfigObject = {}

Options for generating the captcha. All fields are optional and fall back to svg-captcha defaults, except where noted. Supports all svg-captcha createMathExpr options.

Returns

ReturnGenerateSvgCaptcha

An object containing the captcha text and data.

Example

ts
import { generateSvgCaptcha } from "nsuite";
const { text, data } = await generateSvgCaptcha({
  width: 148,
  height: 48,
  size: 5,
  fontSize: 42,
  charPreset: "abc",
  color: true,
  inverse: false,
  ignoreChars: "0o1il",
  noise: 2,
  background: "#ffffff",
  mathOperator: "+-",
  mathMin: 1,
  mathMax: 9,
});

Released under the Apache-2.0 License.