https://github.com/friendlycaptcha/friendly-captcha-sdk
The SDK that is used to integrate Friendly Captcha v2 into your website. Protect your websites and online services from spam and abuse with Friendly Captcha, the privacy-first anti-bot solution.
https://github.com/friendlycaptcha/friendly-captcha-sdk
anti-bot anti-spam captcha gdpr-compliant library privacy proof-of-work spam-protection
Last synced: about 2 months ago
JSON representation
The SDK that is used to integrate Friendly Captcha v2 into your website. Protect your websites and online services from spam and abuse with Friendly Captcha, the privacy-first anti-bot solution.
- Host: GitHub
- URL: https://github.com/friendlycaptcha/friendly-captcha-sdk
- Owner: FriendlyCaptcha
- License: mpl-2.0
- Created: 2023-12-07T16:51:20.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-08-13T12:57:17.000Z (about 2 months ago)
- Last Synced: 2025-08-13T14:43:42.212Z (about 2 months ago)
- Topics: anti-bot, anti-spam, captcha, gdpr-compliant, library, privacy, proof-of-work, spam-protection
- Language: TypeScript
- Homepage: https://friendlycaptcha.com
- Size: 429 KB
- Stars: 7
- Watchers: 0
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Friendly Captcha SDK
[](https://www.npmjs.com/package/@friendlycaptcha/sdk)
The SDK that is used to integrate Friendly Captcha v2 into your website.
This is the code that runs on your website, inserting the captcha widget.
> ☝️ This is the SDK for **Friendly Captcha v2 only**. If you are looking for the v1 SDK, you can find that [here](https://github.com/friendlycaptcha/friendly-challenge).
## Installation
```shell
# using npm
npm install @friendlycaptcha/sdk# using yarn
yarn add @friendlycaptcha/sdk
```You can then use it in your library.
```js
import { FriendlyCaptchaSDK } from "@friendlycaptcha/sdk"// Re-use this SDK if you are creating multiple widgets.
const sdk = new FriendlyCaptchaSDK();
``````js
// HTML element that you want to mount the widget under.
const mount = document.querySelector("#my-widget-mount");// Create the widget
const widget = sdk.createWidget({
element: mount,
sitekey: ""
});
```## Documentation
The documentation can be found in our [Developer Hub](https://developer.friendlycaptcha.com/docs/v2/sdk/), and the [*Getting Started* guide](https://developer.friendlycaptcha.com/docs/v2/getting-started/).
## Development
If you want to develop this SDK itself the following commands are useful
```shell
# install dependencies
npm install# minimal build
npm run build# build for distribution (also builds docs)
npm run build:dist# run the basic unit tests
npm run test
```### sdktest
We include more proper end-to-end tests in the [**sdktest**](./sdktest/) tool folder.### Updating the docusaurus SDK reference docs
We automatically generate markdown docs and translate these into files that are in a format that works for Docusaurus. You will then need to update the docs manually by deleting the old files and adding the new ones. Something like this:```shell
rm -rf ../friendly-docs/docs/sdk/reference && mkdir ../friendly-docs/docs/sdk/reference && cp -r ./dist/docs/docusaurus/ ../friendly-docs/docs/sdk/reference/
```### Adding license headers
```shell
# print those files that would be changed
npm run license-check-and-add -- check# add the headers
npm run license-check-and-add -- add
```## License
This is free software; you can redistribute it and/or modify it under the terms of the [Mozilla Public License Version 2.0](./LICENSE).## Contributing
Contributions are welcome.Prior to us being able to accept your contribution you will need to sign our [CLA (Contributor License Agreement)](https://cla-assistant.io/FriendlyCaptcha/friendly-captcha-sdk).