Ask AI

React Native SDK Integration

Introduction

This document serves as a comprehensive guide for React Native developers to seamlessly integrate Nashid Verify SDK into their applications. By following the step-by-step instructions provided, developers can simplify the process of scanning Oman ID cards and passports, and efficiently retrieve document scan results.

Nashid Verify SDK is designed to streamline identity verification processes, ensuring a smooth integration experience across platforms.

Prerequisites

React Native:

  • React Native Environment.
  • Node.js
  • Npm or yarn.
  • Android Studio
  • Latest Android Studio with SDK tools.
  • Xcode (16.1 or higher) for iOS development.
  • iOS 16.0 or higher
  • Gradle 8.0 or higher

Installation

React Native:

  1. Install the package, running the following command:
    1.  npm i nashidverifysdk
  1. For iOS, Do the following:
    1. In your Podfile, add the following line to include Nashid Verify SDK:
      1. target "YourApp" do
          config = use_native_modules!
          use_frameworks!
          pod 'nashidVerifySDK', 'x.y.z' replace x.x.x with the latest version of the SDK you are using
          use_react_native!(
            :path => config[:reactNativePath],
            :hermes_enabled => false,
            :app_path => "#{Pod::Config.instance.installation_root}/.."
          )
          post_install do |installer|
            react_native_post_install(
              installer,
              config[:reactNativePath],
              :mac_catalyst_enabled => false
            )
            installer.generated_projects.each do |project|
              project.targets.each do |target|
                target.build_configurations.each do |config|
                  config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
                end
              end
            end
            installer.pods_project.targets.each do |target|
              target.build_configurations.each do |config|
                config.build_settings['DEBUG_INFORMATION_FORMAT'] = 'dwarf-with-dsym'
                config.build_settings['OTHER_SWIFT_FLAGS'] = '-no-verify-emitted-module-interface'
                config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
                config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
              end
            end
          end
        end
    2. Add the required permissions in your Info.plist file:
      1. <key>NSCameraUsageDescription</key>
        <string>Camera permission is required to complete the full KYC process.</string>
        <key>NFCReaderUsageDescription</key>
        <string>NFC permission is required to complete the full KYC process.</string>
         <key>NSLocationWhenInUseUsageDescription</key>
         <string>Location permission is required to complete the full KYC process.</string>
         <key>NSLocationAlwaysUsageDescription</key>
         <string>Location permission is required to complete the full KYC process.</string>
         <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
         <string>Location permission is required to complete the full KYC process.</string>
        <key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
        <array>
          <string>A000000018524F500101</string>
          <string>A0000002471001</string>
          <string>A0000002472001</string>
          <string>00000000000000</string>
          <string>A00000024300130000000101</string>
          <string>A0000002430013000000010109</string>
          <string>A000000243001300000001FF</string>
        </array>
    3. Enable Near Field Communication (NFC) Reading capability in your projects, as follows:
      1. Open your project in Xcode.
      2. Navigate to your Target settings.
      3. Go to the Signing & Capabilities tab.
      4. Click the + Capability button.
      5. Select Near Field Communication Tag Reading from the list.
    4. Set Privacy Usage Description for NFC, as follows:
      1. In Xcode, go to the Build Settings tab.
      2. Search for Privacy - NFC Scan Usage Description.
      3. Double-click the field and add desired description, for example: "Needed permission to read Passport’s NFC"
    5. Run:
      1. cd ios && pod install
  1. For Android, Do the following:
    1. In your app-level build.gradle file, add the following dependency for the Nashid Verify SDK
      1. implementation 'io.nashid.verify:sdk:x.x.x'

        Note: Replace x.x.x with the latest version of the SDK.

    2. Update AndroidManifest.xml:
      1. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"> <!--Add this line in manifest tag-->
        <!-- Add this attribute to the <application> tag -->
        tools:replace="android:name"
        android:enableOnBackInvokedCallback="true"
    3. Recommendation to use the following lines to app-level build.gradle file:
      1. android {
          compileSdk 36
          defaultConfig {
             minSdk 21
             targetSdk 36
          }
        }

Usage

1. Import Nashid Verify SDK:

 import {
     initialize,
     verify,
     getVerificationResult,
   } from 'nashidverifysdk';

2. Initialize Nashid Verify SDK:

To start using the SDK, you need to create an SDK Application and configure the desired verification flow via your admin dashboard.

The initialize() function expects the following arguments:

  1. SDK Application Key (Mandatory): The key generated using your Nashid Verify admin dashboard.
  1. SDK Application Key Secret (Mandatory): The key secret generated using your Nashid Verify admin dashboard.
  1. Language Code (Optional): en for English (default), ar for Arabic ..etc.
  1. Extra Data (Optional): An object of key-value pairs that you can use to annotate the verification data generated with additional data that your consumer application may need.

The initialize() function returns a value, indicating whether initialization was successful (true) or unsuccessful (false), along with an error message in case of unsuccessful initialization.

const response = await initialize(
  'Your SDK key',
  'Your SDK secret',
  'en' // Language (default: "en"),
  { // optional extra data
   "example-key": "example-values",
  }
);

3. Verify A Document Using Nashid Verify SDK

Once Nashid Verify SDK is initialized successfully, you can start verifications journeys for your users using the verify() function.

This function expects an input argument specifying the type of document to be verified

ID Type
Value
OMANI_ID
1
INTERNATIONAL_PASSPORT
2

And as a result of the verification flow it returns three values:

  1. Result: A boolean flag that is true when the verification flow is successful, and false other wise.
  1. Error Message: A string contains the error details in case of unsuccessful verification.
  1. Verification ID: An ID of the created verification. This ID can be used later on to get the results collected with any additional checks/information annotated by backend services.

Example 1: Verify With Omani ID

const result = await verify(DocumentType.OMAN_ID);

Example 2: Verify With International Passport

const result = await verify(DocumentType.INTERNATIONAL_PASSPORT);

4. Using Nashid Verify SDK To Get A Verification Result

Once you have a valid verification ID as an outcome of a successful verification journey you can use getVerificationResult() function to get the results collected with any additional checks/information annotated by backend services using the verification ID.

Example: Retrieve the data of verification ID abcd1234

const result = await getVerificationResult(
  'abcd1234'
);
  • The verificationID (abcd1234) is just an example value that represents what we get as a result of the verify functionality.
  • Example ID Card Response:
    • {
        "data": {
          "id": "dummy-id-12345",
          "created_at": "2025-01-01T00:00:00.000000+00:00",
          "updated_at": "2025-01-01T00:01:00.000000+00:00",
          "updated_by": null,
          "data": {
            "NFC": {
              "issue_date": "2020-01-01",
              "expiry_date": "2030-01-01",
              "date_of_birth": "1990-01-01",
              "gender_arabic": "ذكر",
              "gender_english": "Male",
              "identity_number": "12345678",
              "full_name_arabic": "اسم عربي تجريبي",
              "full_name_english": "JOHN DOE",
              "nationality_arabic": "تجريبي",
              "nationality_english": "DUMMYLAND",
              "place_of_issue_arabic": "مكان الإصدار",
              "place_of_issue_english": "Dummy City",
              "country_of_birth_arabic": "بلد الميلاد",
              "country_of_birth_english": "Dummyland"
            },
            "scan": {
              "gender": "MALE",
              "country": "DUM",
              "mrz_text": "IDDUM1234567<<0<<<<<<<<<<<<<<<9001011M3001011DUM<<<<<<<<<<<0JOHN<DOE<TEST<DUMMY",
              "full_name": "JOHN DOE TEST DUMMY",
              "document_no": "1234567",
              "expiry_date": "2030-01-01",
              "nationality": "DUM",
              "date_of_birth": "1990-01-01",
              "document_type": "ID"
            },
            "liveness": {
              "active_liveness_confirmed": true,
              "passive_liveness_confirmed": false
            }
          },
          "metadata": {
            "gender": "MALE",
            "location": {
              "latitude": 0.000000,
              "longitude": 0.000000
            },
            "timestamp": "2025-01-01 00:00:00",
            "app_version": "0.0.1 (000)",
            "device_ipv4": "0.0.0.0",
            "device_ipv6": "::1",
            "device_type": "iPhone",
            "system_name": "iOS",
            "system_version": "0.0",
            "device_identifier": "Dummy Device"
          },
          "artifacts": {
            "nfc_face_image": "https://dummy.domain.com/nfc_face_image.jpg",
            "ocr_face_image": "https://dummy.domain.com/ocr_face_image.jpg",
            "back_side_image": "https://dummy.domain.com/back_side_image.jpg",
            "front_side_image": "https://dummy.domain.com/front_side_image.jpg",
            "active_liveness_image": "https://dummy.domain.com/active_liveness_image.jpg"
          },
          "annotations": {
            "face_matching": {
              "mode": "both",
              "notes": "",
              "is_successful": true
            }
          },
          "type": {
            "value": 1,
            "title": "oman ID"
          },
          "status": {
            "value": 3,
            "title": "Verified"
          },
          "status_notes": [],
          "nfc_collected": true,
          "processing_time": "1.234 seconds"
        },
        "message": "verification retrieved successfully.",
        "consolidated_message": "verification retrieved successfully.",
        "details": {}
      }
  • Example Passport Response:
    • {
        "data": {
          "id": "dummy-id-12345",
          "created_at": "2025-08-03T12:19:20.546556+00:00",
          "updated_at": "2025-08-03T12:19:25.292090+00:00",
          "updated_by": null,
          "data": {
            "NFC": {
              "name": "JOHN DOE",
              "gender": "Male",
              "address": "123 DUMMY STREET, TEST CITY",
              "telephone": "9999999999",
              "issue_date": "2022-01-01",
              "nationality": "DUM",
              "date_of_birth": "1990-01-01",
              "document_type": "Passport",
              "place_of_birth": "TEST CITY",
              "issuing_country": "Dummyland",
              "passport_number": "DUM1234567",
              "personal_number": "123456789",
              "issuing_authority": "TEST OFFICE",
              "passport_expiry_date": "2032-01-01"
            },
            "scan": {
              "gender": "MALE",
              "country": "DUM",
              "mrz_text": "P<DUMDOE<<JOHN<<<<<<<<<<<<<<<<<<<DUM1234567DUM9001019M3201011123456789<<<<<<<<<00",
              "full_name": "DOE JOHN",
              "document_no": "DUM1234567",
              "expiry_date": "2032-01-01",
              "nationality": "DUM",
              "date_of_birth": "1990-01-01",
              "document_type": "Passport"
            },
            "liveness": {
              "active_liveness_confirmed": true,
              "passive_liveness_confirmed": false
            }
          },
          "metadata": {
            "gender": "MALE",
            "location": {
              "latitude": 0.000000,
              "longitude": 0.000000
            },
            "timestamp": "2025-08-03 12:19:19",
            "app_version": "0.0.0 (000)",
            "device_ipv4": "0.0.0.0",
            "device_ipv6": "::1",
            "device_type": "iPhone",
            "system_name": "iOS",
            "system_version": "0.0",
            "device_identifier": "Dummy Device"
          },
          "artifacts": {
            "nfc_face_image": "https://dummy.image.url/nfc_face.jpg",
            "ocr_face_image": "https://dummy.image.url/ocr_face.jpg",
            "front_side_image": "https://dummy.image.url/front_side.jpg",
            "active_liveness_image": "https://dummy.image.url/active_liveness.jpg"
          },
          "annotations": {
            "face_matching": {
              "mode": "both",
              "notes": "",
              "is_successful": true
            }
          },
          "type": {
            "value": 2,
            "title": "International Passport"
          },
          "status": {
            "value": 3,
            "title": "Verified"
          },
          "status_notes": [],
          "nfc_collected": true,
          "processing_time": 4.745
        },
        "message": "Verification retrieved successfully.",
        "consolidated_message": "Verification retrieved successfully.",
        "details": {}
      }

The status field represents the current state of the verification.

"status": { "value": <integer>, "title": <string> }

Possible status values:

value
title
Description
1
Data not collected
One or more verification steps based on the functionality configured, did not complete successfully within allowed attempts or retries.
2
Data collected
All of the functionality configured in the verification steps were completed successfully, but the final evaluation against the selected verification criteria is still pending.
3
Verified
All verification criteria (default or custom verification rules) were successfully met. These may include checks such as data collection, face match, or liveness —depending on setup.
4
Not verified
One or more verification criteria (from default or custom verification rules) were not met. These may include checks such as data collection, face match, or liveness —depending on setup.
5
Processing
Initial verification data has been successfully collected, and the backend is still processing the results
Did this answer your question?
😞
😐
🤩

Last updated on August 8, 2025