https://github.com/code-vedas/ncaptcha
Captchas implementation for nodejs
https://github.com/code-vedas/ncaptcha
Last synced: 5 months ago
JSON representation
Captchas implementation for nodejs
- Host: GitHub
- URL: https://github.com/code-vedas/ncaptcha
- Owner: Code-Vedas
- License: mit
- Created: 2020-07-20T12:24:37.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-01-23T00:40:52.000Z (about 1 year ago)
- Last Synced: 2025-02-14T22:32:23.580Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 396 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
---
[](https://coveralls.io/github/niteshpurohit/ncaptcha?branch=master)
[](https://badge.fury.io/js/ncaptcha-api)
[](https://nodei.co/npm/ncaptcha-api/)
# ncaptcha
Module to integrate captcha for API only apps in nodejs
# Dependencies
1. canvas
2. crypto
# Usage
```
const NCaptcha = require('ncaptcha');
//remove {text:'123456'} to get random key and text image.
var ncaptcha = new NCaptcha({text:'123456'});
// send this key and image data to client, client will send key and user inputted test from the image
var data = ncaptcha.generate()
//should return true.
ncaptcha.check(data.key,'123456')
```
data will have key and image encoded in base64.
# Expiry Logic
By default key expires in 10 minutes. You can set 'expireInMinute' in params
```
// for 20 minutes
new NCaptcha({text:'123456',expireInMinute:20});
```