@verisoul_ai/react-native-verisoul
TypeScript icon, indicating that this package has built-in type declarations

0.3.3 • Public • Published

Verisoul logo

verisoul-reactnative

Overview

The purpose of this app is to demonstrate Verisoul's Android SDK integration.

To run the app a Verisoul Project ID is required. Schedule a call here to get started.

Getting Started

1. Add Dependency

Using NPM

npm install verisoul-reactnative

Using Yarn

yarn add verisoul-reactnative

EXPO

The Verisoul SDK is not supported in Expo Go, so if you are using the managed workflow, you will need to use Expo’s custom development client. If you already have it set up, you can skip to step 3.

  1. Open the command line and navigate to your Expo project directory. Then, run the following command to install expo-dev-client. Node
npx expo install expo-dev-client
  1. Modify the scripts section in your package.json file to use expo-dev-client, it should look like this.
"scripts": {
"start": "expo start --dev-client",
"android": "expo run:android",
"ios": "expo run:ios",
...
}
  1. Then install Verisoul SDK

Using NPM

npm install verisoul-reactnative

Using Yarn

yarn add verisoul-reactnative
  1. 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") }

    }
 }

Usage

1. Initialization

import Verisoul, {
  MotionAction,
  VerisoulEnvironment,
} from '@verisoul_ai/react-native-verisoul';

useEffect(() => {
  Verisoul.configure({
    environment: VerisoulEnvironment.dev,
    projectId: 'PROJECT ID',
  });
}, []);

When this is called Verisoul library will be initialized, initial data together with session ID will be gathered and uploaded to Verisoul backend.

2. Get Session ID

Once the minimum amount of data is gathered the session ID becomes available. The session ID is needed in order to request a risk assessment from Verisoul's API. Note that session IDs are short lived and will expire after 24 hours. The application can obtain session ID by providing the callback as shown below:

const sessionData = await Verisoul.getSessionID();

3. Provide Touch Events

Wrap your App With VerisoulTouchRootView

<VerisoulTouchRootView>
  // another Views
</VerisoulTouchRootView>

Android

1. Provide Touch Events (Android only)

In order to gather touch events and compare them to device accelerometer sensor data, the app will need to provide touch events to Verisoul. you need to Edit th MainActivity, to override dispatchTouchEvent function and pass the data to Verisoul like shown below.

import ai.verisoul.sdk.Verisoul
import android.view.MotionEvent


class MainActivity : ReactActivity() {

  override fun dispatchTouchEvent(event: MotionEvent?): Boolean {
    Verisoul.onTouchEvent(event)
    return super.dispatchTouchEvent(event)
  }

    // Other code...
}

iOS

Capabilities

To fully utilize VerisoulSDK, you must add the App Attest capability to your project. This capability allows the SDK to perform necessary checks and validations to ensure the integrity and security of your application.

Update your app’s entitlements file:

<key>com.apple.developer.devicecheck.appattest-environment</key>
<string>production/development (depending on your needs)</string>

Update the privacy manifest file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!--
   PrivacyInfo.xcprivacy
   test

   Created by Raine Scott on 1/30/25.
   Copyright (c) 2025 ___ORGANIZATIONNAME___.
   All rights reserved.
-->
<plist version="1.0">
  <dict>
    <!-- Privacy manifest file for Verisoul Fraud Prevention SDK for iOS -->
    <key>NSPrivacyTracking</key>
    <false/>

    <!-- Privacy manifest file for Verisoul Fraud Prevention SDK for iOS -->
    <key>NSPrivacyTrackingDomains</key>
    <array/>

    <!-- Privacy manifest file for Verisoul Fraud Prevention SDK for iOS -->
    <key>NSPrivacyCollectedDataTypes</key>
    <array>
      <dict>
        <!-- The value provided by Apple for 'Device ID' data type -->
        <key>NSPrivacyCollectedDataType</key>
        <string>NSPrivacyCollectedDataTypeDeviceID</string>

        <!-- Verisoul Fraud Prevention SDK does not link the 'Device ID' with user's identity -->
        <key>NSPrivacyCollectedDataTypeLinked</key>
        <false/>

        <!-- Verisoul Fraud Prevention SDK does not use 'Device ID' for tracking -->
        <key>NSPrivacyCollectedDataTypeTracking</key>
        <false/>

        <!-- Verisoul Fraud Prevention SDK uses 'Device ID' for App Functionality
             (prevent fraud and implement security measures) -->
        <key>NSPrivacyCollectedDataTypePurposes</key>
        <array>
          <string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
        </array>
      </dict>
    </array>

    <!-- Privacy manifest file for Verisoul Fraud Prevention SDK for iOS -->
    <key>NSPrivacyAccessedAPITypes</key>
    <array>
      <dict>
        <!-- The value provided by Apple for 'System boot time APIs' -->
        <key>NSPrivacyAccessedAPIType</key>
        <string>NSPrivacyAccessedAPICategorySystemBootTime</string>

        <!-- Verisoul Fraud Prevention SDK uses 'System boot time APIs' to measure the amount of
             time that has elapsed between events that occurred within the SDK -->
        <key>NSPrivacyAccessedAPITypeReasons</key>
        <array>
          <string>35F9.1</string>
        </array>
      </dict>
    </array>
  </dict>
</plist>

Questions and Feedback

Comprehensive documentation about Verisoul's Android SDK and API can be found at docs.verisoul.ai. Additionally, reach out to Verisoul at help@verisoul.ai for any questions or feedback.

Package Sidebar

Install

npm i @verisoul_ai/react-native-verisoul

Weekly Downloads

19

Version

0.3.3

License

MIT

Unpacked Size

60.6 kB

Total Files

78

Last publish

Collaborators

  • verisoulai
  • a7med_3laa