React Native

Introduction

The React Native VoveSDK facilitates easy integration of ID verification and KYC (Know Your Customer) compliance into mobile applications, supporting both iOS and Android platforms. This wrapper abstracts the complexity of interacting with the native VoveSDK, providing a simplified, promise-based JavaScript API for React Native developers.

Installation

To include the React Native VoveSDK in your project, install it via npm or Yarn:

bashCopy code

npm i @vove-id/react-native-sdk

or

yarn add @vove-id/react-native-sdk

This package comes bundled with all necessary native dependencies, so there's no need for additional modifications to your Podfile or build.gradle.

Permissions (iOS)

For VoveSDK to function properly, it is essential to request and obtain camera permission from the users. This permission is crucial for ID verification processes that require access to the device's camera. To request camera permission, add the following key to your Info.plist file:

<key>NSCameraUsageDescription</key>
<string>This application requires access to the camera for ID verification purposes.</string>

Permissions (Android)

Add the necessary camera permission to your AndroidManifest.xml:

<uses-permission android:name="android.permission.CAMERA"/>

Usage

The core functionality of the VoveSDK is to perform ID verification through a straightforward function call, which manages the verification process based on a session token.

Initialize Vove SDK

To initialize the Vove SDK, use your public API key. This setup should ideally be done in the main entry file (e.g., App.js or index.js) as early as possible.

import { initialize } from '@vove-id/react-native-sdk';
initialize({
  environment: 'ENVIRONMENT',
  publicKey:'PUBLIC_KEY',
})
.then(() => console.log('Initialized'))
.catch((e) => console.error(e));

Starting ID Verification

To start the ID verification process, use the start function. This function requires a configuration object that includes the session token, and optional settings such as vocal guidance and locale. It returns a promise that resolves to indicate the verification outcome.

Function Signature

start(config: VoveConfig): Promise<VoveStatus>
  • config: Configuration object for the verification process, which includes:

    • environment: Specifies the environment for the SDK to operate in. Can be VoveEnvironment.Production or VoveEnvironment.Sandbox.

    • sessionToken: A token generated by your backend, used to initiate the ID verification session.

    • enableVocalGuidance?: Optional boolean to enable vocal guidance during the verification process.

    • locale?: Optional locale setting for localizing the verification process (see below for details).

Example Usage

import { start, VoveEnvironment, VoveLocale } from '@vove-id/react-native-sdk';

const config = {
  sessionToken: 'your_session_token_here',
  enableVocalGuidance: true,
  locale: VoveLocale.EN
};

start(config)
  .then((status) => {
    switch (status) {
      case 'success':
        console.log('Verification successful.');
        break;
      case 'pending':
        console.log('Verification pending.');
        break;
      case 'failure':
        console.log('Verification failure.');
        break;
      case 'canceled':
        console.log('Verification canceled.');
        break;
      default:
        console.log('Unexpected status:', status);
    }
  })
  .catch((error) => {
    console.error('Verification failed:', error);
  });

Handling Verification Results

The promise returned by start will:

  • Resolve with a status string for "success", "pending", or "canceled" scenarios, indicating the verification outcome.

  • Reject in the case of a "failure", providing an error object detailing the failure reason.

Handling Verification Results

The promise returned by start will:

  • Resolve with a status string for "success", "pending", or "canceled" scenarios, indicating the verification outcome.

  • Reject in the case of a "failure", providing an error object detailing the failure reason.

Localization with VoveLocale

The SDK supports multiple languages for ID verification processes. To use this feature, specify the locale in the VoveConfig when starting the verification:

  • VoveLocale.EN: English

  • VoveLocale.FR: French

  • VoveLocale.AR: Arabic

  • VoveLocale.AR_MA: Moroccan Arabic

Enabling Vocal Guidance

To enhance the user experience during ID verification, vocal guidance can be enabled. Set the enableVocalGuidance flag in the VoveConfig object to true. This feature is especially useful for helping users through the verification process in a clear and guided manner.

Troubleshooting

Ensure the session token is correctly generated and passed, and that the appropriate environment is selected based on your application's stage (development or production). For unresolved issues, contact support with detailed information about the problem, including error messages and the steps leading up to the issue.

Support

For further assistance or inquiries about the React Native VoveSDK, please reach out to our support team.

Last updated