
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@plotdb/captcha
Advanced tools
Captcha wrapper for captcha services.
include captcha.js:
<script src="dist/captcha.js"></script>
use captcha object to create captcha service wrappers like this:
mycaptcha = new captcha({
init: function() { Promise.resolve('...'); },
get: function(opt) { Promise.resolve('...'); }
isVerifyFailed: function(err) { ... }
alt: { ... },
config: { ... }
lc: { ... }
});
with following options:
init(): function for initializing your captcha.
get(opt): function used to getting captcha token for verifying through backend.
should return Promise resolving object with token field ( {token: ... } ).
opt is defined by user.
if captcha verification failed, reject with an error which can be recognize with isVerifyFailed.
isVerifyFailed(err): optional function to check if a given error object err is for verification failure.
alt is provided and when execute calls callback function but an error for verification failure is returned by the callback function, then captcha will try again with another captcha object corresponding to alt.execute works.alt: optional. either an object for captcha constructor options, or a captcha object.
alt will be used when veritification failed with the owner captcha object.config: default config object for this captcha object.
get and init functions.lc: object storing default value for storing variables defined by get and init functions.
Once constructed, you can get a token by:
mycaptcha.get().then(function(opt) { opt.token; });
Since token usually involves server-side verification, you can use execute for alt captcha
postData = function({ .../* object returned by `get` */... }) {
/* should return promise */
Promise.resolve!
.then -> /* fetch, ajax with the `get` returned object */
};
mycaptcha.execute({ ... /* options to `get` */ ... }, postData).then(function() { ... });
get(opt): get captcha token. should return Promise resolving {token} object.
opt: user defined option for using in user defined get function.execute(opt, cb): execute cb with get returned object. return promise
opt: options passed to get.cb(ret): callback functions with get returned object as option ( ret ).
cb should return Promise.
If verification failed, cb can optionally rejects with error object recognizable by isVerifyFailed.setConfig: update config object.captcha ships with predefined Google Recaptcha wrapper. use it by first including the needed js:
<script src="dist/captcha.js"></script>
<script src="dist/recaptcha.js"></script>
then:
recaptcha.v2.setConfig({sitekey: '....', enabled: ture});
recaptcha.v2.get();
recaptcha.v3.setConfig({sitekey: '....', enabled: ture});
recaptcha.v3.get();
MIT
FAQs
captcha sample
The npm package @plotdb/captcha receives a total of 1 weekly downloads. As such, @plotdb/captcha popularity was classified as not popular.
We found that @plotdb/captcha demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.