Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@fingerprintjs/fingerprintjs-pro-server-api
Advanced tools
Node.js wrapper for FingerprintJS Sever API
Fingerprint is a device intelligence platform offering 99.5% accurate visitor identification.
The Fingerprint Server Node SDK is an easy way to interact with the Fingerprint Server API from your Node application. You can retrieve visitor history or individual identification events.
TypeScript support:
Supported runtimes:
Node.js 18 LTS or higher (we support all Node LTS releases before end-of-life).
Deno and Bun might work but are not actively tested.
"Edge" runtimes might work with some modifications but are not actively tested.
This SDK can be made compatible with JavaScript "edge" runtimes that do not support all Node APIs, for example, Vercel Edge Runtime, or Cloudflare Workers.
To make it work, replace the SDK's built-in fetch
function (which relies on Node APIs) with the runtime's native fetch
function. Pass the function into the constructor with proper binding:
const client = new FingerprintJsServerApiClient({
region: Region.EU,
apiKey: apiKey,
fetch: fetch.bind(globalThis),
})
Install the package using your favorite package manager:
NPM:
npm i @fingerprintjs/fingerprintjs-pro-server-api
Yarn:
yarn add @fingerprintjs/fingerprintjs-pro-server-api
pnpm:
pnpm i @fingerprintjs/fingerprintjs-pro-server-api
Initialize the client instance and use it to make API requests. You need to specify your Fingerprint Secret API key and the region of your Fingerprint application.
import {
FingerprintJsServerApiClient,
Region,
} from '@fingerprintjs/fingerprintjs-pro-server-api'
const client = new FingerprintJsServerApiClient({
apiKey: '<SECRET_API_KEY>',
region: Region.Global,
})
// Get visit history of a specific visitor
client.getVisitorHistory('<visitorId>').then((visitorHistory) => {
console.log(visitorHistory)
})
// Get a specific identification event
client.getEvent('<requestId>').then((event) => {
console.log(event)
})
See the Examples folder for more detailed examples.
The Server API methods like getEvent
and getVisitorHistory
can throw EventError
and VisitorsError
.
You can use the provided isVisitorsError
and isEventError
type guards to narrow down error types:
import {
isVisitorsError,
isEventError,
FingerprintJsServerApiClient,
} from '@fingerprintjs/fingerprintjs-pro-server-api'
const client = new FingerprintJsServerApiClient({
apiKey: '<SECRET_API_KEY>',
region: Region.Global,
})
// Handling getEvent errors
try {
const event = await client.getEvent(requestId)
console.log(JSON.stringify(event, null, 2))
} catch (error) {
if (isEventError(error)) {
console.log(error.response) // You can also access the raw response
console.log(`error ${error.status}: `, error.error?.message)
} else {
console.log('unknown error: ', error)
}
}
// Handling getVisitorHistory errors
try {
const visitorHistory = await client.getVisitorHistory(visitorId, {
limit: 10,
})
console.log(JSON.stringify(visitorHistory, null, 2))
} catch (error) {
if (isVisitorsError(error)) {
console.log(error.status, error.error)
if (error.status === 429) {
retryLater(error.retryAfter) // Needs to be implemented on your side
}
} else {
console.error('unknown error: ', error)
}
}
When handling Webhooks coming from Fingerprint, you can cast the payload as the built-in VisitWebhook
type:
import { VisitWebhook } from '@fingerprintjs/fingerprintjs-pro-server-api'
const visit = visitWebhookBody as unknown as VisitWebhook
Customers on the Enterprise plan can enable Webhook signatures to cryptographically verify the authenticity of incoming webhooks. This SDK provides a utility method for verifying the HMAC signature of the incoming webhook request.
To learn more, see example/validateWebhookSignature.mjs or read the API Reference.
Customers on the Enterprise plan can enable Sealed results to receive the full device intelligence result on the client and unseal it on the server. This SDK provides utility methods for decoding sealed results.
To learn more, see example/unsealResult.mjs or the API Reference.
Customers on the Enterprise plan can Delete all data associated with a specific visitor to comply with privacy regulations. See example/deleteVisitorData.mjs or the API Reference.
See the full API reference.
To report problems, ask questions, or provide feedback, please use Issues. If you need private support, you can email us at oss-support@fingerprint.com.
This project is licensed under the MIT license.
4.1.0 (2024-06-17)
isValidWebhookSignature
function for validating webhook signature [INTER-731] (885b693)Options.region
optional (48c8024)getEvent
method (c21a7b6)FAQs
Node.js wrapper for FingerprintJS Sever API
The npm package @fingerprintjs/fingerprintjs-pro-server-api receives a total of 7,210 weekly downloads. As such, @fingerprintjs/fingerprintjs-pro-server-api popularity was classified as popular.
We found that @fingerprintjs/fingerprintjs-pro-server-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.