Skip to main content

iOS SDK (Enhanced Version)

Attention

This documentation is for the Enhanced Version, encompassing expanded capabilities and advancements. We strongly recommend testing this version before using it in a production environment.

Getting Started

Latest release: SDK Version

Requirements

  • iOS 13.0 and higher
  • Internet connection
  • Latest Xcode Version

Resources

  • Integration Sample (Swift): Shufti Pro iOS-SDK

Integration

SDK Integration Guide

tip

It’s always recommended to use the updated version and run on physical device to get real results.

Note

Make sure your project contains pod file. If it does not, run pod init command in root of your project directory.

Add following pod to your Podfile

pod 'ShuftiPro-Onsite'

Permissions:

Application Info.plist must contain Privacy - Camera Usage Description with corresponding explanation to end-user about how the app will use these permissions

Basic Usage

Note

Make sure you have obtained authorization credentials before proceeding. You can get client id or secret key and generate access token like this.

Authorization

The following code snippet shows how to use the access token in auth object.

  • Access Token

    Make auth object using access token
let authKeys = [
"auth_type" : "access_token",
"access_token" : "xxxxx-xxxxx-xxxxx"
]

Configuration

The Shufti Pro’s mobile SDKs can be configured on the basis of parameters provided in the config object. The details of parameters can be found here.

let configs = [
"base_url": "api.shuftipro.com",
"consent_age": 16,
]

Request Object

This object contains the service objects and their settings through which the merchant wants to verify end users. Complete details of service objects and their parameters can be found here.

  • Import Shufti Pro
import ShuftiPro
  • Request Object
let requestObject: [String: Any] = [ 
"reference": "Unique reference",
"country": "",
"language": "",
"email": "[email protected]",
"callback_url": "http://www.example.com",
"show_results" : "",
"verification_mode": "image_only",
"face": ["proof": ""],
"document": [
"proof": "",
"additional_proof" :"",
"supported_types": [
"passport",
"id_card"
],
"name": [
"first_name": "",
"last_name": ""
],
"backside_proof_required": "0",
"dob": "",
"document_number": "",
"expiry_date": "",
"issue_date": ""
],
"address": [
"proof": "",
"full_address": "",
"name": [
"first_name": "",
"last_name": ""
],
"supported_types": [
"id_card",
"utility_bill",
"bank_statement"
]
],
"consent":[
"proof" : "",
"text" : "my consent note",
"supported_types" :[
"printed",
"handwritten"
]
]
]

Initialisation

Shufti Pro's mobile SDK can be initialized by using the following method and passing auth, config and request objects as the parameters.

let instance = Shufti()
instance.shuftiProVerification(requestObject: "your-request-object", authKeys: "authentication-keys-object",
parentVC: your viewController from where you want to open ShuftiPro,
configs: "configuration-object"){(result) in
print(result) // Callback response for verification verified/declined
let response = result as! NSDictionary
if response.value(forKey: "event") as? String == "verification.accepted" {
// Verified: Do something
} else {
// Declined: Do something
}
}

Callbacks

The SDK receives callback events as result, whether the verification journey is completed or left mid-way. The call back is received in following function

shufti.shuftiProVerification(requestObject: dataDictionary, authKeys: authKeys, parentVC: self, configs: configs) 
{
(result) in
let reponse = result as! NSDictionary
}

The complete list of callback events can be found here.

Callbacks Handling

All the callbacks can be handled inside the client's calling View/Screen. The response and callback handling code can be seen in the following code snippet

On SDK Completion

let reponse = result as? NSDictionary
if reponse?.value(forKey: "event") as? String == "verification.accepted" {
// Verification Accepted Callback
}
else if reponse?.value(forKey: "event") as? String == "verification.declined"{
// Verification Declined Callback
}
else if reponse?.value(forKey: "event") as? String == "request.received"{
// This event states that the verification request has been received and is under processing.
}
else if reponse?.value(forKey: "event") as? String == "request.pending"{
// This event is returned for all on-site verifications until the verification is completed or timeout.
}

On SDK Unauthentication

if reponse?.value(forKey: "event") as? String == "request.unauthorized"{
// This event occurs when the auth header is not correct and, client id/secret key may be invlaid.
}

On SDK Error


if reponse?.value(forKey: "event") as? String == "request.invalid"{
// The request invalid event occurs when the parameters specified in the request payload are not in the correct format.
}
else if reponse?.value(forKey: "event") as? String == "request.timeout"{
// This will occur if request has timed-out.
}
else if reponse?.value(forKey: "event") as? String == "permission.denied"{
// This event is returned if the user did not give camera and other permissions to sdk.
}
else if reponse?.value(forKey: "event") as? String == "verification.cancelled"{
//This event occurs when the end-user does not agree to the terms and conditions and also occur if in-between user cancel verification process.
}

Customisation

ShuftiPro supports a set of customisation options that will influence the appearance of the mobile SDK.

UI Customisation

To customise the color scheme of the entire ShuftiPro mobile SDK, as well as the text and background colors of the widgets, you can utilize the following keys within the config object.

let configs = [

"base_url": "api.shuftipro.com",
"button_text_color": "#XXXXXX",
"button_primary_color": "#XXXXXX",
"button_secondary_color": "#XXXXXX",
"heading_color": "#XXXXXX",
"sub_heading_color": "#XXXXXX",
"theme_color": "#XXXXXX",
"icon_color": "#XXXXXX",
"background_color": "#XXXXXX",
"stroke_color": "#XXXXXX",
"shuftipro_light_icon": false

]

Localization

Shufti Pro offers users the capability to customise the SDK text according to their preferred language. Merchants can modify the SDK language by specifying the language code in the country parameter within the main request object, such as "language": "en" List of all languages are mention here

NFC verification

Near Field Communication (NFC) is a set of short-range wireless technologies. NFC allows sharing of small data payloads between an NFC tag and an NFC-supported device. NFC Chips found in modern passports, and similar identity documents contain additional encrypted information about the owner. This information is very useful in verifying the originality of a document. NFC technology helps make the verification process simple, quicker and more secure. This also provides the user with contactless and input less verification. ShuftiPro's NFC verification feature detects MRZ from the document to authenticate NFC chips and retrieve data from it, so the authenticity and originality of the provided document can be verified.

Installation

Step 1 Application Info.plist must contain a Privacy - Camera Usage Description, and Privacy - NFC Scan Usage Description key with an explanation to the end-user about how the app uses this data.

Step 2 And Open your Info.plist file as Source Code add these lines inside the dict tag.

<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key> 
<array>
<string>00000000000000</string>
<string>A0000002471001</string>
</array>

Step 3 In your Project target, add under the Signing and Capabilities section, tap on Capabilities and add Near Field Communication Tag Reading.For more guidance watch this guided image here

Step 4 Add this dependency into your project's Podfile.

pod 'ShuftiProNFC'

Step 5 Please make sure to add the following post-install hook to your Podfile.

post_install do |installer|
installer.aggregate_targets.each do |target|
target.xcconfigs.each do |variant, xcconfig|
xcconfig_path = target.client_root + target.xcconfig_relative_path(variant)
IO.write(xcconfig_path, IO.read(xcconfig_path).gsub("DT_TOOLCHAIN_DIR", "TOOLCHAIN_DIR"))
end
end

installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.base_configuration_reference.is_a? Xcodeproj::Project::Object::PBXFileReference
xcconfig_path = config.base_configuration_reference.real_path
IO.write(xcconfig_path, IO.read(xcconfig_path).gsub("DT_TOOLCHAIN_DIR", "TOOLCHAIN_DIR"))
end

if ['OpenSSL-Universal'].include? target.name
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
end
end
end
end

To check NFC supported documents and countries, please click here.

info

Nfc verification is allowed only on e-passports under document, document_two and address service only.

All-In-One SDK

A dynamic and efficient tool designed to transform user verification into a streamlined and effortless process. This powerful SDK enables the integration of multiple verification journeys using just a single line of code, catering to various user events and scenarios Our SDK automatically listens for the Journey you associate with a customer and initiates the verification process immediately.

Client Side

Step 1: Initialize the ShuftiPro SDK To initialize the SDK, create a new instance of ShuftiPro and call the init method with initial data:

var instance = Shufti()
instance.register(clientID: "client_id", customerID: "customer_id", configs: configs) { result in
print(result)
}

The details of parameters can be found here.

Step 2 (Optional): Destroying the SDK Instance:

To clean up and destroy the SDK instance, call the destroy method.

instance.unRegister()

Server Side

Trigger verification Journey

This API triggers verification for a given customer (customer_id) with the provided verification journey (journey_id).

API Endpoint: https://api.shuftipro.com/create/customer/journey

Send the following payload to initiate the creation of a customer journey.

{
"journey_id" : "ULMTCqye1719840116",
"customer_id" : "TestingCustomer595"
"reference" : "123456789"
}

The details of parameters can be found here.

You will receive the following response from the API call.

{
"error": false,
"message": "customer journey created successfully"
}

The details of parameters can be found here.

SDK size

The complete size of Shufti Pro's iOS SDK is 15 MB.

info

If you require a lightweight SDK, we can offer a version that operates exclusively on physical devices and has a size of only 8MB

Revision History

DateSDK VersionsDescription
Jul 19, 20241.2.1Improvement
We are implementing the following features in the mobile SDK:
1. All in One SDK.
2. Added new service "AML for business".
3. Masking of Credit & Debit Card number in OCR form.
4. Show images on Retry Screen
5. Reduce the loaders to improve the verification journey.
Jul 03, 20241.2.0Improvement
We are implementing the following features in the mobile SDK:
1. Implement Journey Builder
2. Added support of merchant logo at footer
3. Added support of Simulators.
Jun 21, 20241.1.11Improvement
Improve the functionality of SDK in case of empty language field.
Jun 12, 20241.1.10Improvement
We are implementing the following features in the mobile SDK:
1. Enhanced instruction screen.
2. Addition of a nationality field in the OCR form.
3. Integration of NFC functionality.
May 15, 20241.1.9Improvement
Added support of XCode version 15.4
May 03, 20241.1.8Improvement

Improve your theme customisation with the below new parameters.
icon_color: Alter the color of icons within the SDK
background_color: Modify the background color of the SDK.
stroke_color: Adjust the color of borders used within the SDK.
shuftipro_light_icon: Customise the color of the Shuftipro icon in both light and dark modes.
For further details, refer to the customisation section in the documentation.
Apr 24, 20241.1.6Improvement
Enhanced the consent screen and improved the user experience of the SDK.
Apr 22, 20241.1.5Improvement
Enhanced the autocapture countdown logic within the Camera Screen.
Apr 18, 20241.1.4Improvement
Resolved the API 401 issue on the verification result screen.
Apr 17, 20241.1.3Improvement
We've implemented a new feature that eliminates the need for OCR inputs for background checks when the name and date of birth are extracted from the document service. This functionality can be activated upon request through ShuftiPro tech support.
Apr 03, 20241.1.2Improvement
Include a layout feature on the camera screen for both face and document services during video recording to enhance the presentation of evidence and improve the user experience.
Mar 27, 20241.1.1Improvement
Implemented a new feature for face liveness verification, requiring users to align their faces with multiple overlays to authenticate their identity.
Mar 20, 20241.1.0Improvement
A language selection sheet now includes the option for translated languages.
Mar 18, 20241.0.10Improvement
Included a new parameter called "loading_text" within the config object, enabling the modification of the loading text displayed at the initiation of the SDK.
Mar 13, 20241.0.9Improvement
Added support of XCode version 15.3
Feb 23, 20241.0.7Improvements:
1. Enhanced SDK Design: Revamped the overall design of the SDK for improved usability and aesthetics.

2. Cropped Image Display: Incorporated the ability to display cropped images within the document service, enhancing user experience and clarity.

3. AutoCapture Countdown Timer: Integrated a countdown timer in AutoCapture mode for precise document placement within the designated rectangle, ensuring clear and accurate image capture.

4. Image Preview Zoom Functionality: Integrated a zoom feature in the image preview section, enabling users to examine images more closely.

5. Streamlined User Consent: Transitioned user consent from a full-screen display to a more user-friendly dialog box, enhancing accessibility and user interaction.

6. NFC Integration: Implemented Near Field Communication (NFC) functionality within the Onsite SDK, enabling seamless communication with NFC-enabled devices

Additions:
1. Phone and Email Service: Added new services for phone and email functionalities, expanding the range of verification options available within the SDK.
Dec 19, 20231.0.4Improvement
Added support of XCode version 15.1.
Dec 13, 20231.0.3Improvement
Improve user experience of iOS SDK.
Dec 07, 20231.0.2Improvement
Onsite SDK now offers an enhanced user interface along with improved features for localization, OCR Form, and a Retry Option.