librecaptcha renders and verifies reCAPTCHA captchas.
$ git clone
Before you can use this module, you must visit http://www.google.com/recaptcha to request a public and private API key for your domain.
This package has no external dependencies.
To get started, use
require to load
recaptcha in your script.
var reCAPTCHA = ;
Next, initialize a recaptcha singleton that will be used throughout your script.
var captcha =public_key: "pub_key"private_key: "private_key";
Cool! Now you are ready to generate form snippets and verify submissions!
Create a new instance of reCAPTCHA. Available options are as follows:
public_keyThe public key provided by the reCAPTCHA website (see Setup)
private_keyThe private key provided by the reCAPTCHA website (see Setup)
Renders and returns a reCAPTCHA snippet as a string.
Takes in and sends verification request to reCAPTCHA API. Then parses response from server then calls
callback. If verification fails,
callback will be called with the reason for failure as the first parameter.
recaptcha_data object contains the following items:
remoteipThe IP address of the client submitting a reCAPTCHA
challengeThe parameter sent by the client-side form, it should be sent by the form as
responseThe parameter sent by the client-side form, it should be sent by the form as
var recaptcha_data =remoteip: "18.104.22.168"challenge: reqbodyrecaptcha_challenge_fieldresponse: reqbodyrecaptcha_response_field;captcha;
var express = ;var reCAPTCHA = ;var http = ;var PUBLIC_KEY = 'public_key';var PRIVATE_KEY = 'private_key';var captcha =public_key: PUBLIC_KEYprivate_key: PRIVATE_KEY;var app = ;app;app;app;// Routesapp;app;http;
form(method='POST', action='/')!= recaptcha_forminput(type='submit', value='Check Recaptcha')
$ node app.js
Copyright (c) 2013 Nick Comer
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.