npm.io
0.3.0 • Published 2 years ago

cloudflare-turnstile-widget

Licence
MIT
Version
0.3.0
Deps
0
Size
118 kB
Vulns
0
Weekly
0
Stars
6

Cloudflare Turnstile Widget

Framework agnostic widget for Cloudflare's free-to-use CAPTCHA service, Cloudflare Turnstile



Downloads Per Week NPM Version GitHub Build MIT License

[Introduction] [Usage] [Contributors] [License]


Introduction

  • When the requirement is to utilize the Cloudflare's CAPTCHA service in a web component or shadow DOM implementation, Cloudflare's script for their CAPTCHA service only queries the document in the DOM tree which presents a problem that this component solves.
  • The <turnstile-widget> is a custom iframe that makes the use of cloudflare's CAPTCHA easier in your application without the above mentioned issue.

Usage

  Install the library in your project.

npm install cloudflare-turnstile-widget

  Import the package

import 'cloudflare-turnstile-widget';

  Use the widget in your application.

<turnstile-widget site-key="1x00000000000000000000AA" size="compact" theme="dark"></turnstile-widget>

  Use event listeners to receive messages from the widget.

document.querySelector('turnstile-widget').addEventListener('success', function (e) {
	console.log(e.detail.content);
});

Contributors

Thanks goes to these wonderful people:

rezo12
rezo12
BOTLANNER
BOTLANNER

License

Licensed under MIT

Based on omni-widget licensed under MIT