Skip to main content
To run the SDK a Verisoul Project ID is required. Schedule a call here to get started.

System Requirements

  • React Native 0.60 or higher
  • iOS 14.0 or higher
  • Android API level 21 (Android 5.0) or higher
  • For Expo projects: Expo SDK 45 or higher with custom development client

Installation

Using NPM

npm install @verisoul_ai/react-native-verisoul

Using Yarn

yarn add @verisoul_ai/react-native-verisoul

Android Configuration

If an exception occurs during the build stating that the ai.verisoul:android package cannot be downloaded, add the following Maven repository inside your android/build.gradle file:
allprojects {
    repositories {
        // ...
        maven { url = uri("https://us-central1-maven.pkg.dev/verisoul/android") }
    }
}

Expo Projects

The Verisoul SDK is not supported in Expo Go. If you are using the managed workflow, you will need to use Expo’s custom development client.
  1. Install expo-dev-client:
npx expo install expo-dev-client
  1. Modify the scripts section in your package.json file:
"scripts": {
  "start": "expo start --dev-client",
  "android": "expo run:android",
  "ios": "expo run:ios"
}
  1. Install Verisoul SDK:
npm install @verisoul_ai/react-native-verisoul
  1. If needed, add the Maven repository to your android/build.gradle file as shown in the Android Configuration section above.

Usage

Initialize the SDK

The configure() method initializes the Verisoul SDK with your project credentials. This method must be called once when your application starts. Parameters:
  • environment: The environment to use VerisoulEnvironment.prod for production or VerisoulEnvironment.sandbox for testing
  • projectId: Your unique Verisoul project identifier
Example:
import Verisoul, {
  VerisoulEnvironment,
} from "@verisoul_ai/react-native-verisoul";

useEffect(() => {
  Verisoul.configure({
    environment: VerisoulEnvironment.prod, // or VerisoulEnvironment.sandbox
    projectId: "YOUR_PROJECT_ID",
  });
}, []);
When called, the Verisoul SDK will initialize its components, begin collecting device telemetry data, and prepare a session ID for fraud assessment.

getSessionId()

The getSessionID() method returns the current session identifier after the SDK has collected sufficient device data. This session ID is required to request a risk assessment from Verisoul’s API. Important Notes:
  • Session IDs are short-lived and expire after 24 hours
  • The session ID becomes available once minimum data collection is complete (typically within seconds)
  • You should send this session ID to your backend, which can then call Verisoul’s API to get a risk assessment
  • A new session ID is generated each time the SDK is initialized or when reinitialize() is called
Example:
const sessionId = await Verisoul.getSessionID();

reinitialize()

The reinitialize() method generates a fresh session ID and resets the SDK’s data collection. This is essential for maintaining data integrity when user context changes. Example:
await Verisoul.reinitialize();
After calling this method, you can call getSessionID() to retrieve the new session identifier.

Provide Touch Events

Touch event data is collected and analyzed to detect automated/bot behavior by comparing touch patterns with device sensor data. This helps identify anomalies that may indicate fraud. React Native Setup: Wrap your root component with VerisoulTouchRootView to automatically capture touch events across both iOS and Android:
import { VerisoulTouchRootView } from "@verisoul_ai/react-native-verisoul";

function App() {
  return (
    <VerisoulTouchRootView>{/* Your app components */}</VerisoulTouchRootView>
  );
}

iOS Configuration

For iOS-specific configuration including Device Check and App Attest setup, please refer to the iOS SDK Documentation.

Example

For a complete working example, see the React Native Sample App.

Additional Resources