fastify-recaptcha
zero dependency (except fastify-plugin) fastify recaptcha plugin
options:
interface Options {
recaptcha_secret_key: string,
reply?: boolean,
hostname?: string
}
example:
import fastifyRecaptcha from 'fastify-recaptcha'
fastify.register(fastifyRecaptcha,{
recaptcha_secret_key:"your_recaptcha_sercret_key"
})
import fastifyRecaptcha from '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'],
}