nashid_verify_sdk 0.0.4
nashid_verify_sdk: ^0.0.4 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 #
-
Add the plugin to your
pubspec.yamlfile:dependencies: nashid_io: ^latest_version -
Import the plugin in your Dart code:
import 'package:nashid_verify_sdk/nashid_verify_sdk.dart';
Setup Instructions #
IOS Configuration #
-
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> <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> -
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 -
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.
-
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."
-
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 #
-
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" -
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" />
- In App-level build.gradle
buildTypes {
release {
// Add this to work everything fine in releas mode
minifyEnabled false
shrinkResources false
}
}
Usage #
Step 1: Initialize the Plugin #
- Start by creating an instance of the plugin:
final _nashidIoPlugin = NashidVerifySdk();
Step 2: Generate SDK Keys #
- Contact Nashid support to obtain your SDK Key and SDK Secret Key.
Main Functions #
- Initialize the SDK
Map<String, dynamic> response = await _nashidIoPlugin.initialize( sdkKey: "<your-sdk-key>", sdkSecretKey: "<your-sdk-secret-key>", );
-
String (2 letters): Language (default = en (English))
-
Example decodedResponse:
-
Response Success: { "result": true, "errorMessage": "" }
-
Response Error: { "result": false, "errorMessage": "Error message" }
-
-
Verify
// Oman ID Map<String, dynamic> response = verify(ofType: 1); // Passport Map<String, dynamic> response = verify(ofType: 2);-
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": "" }
-
-
Get Verification Result
Map<String, dynamic> response = await _nashidIoPlugingetVerificationResult( verificationId: ""ADDED_AS_STRING", );-
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.