@nsure-ai/react-native-client-sdk
v1.3.22
Published
Unified React Native Module for nSure SDK (iOS & Android)
Readme
@nsure-ai/react-native-client-sdk
Official React Native SDK wrapper for nSure (Android & iOS)
Easily integrate the nSure SDK into your React Native applications using this unified npm package.
Installation
Using npm:
npm install @nsure-ai/react-native-client-sdk
npx pod-installUsage
Step 1: Initialize nSure SDK
Call initialize with your App ID, Partner ID, and optionally a configBaseUrl parameter (can be null) to override the default configuration endpoint:
import NSure from '@nsure-ai/react-native-client-sdk';
// Basic initialization
await NSure.initialize('YOUR_APP_ID', 'OPTIONAL_PARTNER_ID');
// Optionally specify a custom configuration base URL (can be null)
await NSure.initialize('YOUR_APP_ID', 'OPTIONAL_PARTNER_ID', 'https://custom-config-url.com');Note:
- On Android:
appId,partnerId, and optionalconfigBaseUrl(can benull) are passed into the native SDK.- On iOS:
appId,partnerId, and optionalconfigBaseUrl(can benull) are passed into the native SDK.
Step 2: Retrieve Device ID
Once initialized, get the device ID:
const deviceId = await NSure.getDeviceId();This deviceId must be sent to your server to identify sessions.
Step 3: Pass Device ID to Your Server
Include the deviceId in your API requests under sessionInfo:
{
"sessionInfo": {
"deviceId": "DEVICE_ID_FROM_SDK"
}
}Step 4: (Optional) Check SDK Version
At any time you can read the nSure SDK version:
const sdkVersion = await NSure.getVersion();
console.log('nSure SDK Version:', sdkVersion);Native Dependencies
Android (Gradle) - (Handled Automatically)
Your app does not need any manual changes. This package automatically adds:
implementation 'com.github.nsure-ai:android-sdk:1.3.12'
implementation 'com.fingerprint.android:pro:2.8.0'AndroidManifest.xml - Add screen-capture permission
In your AndroidManifest.xml, add:
<uses-permission android:name="android.permission.DETECT_SCREEN_CAPTURE" />This permission is required for nSure to detect when the user takes a screenshot.
iOS (CocoaPods) - (Handled Automatically)
CocoaPods integration is driven by nsure.podspec. After installing:
npx pod-installthe nSure.xcframework and bridge headers will be linked automatically.
Troubleshooting
Native Module "NSureSDK" is null
• Make sure you’ve rebuilt your app (npx react-native run-android/run-ios)
• Clear Metro cache:npx react-native start --reset-cache
• Confirm@nsure-ai/react-native-client-sdkappears innpx react-native configTurboModule argument errors
If you see “expected X arguments,” ensure you’re on RN 0.66+ and using the latest version of this package, which uses Promise‐based bridges.
Happy coding! 🚀
