honeyjs
honeyjs copied to clipboard
An open source Javascript Honey Pot implementation
HoneyJS
An open source Javascript HoneyPot library, release under MIT license. This is currently in active development
Links : Github - NPM - Document - Live Demo
![]()
Version 1.1.x is here!
- Remake API to be more simple and effective
- Sandbox dependencies for more security
- Add a ForceCaptcha option to make your forms automatically acquire Google reCaptcha on creation
- Well tested 256 specs with mocha, blanket and istanbul
Supports : Google reCaptcha - jQuery
Thank to jsDelivr's awsomeness, honeyjs can be deliveried from the cloud to your site in miliseconds ( only 1.97KB gzipped ), use this :
<script src="//cdn.jsdelivr.net/honeyjs/1.1.0/honey.min.js"></script>
Or bundle with jQuery for convenient DOM selector string and plugin stuff
<script src="//cdn.jsdelivr.net/g/[email protected],[email protected]"></script>
Install :
npm install honeyjs
// or using bower
bower install honeyjs
Need help? Please leave your issues HERE
Table of contents
- How to use
- Configuration
- Google reCaptcha
- Changelog
- Contributors
- Contribution
How to use
This library makes honey pot implementation so easy with some lines of javascript code.
The simple javascript way
var form = document.getElementById('#1');
honey(form);
Or jQuery style
$('#1').honey();
// or
honey('#1');
Check honey and jQuery plugin on or document for more information.
Automatically secure all your forms
honey.all();
Configuration
Global configurations
honey.config({
theme : 'dark', // reCaptcha theme
size : 'normal' // reCaptcha size
});
// retrive global options
var captchaTheme = honey.config('theme');
View our document for more information
For individually config honeypot(s), you will need to get an instance of Pot or Pots to configure over these objects
var pots = honey(forms);
// set acceptable minimum amount of time for form completion
pots.config({ time : 10 });
// set a name of empty-required input field
pots.name('empty');
Google reCaptcha
Since 1.0.4, honeyjs started supporting reCaptcha. You need to load Google reCaptcha api script before honeyjs, like this :
<script src="//www.google.com/recaptcha/api.js?render=explicit"></script>
<script src="honey.js"></script>
How to use
honey(forms).captcha('your-site-key');
// with jQuery
$(forms).honey('your-site-key');
Check out captcha for more information
Set an optional global reCaptcha sitekey for reusing
honey.requireRecaptcha('your-site-key');
// init recaptcha on a form, you don't need to provide a sitekey again
honey(form).captcha();
Force all forms to use reCaptcha
honey.forceRecaptcha('your-site-key');
// reCaptcha will be acquired automatically without calling .captcha()
honey(form);
Changelog
Please view HISTORY.md file
Contributors
See contributors
Contribution
Everyone is welcome :)
Here is some steps :
- Make sure you have a Github account and have installed npm
- Fork this repo, then clone with
[email protected]:your-user-name/honeyjs.git - Run
npm installto install all dependencies - Run
npm testto be sure everything is working - Make your changes ( optional write an additional test file if you'are adding somethings and the old test files cannot cover )
- Run
npm testagain to make sure everything is working, then checkcoverage/lcov-report/index.htmlto make sure coverage is above 95% ( This is a security library so we need everything to perform as intended ) - Push to your fork, create a pull request and write a good commit message.
This project is actively maintained. Please feel free to contact me if you need any further assistance.
Enjoy :beers: