IDentityLegacy SDK Cordova Wrapper

Legacy SDK Cordova Wrapper

On this page · 9 sections

Legacy SDK Cordova Wrapper

IDMission SDK Cordova Plugin

This plugin is a comprehensive toolkit that offers identity services (e.g. ID validation, live face detection, etc.) for positive identification.

Installation

If you download the plugin

ionic cordova plugin add PATH\IDMissionSDK_Cordova_Plugin

Loading it from the GitHub repository

ionic cordova plugin add https://github.com/idmission/pluginCordova.git

Configurations for Android

Platform

  • If it exists, delete it with ionic cordova platform rm android and re-create with ionic cordova platform add android
  • If it doesn't exist, create it withionic cordova platform add android

Prepare Android

  • To prepare it, execute ionic cordova prepare android

File build.gradle

  • Alter file build.gradle inside the folder app of the project, add the following information:
android 
{
    compileSdkVersion 27
    buildToolsVersion "27.0.3"
    defaultConfig 
    {
        applicationId "com.idmission.sdk.Client"
        minSdkVersion 23
        targetSdkVersion 26
        versionCode 20190816
        versionName "6.3.3.3"
        multiDexEnabled true
        ndk 
        {
        // Don't package arm64-v8a or x86_64, 'x86'
        abiFilters 'armeabi-v7a'
        }
    }
    dexOptions 
    {
    javaMaxHeapSize "4g"
    }
    aaptOptions 
    {
    noCompress "tflite"
    }
}
  • Search for the buildscript property and within the dependencies section add the following line:
classpath 'com.google.gms:google-services:4.2.0'
  • Find the dependencies property and add the following lines:
implementation files ('libs/idm-imgproc-7.2.4.26.aar') 
implementation files ('libs/OpenCV_4.1.1.aar') 
implementation 'androidx.appcompat:appcompat:1.1.0' 
implementation 'io.fotoapparat:fotoapparat:2.6.1' 
implementation 'org.tensorflow:tensorflow-lite:0.0.0-nightly' 
implementation 'com.google.android.gms:play-services-location:16.0.0' 
implementation 'com.google.firebase:firebase-ml-vision:24.0.1' 
implementation 'com.google.firebase:firebase-ml-vision-face-model:19.0.0' 
implementation 'com.google.firebase:firebase-core:17.2.2'
  • At the end of the file add the following line:
apply plugin:'com.google.gms.google-services'

File google-services.json

Make sure the package_name is the same as your project ID

Configurations for IOS

Platform

  • If it exists, delete it with ionic cordova platform rm ios and re-create with ionic cordova platform add ios
  • If it doesn't exist, create it with ionic cordova platform add ios

Prepare IOS

  • To prepare it, execute ionic cordova prepare ios

Install Pod

In platforms/ios install pod:

pod install

Settings in Xcode

  • Add the framework AppItFramework.framework to the root of the project.
    • Note: Make sure that the Embed option of the framework AppItFramework.framework is in Embed & Sign
  • Add the file idmissionconfig.json inside the folder Classes
  • Edit the MainViewController.h file:
    • Add the import: #import <AppItFramework/AppItframework.h>
    • And where it says @interface MainViewController : CDVViewController overwrite it by:
@interface MainViewController : CDVViewController<AppItSDKResponse> 
@property (nonatomic, copy, readwrite) NSString *scanCallbackId; 
- (void)sendSuccessTo:(NSString *)callbackId withObject:(id)objwithObject; 
- (void)sendFailureTo:(NSString *)callbackId withObject:(id)objwithObject;
  • Edit the MainViewController.m file:
    • Inside the implementation MainViewController:

//IDmission SDK Methods - Start 
-(void) sendSuccessTo: (NSString * ) callbackId withObject: (id) obj {
        CDVPluginResult * result = nil;
        if ([obj isKindOfClass: [NSString class]]) {
            result = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK messageAsString: obj];
        } else if ([obj isKindOfClass: [NSDictionary class]]) {
            NSError * error;
            NSData * jsonData = [NSJSONSerialization dataWithJSONObject: obj options: NSJSONWritingPrettyPrinted // Pass 0 if you don't care about the readability of the generated string error:&error]; if (! jsonData) 
                {
                    NSLog(@ "Got an error: %@", error);
                } else {
                    NSString * jsonString = [
                        [NSString alloc] initWithData: jsonData encoding: NSUTF8StringEncoding
                    ];
                    result = [CDVPlu CDVPluginResult resultWithStatus: CDVCommandStatus_OK messageAsString: jsonString];
                }
            }
            else if ([obj isKindOfClass: [NSNumber class]]) {
                // all the numbers we return are bools result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:[obj intValue]]; 
            } else if (!obj) {
                result = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK];
            } else {
                NSLog(@ "Success callback wrapper not yet implemented for class %@", [obj class]);
            }
            [self.commandDelegate sendPluginResult: result callbackId: callbackId];
        }

        -
        (void) sendFailureTo: (NSString * ) callbackId withObject: (id) obj {
                CDVPluginResult * result = nil;
                if ([obj isKindOfClass: [NSString class]]) {
                    result = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: obj];
                } else if ([obj isKindOfClass: [NSDictionary class]]) {
                    NSError * error;
                    NSData * jsonData = [NSJSONSerialization dataWithJSONObject: obj options: NSJSONWritingPrettyPrinted // Pass 0 if you don't care about the readability of the generated string error:&error]; 
                        if (!jsonData) {
                            NSLog(@ "Got an error: %@", error);
                        } else {
                            NSString * jsonString = [
                                [NSString alloc] initWithData: jsonData encoding: NSUTF8StringEncoding
                            ];
                            result = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK messageAsString: jsonString];
                        }
                    }
                    else if ([obj isKindOfClass: [NSNumber class]]) {
                        // all the numbers we return are bools result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsInt:[obj intValue]]; 
                    } else if (!obj) {
                        result = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR];
                    } else {
                        NSLog(@ "Success callback wrapper not yet implemented for class %@", [obj class]);
                    }
                    [self.commandDelegate sendPluginResult: result callbackId: callbackId];
                }

                -
                (void) bankStatementDetectionResponse: (NSMutableDictionary * ) result {} -
                    (void) birthCertificateDetectionResponse: (NSMutableDictionary * ) result {} -
                    (void) captureImageResponse: (NSMutableDictionary * ) result {
                        NSLog(@ "captureImageResponse");
                        [self sendSuccessTo: self.scanCallbackId withObject: result];
                    } -
                    (void) captureSignatureResponse: (NSMutableDictionary * ) result {} -
                    (void) cardDetectionResponse: (NSMutableDictionary * ) result {} -
                    (void) completeOperationResponse: (NSMutableDictionary * ) result {} -
                    (void) createEmployeeResponse: (NSMutableDictionary * ) result {} -
                    (void) executeGenericResponse: (NSMutableDictionary * ) result {} -
                    (void) faceDetectionResponse: (NSMutableDictionary * ) result {
                        NSLog(@ "faceDetectionResponse");
                        [self sendSuccessTo: self.scanCallbackId withObject: result];
                    } -
                    (void) faceMatchingResponse: (NSMutableDictionary * ) result {} -
                    (void) fingerprintEnrolmentResponse: (NSMutableDictionary * ) result {} -
                    (void) fingerprintVerificationResponse: (NSMutableDictionary * ) result {} -
                    (void) fourFingerprintDetectionResponse: (NSMutableDictionary * ) result {} -
                    (void) generateOTPResponse: (NSMutableDictionary * ) result {} -
                    (void) generateTokenResponse: (NSMutableDictionary * ) result {} -
                    (void) genericDocumentResponse: (NSMutableDictionary * ) result {} -
                    (void) gpsCoordinateResponse: (NSMutableDictionary * ) result {} -
                    (void) idValidationAndVideoMatchingResponse: (NSMutableDictionary * ) result {} -
                    (void) cardDetectionResponse: (NSMutableDictionary * ) result {} -
                    (void) completeOperationResponse: (NSMutableDictionary * ) result {} -
                    (void) createEmployeeResponse: (NSMutableDictionary * ) result {} -
                    (void) executeGenericResponse: (NSMutableDictionary * ) result {} -
                    (void) faceDetectionResponse: (NSMutableDictionary * ) result {
                        NSLog(@ "faceDetectionResponse");
                        [self sendSuccessTo: self.scanCallbackId withObject: result];
                    } -
                    (void) faceMatchingResponse: (NSMutableDictionary * ) result {} -
                    (void) fingerprintEnrolmentResponse: (NSMutableDictionary * ) result {} -
                    (void) fingerprintVerificationResponse: (NSMutableDictionary * ) result {} -
                    (void) fourFingerprintDetectionResponse: (NSMutableDictionary * ) result {} -
                    (void) generateOTPResponse: (NSMutableDictionary * ) result {} -
                    (void) generateTokenResponse: (NSMutableDictionary * ) result {} -
                    (void) genericDocumentResponse: (NSMutableDictionary * ) result {} -
                    (void) gpsCoordinateResponse: (NSMutableDictionary * ) result {} -
                    (void) idValidationAndVideoMatchingResponse: (NSMutableDictionary * ) result {} -
                    (void) videoRecordingResponse: (NSMutableDictionary * ) result {
                        NSLog(@ "videoRecordingResponse"); //[0] (null) @"statusMessage" : @"Success" //[1] (null) @"statusCode" : @"0" //[2] (null) @"StatusCode" : @"0" 
                        NSMutableDictionary * filteredResp = [NSMutableDictionary dictionary];
                        [filteredResp setValue: [result objectForKey: @ "statusMessage"] forKey: @ "statusMessage"];
                        [filteredResp setValue: [result objectForKey: @ "statusCode"] forKey: @ "statusCode"];
                        [filteredResp setValue: [result objectForKey: @ "StatusCode"] forKey: @ "StatusCode"];
                        [self sendSuccessTo: self.scanCallbackId withObject: filteredResp];
                    } -
                    (void) voiceRecordingResponse: (NSMutableDictionary * ) result {} //IDmission SDK Methods - End

Properties

  • idm_sdk_init
  • idm_sdk_IdFront
  • idm_sdk_IdBack
  • idm_sdk_detectFace
  • idm_sdk_recordVideo
  • idm_sdk_getPermissions (Only Android)
  • idm_sdk_CaptureSignature
  • idm_sdk_processImageAndMatchFace

Usage

To use the plugin, you need to create an integration user at Evolv IDMission and request the login credentials.

idm_sdk_init

It is necessary to execute this function first before the others.

var exampleData = {
    url: 'https://kyc.idmission.com/IDS/service/integ/idm/thirdparty/upsert',
    loginId: 'ev_integ_54192',
    password: 'IDmi#192$',
    merchantID: '33635',
    productID: '920',
    productName: 'Identity_Validation_and_Face_Matching',
    Language: 'en',
    EnableDebug: 'true',
    enableGPS: 'true'
};
( < any > window).cordova.plugins.IDMissionSDK_Cordova_Plugin.idm_sdk_init(JSON.stringify(exampleData), this.successCallback, this.errorCallback);

JSON success response

{
    "StatusCode": "0",
    "StatusMessage": "Success",
    "statusCode": "0",
    "statusMessage": "Success"
}

JSON error response

{
    "StatusCode": "-1",
    "StatusMessage": , // Error type message "statusCode": "-1", "statusMessage": // Error type message 
}

idm_sdk_IdFront

This function will open the camera that will automatically take the photo of the credential.

(<any>window).cordova.plugins.IDMissionSDK_Cordova_Plugin.idm_sdk_IdFront(null,this.successCallback, this.errorCallback);

JSON success response

{ "FRONT": "", // Base64 Image }

JSON error response

{ "StatusCode": "-1", "StatusMessage": , // Error type message "statusCode": "-1", "statusMessage": // Error type message }

idm_sdk_IdBack

This function will open the camera that will automatically take the photo of the back of the credential.

(<any>window).cordova.plugins.IDMissionSDK_Cordova_Plugin.idm_sdk_IdBack(null,this.successCallback, this.errorCallback);

JSON success response

{ "BACK": "", // Base64 Image }

JSON error response

{ "StatusCode": "-1", "StatusMessage": , // Error type message "statusCode": "-1", "statusMessage": // Error type message }

idm_sdk_detectFace

This function will open the camera that will automatically take a selfie of the user.

(<any>window).cordova.plugins.IDMissionSDK_Cordova_Plugin.idm_sdk_detectFace(null,this.successCallback, this.errorCallback);

JSON success response

{ "FACE": "", // Base64 Image }

JSON error response


{ "StatusCode": "-1", "StatusMessage": , // Error type message "statusCode": "-1", "statusMessage": // Error type message }

idm_sdk_recordVideo

This function will open the camera with which you can record.

var options = {
    recordingTime: 30,
    textDatatoScrolled: 'Hello world! Please let me know how this is recorded to the end of the video.'
};
( < any > window).cordova.plugins.IDMissionSDK_Cordova_Plugin.idm_sdk_recordVideo(JSON.stringify(options), this.successCallback, this.errorCallback);

JSON success response

{ "StatusCode": "0", "StatusMessage": "Success", "statusCode": "0", "statusMessage": "Success" }

JSON error response

{ "StatusCode": "-1", "StatusMessage": , // Error type message "statusCode": "-1", "statusMessage": // Error type message }

idm_sdk_getPermissions

Only for Android, you can obtain the permissions of the following native properties:

  • CAMERA
  • MODIFY_AUDIO_SETTINGS
  • RECORD_AUDIO
  • READ_EXTERNAL_STORAGE
  • WRITE_EXTERNAL_STORAGE
var permission = { permissionName : "CAMERA", // Type Permission }; (<any>window).cordova.plugins.IDMissionSDK_Cordova_Plugin.idm_sdk_getPermissions(JSON.stringify(permission),this.successCallback, this.errorCallback);

JSON success response

{ "StatusCode": "0", "StatusMessage": "Success", "statusCode": "0", "statusMessage": "Success" }

JSON error response

{ "StatusCode": "-1", "StatusMessage": , // Error type message "statusCode": "-1", "statusMessage": // Error type message }

idm_sdk_CaptureSignature

This function will open a blank screen where you can capture the signature.

(<any>window).cordova.plugins.IDMissionSDK_Cordova_Plugin.idm_sdk_CaptureSignature(null,this.successCallback, this.errorCallback);

JSON success response

{ "result": "", // Base64 Image }

JSON error response

{ "StatusCode": "-1", "StatusMessage": , // Error type message "statusCode": "-1", "statusMessage": // Error type message }

idm_sdk_processImageAndMatchFace

This function will send the form with the data collected from the previous functions to process the identity of the user to be registered.

var options = {
    countryCode: 'USA',
    stateCode: '',
    idType: 'PP',
    faceImageType: '',
    additionalDictionary: {
        Service_ID: 10
    },
    finalSubmit: 'true',
    clearFormKey: 'true'
};
( < any > window).cordova.plugins.IDMissionSDK_Cordova_Plugin.idm_sdk_processImageAndMatchFace(JSON.stringify(options), this.successCallback, this.errorCallback);

JSON success response

{
    "Status_Code": "000",
    "Status_Message": "Form Submitted Successfully",
    "Request_Id": "000000000",
    "FormKey": "IDMTPIA_0000000000000_00:C0:F0:F0:C0:00",
    "FormID": "00000000",
    "ProductId": "920",
    "State": "Template Not Found",
    "Face_Detected": "Y",
    "EnoughFeatureFoundOnID_FRONT": "Y",
    "NoTemplatesAvailable": "N",
    "EnoughFeatureFound": "Y",
    "MatchingTemplateFound": "D",
    "MRZValid": "NA",
    "PixelCount": "272688",
    "InputImagePixelCount": "272688",
    "LowResolution": "N",
    "ColorCode": "C",
    "IDBackImageExpected": "N",
    "PhotoEditingSoftwareDetected": "N",
    "ImageDateDiscrepancy": "N",
    "BarCodeExpected": "N",
    "IDImageMismatch": "N",
    "MRExist": "N",
    "Form_State_Code": "15",
    "FaceVerificationStatus": "Verified",
    "IsPassport": "N",
    "TotalDedupMatches": "0",
    "NegativeDBMatchFound": "N",
    "StatusCode": "0",
    "StatusMessage": "Success",
    "statusMessage": "Success",
    "statusCode": "0"
}

JSON response

If daily limit forms are exceeded

{
    "Status_Code": "3057",
    "Status_Message": "You have exceeded the limit of \"10\" forms in \"24\" hours",
    "ErrorData": "{}",
    "Request_Id": "000000000",
    "ProductId": "920",
    "StatusCode": "0",
    "StatusMessage": "Success",
    "statusMessage": "Success",
    "statusCode": "0"
}

JSON error response

{ "StatusCode": "-1", "StatusMessage": , // Error type message "statusCode": "-1", "statusMessage": // Error type message }

Note

The above documentation can be found in the following path

https://drive.google.com/file/d/1nHfvM60iirtKKhY3x7Es8fcAc4oj1iMN/view?usp=sharing

After extracting the zip that was downloaded, the documentation file is located at IDMissionSDK_Cordova_Plugin.zip-> IDMissionSDK_Cordova_Plugin-> README.md

In order to see it locally, I use an extension in my Visual Studio Code called "Markdown Preview Enhanced" by Yiyi Wang

Report a docs issue

Copy this context into your team’s issue tracker or an email to support@idmission.com.