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

fastify-recaptcha-verifier

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastify-recaptcha-verifier

zero dependency (except fastify-plugin) fastify recaptcha plugin options: ```ts /* https://developers.google.com/recaptcha/docs/verify Verification is failed if: score < 0.5 || success === false || options.hostaname && options.hostname !== hostname

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

fastify-recaptcha

zero dependency (except fastify-plugin) fastify recaptcha plugin
options:

/* 
https://developers.google.com/recaptcha/docs/verify
Verification is failed if: score < 0.5 || success === false || options.hostaname && options.hostname !== hostname received from the google request
*/
interface Options {
    recaptcha_secret_key: string,
    reply?: boolean, // if true, will reply with 403 and error message on recaptcha verification error. If false/undefined, will decorate request with recaptcha field. This field contains all the information received from the google request
    hostname?: string // if exists, a hostname check will be performed
}

example:

import fastifyRecaptcha from 'fastify-recaptcha'
//or const fastifyRecaptcha = require('fastify-recaptcha')
fastify.register(fastifyRecaptcha,{
    recaptcha_secret_key:"your_recaptcha_sercret_key"
})
import fastifyRecaptcha from 'fastify-recaptcha'
//or const fastifyRecaptcha = require('fastify-recaptcha')
fastify.register(fastifyRecaptcha,{
    recaptcha_secret_key:"your_recaptcha_sercret_key",
    reply:true,
    hostname:"subdomain.domain.com"
})

Don't forget to require g-recaptcha-response in protected routes.

const body_schema_route = {
    type: 'object',
    properties: {
        "g-recaptcha-response": { type: 'string' },
    },
    required: ['g-recaptcha-response'],
}

FAQs

Package last updated on 03 Nov 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