Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.
/ honeyjs Public archive

An open source Javascript Honey Pot implementation

License

Notifications You must be signed in to change notification settings

hungluu/honeyjs

Repository files navigation

HoneyJS

Build Status Maintainability Coverage Status

An open source Javascript HoneyPot library, release under MIT license. This is currently in active development

Links : Github - NPM - Document - Live Demo

honeyjs image

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

  1. How to use
  2. Configuration
  3. Google reCaptcha
  4. Changelog
  5. Contributors
  6. 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 :

  1. Make sure you have a Github account and have installed npm
  2. Fork this repo, then clone with [email protected]:your-user-name/honeyjs.git
  3. Run npm install to install all dependencies
  4. Run npm test to be sure everything is working
  5. Make your changes ( optional write an additional test file if you'are adding somethings and the old test files cannot cover )
  6. Run npm test again to make sure everything is working, then check coverage/lcov-report/index.html to make sure coverage is above 95% ( This is a security library so we need everything to perform as intended )
  7. 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 🍻