Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@friendlycaptcha/server-sdk
Advanced tools
A Javascript client for the Friendly Captcha service. This client allows for easy integration and verification of captcha responses with the Friendly Captcha API.
This library is for Friendly Captcha v2 only. If you are looking for V1, look here
This is the library you use in your backend code. For the code that you use in your frontend, see @friendlycaptcha/sdk.
Install using NPM
npm install @friendlycaptcha/server-sdk
Below are some basic examples of how to use the client.
For a more detailed example, take a look at the example directory.
import { FriendlyCaptchaClient } from "@friendlycaptcha/server-sdk";
const frcClient = new FriendlyCaptchaClient({
apiKey: "YOUR_API_KEY",
sitekey: "YOUR_SITEKEY",
});
After calling verifyCaptchaResponse
with the captcha response there are two functions on the result object that you should check:
wasAbleToVerify()
indicates whether we were able to verify the captcha response. This will be false
in case there was an issue with the network/our service or if there was a mistake in the configuration.shouldAccept()
indicates whether the captcha response was correct. If the client is running in non-strict mode (default) and wasAbleToVerify()
returned false
, this will be true
.Below are some examples of this behaviour.
const result = await frcClient.verifyCaptchaResponse("CORRECT_CAPTCHA_RESPONSE_HERE");
console.log(result.wasAbleToVerify()); // true
console.log(result.shouldAccept()); // true
const result = await frcClient.verifyCaptchaResponse("INCORRECT_CAPTCHA_RESPONSE_HERE");
console.log(result.wasAbleToVerify()); // true
console.log(result.shouldAccept()); // false
const result = await frcClient.verifyCaptchaResponse("INCORRECT_CAPTCHA_RESPONSE_HERE");
console.log(result.wasAbleToVerify()); // false
console.log(result.shouldAccept()); // true
const frcClient = new FriendlyCaptchaClient({
...
strict: true,
});
const result = await frcClient.verifyCaptchaResponse("INCORRECT_CAPTCHA_RESPONSE_HERE");
console.log(result.wasAbleToVerify()); // false
console.log(result.shouldAccept()); // false
The client offers several configuration options:
verifyCaptchaResponse
returns true
regardless. By passing strict: true
, it will return false
instead: every response needs to be strictly verified.eu
or global
are also accepted. Default is global
.globalThis.fetch
.npm install
First run the SDK Test server, then run npm test
.
docker run -p 1090:1090 friendlycaptcha/sdk-testserver:latest
npm test
npm run build:dist
Open source under MIT.
FAQs
Serverside client SDK for the Friendly Captcha V2 API
The npm package @friendlycaptcha/server-sdk receives a total of 33 weekly downloads. As such, @friendlycaptcha/server-sdk popularity was classified as not popular.
We found that @friendlycaptcha/server-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.