Incode Cordova SDK reference

Incode Welcome

Incode Welcome provides effortless onboarding where security matters.
Incode Welcome is part of the Incode Omnichannel Biometric Identity Platform that is powered by Incode's world class Face Recognition, Liveness detection and ID Validation models. Organizations can choose to have an optional video conference to additionally verify the customer’s identity.

This document describes how to use the Cordova Plugin to enable remote account opening.

Supported Android Version

API level 21+ & compileSdk version 34.

Supported iOS Version

iOS 13+

Additional Steps for iOS

  1. For Cordova

    a. Run pod install under the ios folder

  2. For Capacitor/Ionic

    a. Copy the lines below into the Podfile

    source 'https://github.com/CocoaPods/Specs.git'
    source '[email protected]:Incode-Technologies-Example-Repos/IncdDistributionPodspecs.git'
    

    b. Run pod install or pod install --repo-update under the ios/app folder.

    c. npx cap sync

Installation

Install the Incode Cordova plugin in your app path using command:

cordova plugin add incode-cordova-plugin

OR

cordova plugin add https://github.com/Incode-Technologies-Example-Repos/incode-cordova-plugin.git

OR for the nfc version of plugin

cordova plugin add "https://github.com/Incode-Technologies-Example-Repos/incode-cordova-plugin.git#mainNfc"

Additional dependencies

As our SDK needs the camera to capture ID and face images, use the command:

cordova plugin add cordova-plugin-camera

Same applies for Geolocation; if it's required, use the command:

cordova plugin add cordova-plugin-geolocation

Implementation

The following functions can be used to initialize the SDK with different modules as per your business requirement.

SDK Initialize

The function below will initialize the Incode SDK, which is required at least once in the app life cycle.

cordova.exec(function(param) {
    console.log("Success: " + param);
    // Start the Incode session here.
}, function(err) {
    console.log("Error: " + err);
    // Handle the error by showing some UI or alert.
}, "Cplugin", "initializeSDK", [apiKey, apiUrl, loggingEnabled, testMode]);        

The function above takes the following mandatory parameters:

  1. apiKey - String - Pass the API Key mentioned in your delivery document here.
  2. apiUrl - String - Pass the API URL mentioned in your delivery document here.
  3. loggingEnabled - String - true/false - Should be the value to enable or disable logging.
  4. testMode - Set to true if running on simulator/emulators, false when running on devices. Default is false.

Start the session

The function below will start a fresh session when nothing is passed for interviewId. Otherwise, it reopens the existing session. It returns the interviewId and token in the on success callback.

cordova.exec(function(data) {
    console.log("OnSession created Success: " + data.interviewId + " Token:" + data.token);
    // Start the Incode modules or sections from here.
}, function(err) {
    console.log("startSession Error: " + err);
    // Handle the error by showing some UI or alert.
}, "Cplugin", "setupOnboardingSession", [
    configId,
    externalId,
    interviewId,
    externalToken,
    disableHookCheck,
    disableEmulatorDetection,
    disableRootDetection,
    disableJailbreakDetection,
]);

The function above takes following mandatory parameters:

  1. configId - String - This Id can be taken from our Incode dashboard (AKA FlowId). This will apply backend settings as set on the dashboard.
  2. externalId - String - This is the custom Id which clients can pass based on their unique identifier of the user. If not used, pass null.
  3. interviewId - String - This is the session Id on our Incode dashboard. If you want to restart the same session, then pass that Id here. If not used or is a first time session, this should be null.
  4. externalToken - String - This is the session token generated by your backend after calling our omni/start API. Make sure to add the token value in this parameter. configId can be null if this is passed.
  5. disableHookCheck - String - This is the flag to disable the check for hooking frameworks. Used only on Android.
  6. disableEmulatorDetection - String - This is the flag to disable emulator detection. Used only on Android.
  7. disableRootDetection - String - This is the flag to disable root detection. Used only on Android.
  8. disableJailbreakDetection - String - This is the flag to disable jailbreak detection. Used only on iOS.

Theming on iOS

To set the theme for iOS, use the function below. Make sure to call this function before startOnboardingSection.

 cordova.exec(function(param) {}, function(err) {
     console.log("Error in set Theme: " + err);
 }, "Cplugin", "setTheme", [jsonTheme]);

Start the section

Start the section by clubbing multiple modules. Refer to the code below to start the section with default settings.

cordova.exec(function(winParam) {
    console.log("Phone added Success: " + winParam);
    // Handle the response here.
}, function(err) {
    console.log("Error: " + err);
    // Handle the error by showing some UI or alert.
}, "Cplugin", "startOnboardingSection", [
    {"module": "addPhone"}, 
    {"module": "addGeolocation"},
    {
        "module": "addUserConsent",
        "title": "Title",
        "content": "Content"
    },
    {
        "module": "addMachineLearningConsent",
        "consentType": "US"
    },
    {
        "module": "addId",
        "showTutorials": "true",
        "waitForTutorials": "false",
        "idCategory": "FIRST",
        "enableBackShownAsFrontCheck": "true",
        "enableFrontShownAsBackCheck": "true",
        "autocaptureUXMode": "HOLDSTILL"
    },
    {
        "module": "addSelfieScan",
        "showTutorials": "true",
        "waitForTutorials": "false",
        "maskCheckEnabled": "true",
        "lensesCheckEnabled": "true"
    },
    {
        "module": "addFaceMatch",
        "matchType": "idSelfie"
    },
    {
        "module": "addNFC",
        "idType": "passport",
        "showNFCSymbolConfirmationScreen": "false",
        "showInitialDataConfirmationScreen": "false"
        "processNFCData": "false"
    },
    {"module": "addEKYC"},
    {"module": "addAntifraud"},
    {"module": "addGovernmentValidation"},
    {
        "module": "addDocumentScan",
        "documentType": "ADDRESS_STATEMENT"
    },
    {"module": "addSignature"}
]);                              

Our Cordova plugin supports following UI & Non UI modules:

  1. addPhone
  2. addGeolocation
  3. addId
  4. addSelfieScan
  5. addFaceMatch
  6. addSignature
  7. addGovernmentValidation
  8. addDocumentScan
  9. userScore
  10. approve (Non UI)
  11. getUserScore (Non UI)
  12. faceMatch (Non UI)
  13. startFaceLogin
  14. finishOnboarding (Non UI)
  15. addVideoSelfie
  16. addEKYC
  17. addAntifraud
  18. addNFC

Load individual modules

To load individual modules one at a time, refer to the example below. For all the modules, checkout our example implementation. Please reach out to your customer success manager for access.

cordova.exec(function(winParam) {
    console.log("Phone added Success: " + winParam);
    // Start the next module here.
}, function(err) {
    console.log("Error: " + err);
    // Handle the error by showing some UI or alert.
}, "Cplugin", "startOnboardingSection", ["addId"]);

Fetch scores

To fetch scores or results once onboarding modules are done, refer to the example below.

cordova.exec(function(winParam) {
    myObj = JSON.stringify(winParam);
    console.log("Score: " + myObj);
}, function(err) {
    console.log("Error: " + err);
}, "Cplugin", "getUserScore", ["fast"]);

Finishing the session

To finish the session, the code below is mandatory after all sections or modules are completed successfully. This should be called only once when all the sections are done.

cordova.exec(function(winParam) {
    console.log("finishOnboarding Success: " + winParam);
}, function(err) {
    console.log("Error: " + err);
    callbackError('Nothing to echo.' + err);
}, "Cplugin", "finishOnboarding", []);

Make sure to delete local cache data once all the above steps are over.

cordova.exec(function(winParam) {
    console.log("deleteLocalUserData Success: " + winParam);
}, function(err) {
    console.log("Error: " + err);
}, "Cplugin", "deleteUserLocalData", []);

License

Copyright 2024 Incode Technologies. All rights reserved.