1.0.0 • Published 1 year ago

adonis-cf-turnstile v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

adonis-cf-turnstile

This is a AdonisJS V6 package that protect your applications from bots and spam attacks by Cloudflare Turnstile.

Pre Condition

Step 1: Registr a Cloudflare account

Step 2: Get a sitekey and secret key, you can get more information from Cloudflare Turnstile

Installation

npm i adonis-cf-turnstile
node ace configure adonis-cf-turnstile

Set Env Variables

TURNSTILE_SITE_KEY=YOUR_SITE_KEY
TURNSTILE_SECRET_KEY=YOUR_SECRET_KEY 

Usage

import type { HttpContext } from '@adonisjs/core/http'
import turnstile from 'adonis-cf-turnstile/services/main'

...
    async check(ctx: HttpContext) {
        const token = ctx.request.input('token')
        const { success } = await turnstile.check(token)
        if (!success) {
            // handle bot or spam attack request and return
        }
        // handle normal request
    }
...
1.0.0

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago