nashid_verify_sdk 0.0.1 copy "nashid_verify_sdk: ^0.0.1" to clipboard
nashid_verify_sdk: ^0.0.1 copied to clipboard

The nashid_verify_sdk Flutter plugin provides an interface to integrate the Nashid SDK into your application for document scanning and verification purposes.

Nashid Verify SDK Flutter Plugin #

The nashid_verify_sdk Flutter plugin provides an interface to integrate the Nashid SDK into your application for document scanning and verification purposes.


Features #

  • Scan Oman ID and Passport documents.
  • Initialize the Nashid SDK with easy setup.
  • Retrieve document verification data effortlessly.
  • Built-in error handling for connectivity and backend issues.

Installation #

  1. Add the plugin to your pubspec.yaml file:

    dependencies:
      nashid_io: ^latest_version
    
  2. Import the plugin in your Dart code:

    import 'package:nashid_verify_sdk/nashid_verify_sdk.dart';
    

Setup Instructions #

IOS Configuration #

  1. Add the following permission to your Info.plist file:

    <key>NSCameraUsageDescription</key>
    <string>We need access to the camera to scan documents</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>
    
  2. Update your Podfile:

    platform :ios, '13.0'
    
     post_install do |installer|
      installer.pods_project.targets.each do |target|
       flutter_additional_ios_build_settings(target)
       /// Add these lines
       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
    
  3. Enable NFC Capability

    • To ensure the proper functionality of the SDK, you need to enable the Near Field Communication Tag Reading capability in your project.
    • Open your project in Xcode.
    • Navigate to your Target settings.
    • Go to the Signing & Capabilities tab.
    • Click the + Capability button.
    • Select Near Field Communication Tag Reading from the list.
  4. Set Privacy Usage Description for NFC

    • In Xcode, go to the Build Settings tab.
    • Search for Privacy - NFC Scan Usage Description.
    • Double-click the field and add the following string: "NFC permission is required to complete the full KYC process."
  5. Add the following script in Build Phases > Run Script:

-    cd "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Frameworks/NewVerifySDK.ramework/"
  if [[ -d "Frameworks" ]]; then
      rm -fr Frameworks
  fi

Android Configuration #

  1. In the

     /// Add this attribute to the <manifest> tag
     xmlns:tools="http://schemas.android.com/tools" 
     /// Add this attribute to the <application> tag
     tools:replace="android:name"
     android:enableOnBackInvokedCallback="true"
    
  2. Add these permissions

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

Usage #

Step 1: Initialize the Plugin #

  1. Start by creating an instance of the plugin:
     final _nashidIoPlugin = NashidIo();
    

Step 2: Generate SDK Keys #

  1. Contact Nashid support to obtain your SDK Key and SDK Secret Key.

Main Functions #

  1. Initialize the SDK
     String? response = await _nashidIoPlugin.initialize(
         "<your-sdk-key>",
         "<your-sdk-secret-key>",
         "en",
          );
     var decodedResponse = jsonDecode(response!);
    
  • String (2 letters): Language (default = en (English))

  • Example decodedResponse:

    • Response Success: { "result": true, "errorMessage": "" }

    • Response Error: { "result": false, "errorMessage": "Error message" }

  1. Verify

     String? response = await _nashidIoPlugin.verify(
      ofType: 1,
     );
     var decodedResponse = jsonDecode(response!);
    
    
    • ofType Values:

      • 1 for Oman ID.
      • 2 for Passport.
    • Response Success: { "result": true, "errorMessage": "", "verificationId": "Verification ID" }

    • Response Error: { "result": false, "errorMessage": "Error Message", "verificationId": "" }

  2. Get Verification Result

     String? response = await _nashidIoPlugin.getVerificationResult(
      verificationId: "Verification ID",
      var decodedResponse = jsonDecode(response!);
      var scanDataResponse;
      if(Platform.isIOS){
        scanDataResponse=decodedResponse['scanData'];
      }else{
        scanDataResponse=jsonDecode(decodedResponse['scanData']);
      }
     );
    
    • Response Success: { "result": true, "errorMessage": "", "scanData": {} }

    • Response Error: { "result": false, "errorMessage": "Error Message", "scanData": null }

Error Handling #

  • If the SDK is not initialized, the scanDocument and getVerificationData functions will return an error.
  • If the SDK is initialized successfully, the scanDocument function will return a verificationId, which can be used to retrieve the verification data using the getVerificationData unction.
  • If the scanDocument function fails, it will return an error message and an empty verificationId.
  • If the getVerificationData function fails, it will return an error message and null for the ScanData.
  • No Connectivity (Internet Issue):
  • errorMessage: "An error happened due to no connectivity, please try again later."
  • Backend Connectivity Issue:
  • errorMessage: "We’re experiencing an issue on our end, and our team is aware of it. A fix ill be available soon."

Supported Platforms #

  • iOS: Version 13.0 and above.
  • Android: SDK 21 and above, Ensure required permission included.

-This plugin provides an efficient way to integrate Nashid's document scanning and verification features. For further assistance, contact Nashid's support team.

0
likes
0
points
35
downloads

Publisher

unverified uploader

Weekly Downloads

The nashid_verify_sdk Flutter plugin provides an interface to integrate the Nashid SDK into your application for document scanning and verification purposes.

Homepage

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on nashid_verify_sdk

Packages that implement nashid_verify_sdk