Socket
Socket
Sign inDemoInstall

xendit-fingerprint-sdk-web

Package Overview
Dependencies
5
Maintainers
3
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    xendit-fingerprint-sdk-web

Web SDK for Xendit's device fingerprinting.


Version published
Weekly downloads
0
decreased by-100%
Maintainers
3
Install size
1.34 MB
Created
Weekly downloads
 

Readme

Source

Xendit Fingerprint SDK Web

Web SDK for device identification and fingerprinting with Xendit services.

Basic Usage

Initialize the SDK with your public API key on application start up and perform a scan.

The SDK must be initialized before use.

// Initialize the SDK on every page load
XenditFingerprintSDK.init({
  apiKey: 'MY_PUBLIC_API_KEY',
})
// Run a scan immediately after initialization
XenditFingerprintSDK.scan()

The session ID is retrievable from either XenditFingerprintSDK.init() on SDK initialization or from the XenditFingerprintSDK.getSessionID() convenience method any time after initialization.

Both of these functions returns a Session ID of type string.

// On SDK init
var sessionID = XenditFingerprintSDK.init('MY_PUBLIC_API_KEY')

// After SDK init
var sessionID = XenditFingerprintSDK.getSessionID()

This Session ID can then be passed on to other Xendit APIs that support device fingerprinting. Please refer to the respective API's documentation for further info.

Requirements

Supported web browsers:

  • Chrome 49+
  • Firefox 52+
  • Edge 93+
  • Desktop Safari 12.1+
  • Mobile Safari 10.3+
  • Samsung Internet 14.0+
  • Android Browser 4.4+

Installation

In a browser:

<script src="https://cdn.jsdelivr.net/npm/xendit-fingerprint-sdk-web/dist/xendit-fingerprint-sdk-web.js">

Using NPM:

$ npm install --save xendit-fingerprint-sdk-web

Methods

Asynchronous SDK methods have been labeled async, these return a Promise object. Refer to the returns section of each method for the resolved type.

init()

The SDK must be initialized before it can be used.

  • Initialization must be ran on every web page load.
  • The SDK will associate a session ID for the webpage until it's closed.
  • A new session ID will be assigned on every page load.
  • Single page apps (SPAs) will have the same session ID if JS based routing is used. Because the web page is only loaded once.
const sessionId = XenditFingerprintSDK.init({apiKey: publicKey});
Parameters
NameTypeRequiredDescription
initOptionsInitOptions ObjectYesInitialization options

Do not use your private API key!

InitOptions Object

NameTypeRequiredDescription
apiKeystringYesA valid public API key provided by Xendit Dashboard
Returns
NameTypeDescription
sessionIdstringGenerated session ID

async scan()

Scans the web browser and sends the device fingerprint data to Xendit.

  • Scan should be called immediately after initializing the SDK.
  • Scan can be called multiple times within a session.
  • Do not await the scan, let it run in the background. This avoids blocking any foreground application code execution.
XenditFingerprintSDK.scan()
// Or
XenditFingerprintSDK.scan(customerEventName, customerEventID)
Parameters
NameTypeRequiredDescription
customerEventNamestringNoOptional event name to associate with this scan. Recommended to use snake case formatting. e.g. 'some_event_name'
customerEventIDstringNoOptional identifier associated with the event. e.g. user account ID

getSessionID()

Convenience method to retrieve Session ID after SDK initialization.

const sessionId = XenditFingerprintSDK.getSessionID();
Returns
NameTypeDescription
sessionIDstringGenerated session ID

setEnabled()

Enables or disables the SDK.

  • When disabled, the scan method will do nothing. No data will be sent to Xendit.
  • When enabled, the SDK will resume operating as normal.
  • The SDK can be disabled before initializing.
// Disables the SDK
XenditFingerprintSDK.setEnabled(false);
// Re-enables the SDK
XenditFingerprintSDK.setEnabled(true);
Parameters
NameTypeRequiredDescription
enablebooleanYestrue enables the SDK.
false disables the SDK.

FAQs

Last updated on 17 May 2022

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc