Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aacn.eu/use-friendly-captcha

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aacn.eu/use-friendly-captcha

FriendlyCaptcha React Implementation

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
623
decreased by-62.56%
Maintainers
1
Weekly downloads
 
Created
Source

Use Friendly Captcha hook

Usage

The library has functions for both frontend and backend. Both of them work independent of each other.

Frontend

Include the useCaptchaHook() in your selected file. From there you can then query the widget and state from the hook, for you to manage and use in your form.

The hook expects the following properties:

siteKey: string;
endpoint?: FC_PUZZLE_EP; enum for the currently available endpoints (EU & global)
language?: keyof typeof localizations | Localization;
startMode?: "auto" | "focus" | "none";
showAttribution: boolean

The hook provides the following parameters:

  • CaptchaWidget returns the HTML authentification widget.
  • captchaStatus.solution is used to determine if the puzzle was already solved (string) or not (null)
  • captchaStatus.error is used to determine if an error occured while solving (string) or not (null)

Backend

backend wise this library provides a function that uses the FriendlyCaptcha verification API to check if the submitted puzzle solution is valid or not. It returns a boolean for further handling in your own code.

The function expects the following properties:

endpoint?: FC_VERIFICATION_EP; enum for the currently available endpoints (EU & global)
solution: string;
secret: string;
sitekey?: string;
httpPostFetcher: (see further down)

httpPostFetcher

The backend expects a fetcher function as parameter. This function is provided by the user and is used to send a http post request to the fc verification server. It should match the following design:

function fetcherExample(
    endpoint: string,
    requestBody: { solution: string; secret: string; siteKey: string },
    headers: { 'Content-Type': 'application/json'; 'Accept': 'application/json'; }
) => Promise<{ success: boolean; errors: any; } | null>

Keywords

FAQs

Package last updated on 05 Jan 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc