Skip to main content

iOS SDK

Getting Started

Latest release: version 3.5.7

Requirements

  • iOS 11.0 and higher (Without NFC)
  • iOS 13.0 and higher (With NFC)
  • Internet connection
  • Latest Xcode Version

Resources

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

Installation

tip

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

If you want to run sdk on simulator use this sdk but only for testing purpose.

Note

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

1. Add following pod to your Podfile

pod 'ShuftiPro', :tag => '3.5.7', :git => "https://github.com/shuftipro/iOS-binary-pod"

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

post_install do |installer|
installer.pods_project.targets.each do |target|
if ['lottie-ios', 'Socket.IO-Client-Swift', 'Starscream'].include? target.name
target.build_configurations.each do |config|
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
end
end
end
end

Permissions:

Application Info.plist must contain Privacy - Camera Usage Description , Privacy - Microphone Usage Description and Privacy - NFC Scan Usage Descriptionkey 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 = [
"open_webview" : false,//pass true for verification through hybrid view
"async" : false,
"dark_mode": false,
"video_kyc": false,
]

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": "EN",
"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 = ShuftiPro()
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
}
}

Verification Types

Native Flow

In the native verification flow, the end-user interacts with the native mobile SDK. The native flow of verification tends to be much faster since the whole process depends on the device's processing power. All the proofs are taken against required services and then a request is made to the server
You can enable native flow by passing false for open_webview key in Config object.

let configs = [
"open_webview" : false, //pass false for verification through native view
]

Hybrid Flow

The hybrid verification flow includes mobile verifications on a web view built on HTML 5 that will show the verification process to the end user. End-user provides the information in the online customer onboarding process. In hybrid flow, proofs are uploaded after every service, verification results are shown simultaneously in case of decline, and the user can retry the request.
You can enable hybrid flow by passing true for open_webview key in Config object.

let configs = [
"open_webview" : true, //pass true for verification through hybrid view
]
info

In both flows, Shufti Pro provides the facility to their customers to tailor the identity verification services according to their needs.

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 customization options that will influence the appearance of the mobile SDK.

Verification flow and UI

The complete verification journey is customisable. To skip the screen from verification flow, you need to provide corresponding parameter to the SDK through the request/config object. For instance;

Request Object

"country" : "GB" // providing a value to this parameter will not ask the end user to provide his country

"verification_mode" : "image_only" // "image_only" or "video_only" values will allow you to avoid mode selection at real-time

"allow_online" : "1" // 1 value will ask the user to capture real time proofs(image or video) depending upon verification mode

"allow_offline" : "1" // 1 value will ask the user to upload proofs(image or video) depending upon verification mode

"decline_on_single_step" : "1" // this parameter will work with onsite flow(open_webview : true). This will show continue the journey only if pervious step is successfully verified

"show_feedback_form" : "1" // this parameter will work with onsite flow(open_webview : true). 1 value will ask the user for its feedback at the end of verification

// Service Level Parameters

"supported_types" : [id_card] // providing a single value to this parameter will not ask the user for document type

"show_ocr_form" : "1" // this parameter will work with onsite flow(open_webview : true). 1 value will show the OCR form to the user

Config Object

"asyncRequest": "true" // passing true value to this parameter will not show result screen to the user and will just return the callback on request completion

Colours

The colour of buttons and font can be customized using the following parameters with Shufti Pro's instance.

instance.buttonTextColor = .white 
instance.buttonBackgroundColor = .blue
instance.fontColor = .black

Personalization

Shufti Pro provides its users with the facility to personalize the text of the SDK according to their individual requirements. The text of the SDK can be personalize by adding your own Localizable.strings file to your project using a standard iOS localization mechanism. To change a specific text, override the corresponding key in this Localizable.strings file.

Dark mode

To apply dark theme/mode in SDK, initialize the SDK with following parameter in the config object.

"dark_mode" : true,

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, Privacy - Microphone 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', :tag => '3.5.1', :git => "https://github.com/shuftipro/ios-nfc-binary-pod.git"

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

post_install do |installer|
installer.pods_project.targets.each do |target|
if ['lottie-ios', 'Socket.IO-Client-Swift', 'Starscream','NFCPassportReader'].include? target.name
target.build_configurations.each do |config|
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
end
end
end
end
info

Nfc verification is allowed only on e-passports under document, document_two and address service only. The nfc service is not available in hybrid view for now.

SDK size

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

Changelog

DateSDK VersionsChanges
May 30, 20233.5.7
  • Improve functionality and fix minor issues
May 08, 20233.5.6
  • Reduce SDK size to 15MB.
May 04, 20233.5.5
  • Reduce SDK size and improve UI.
Apr 29, 20233.5.4
  • Add new translation phrases in sdk.
Apr 20, 20233.5.3
  • Added iOS 11 support.
Apr 19, 20233.5.2
  • Fix minor bugs and improve user experience.
Apr 11, 20233.5.1
  • Enhance UI and improve user experience.
Apr 10, 20233.5.0
  • Fix phrase issues of supported type screen.
Mar 28, 20233.4.8
  • Handled camera permissions if denied from settings
Mar 17, 20233.4.7
  • Updated list of countries.
Mar 16, 20233.4.6
  • Full screen preview of captured proof
  • Crash on backpress in face verifictaion is fixed
Jan 25, 20233.4.5
  • Added video KYC service inside SDK in which users can verify identity through video calls with the shuftipro agent.
Jan 20, 20233.4.4
  • Fix threads issues in camera screen.
Jan 16, 20233.4.3
  • Tap to focus feature is added to camera
  • Image quality while capturing proofs, is increased
Jan 03, 20233.4.1
  • Reduce framework file
    • The size of framework file has been reduced, making it easier and convinent to use.
  • Fix camera permission denied callback
    • A call back has been added when end user denies the permissions required for SDK.
Sep 12, 20223.4.0
  • Improved UI for NFC verification.
    • Animated instruction(gif) for NFC was improved
    • Data representation was improved
  • Resolve the white line issue on the face preview
    • A very thin white line appeared on the face captured proof, this issue is now fixed.
Aug 25, 20223.3.9
  • Fix native to web callback issue
    • While navigating from native to web flow, the callback gets lost.
  • Added the option to switch between visual and textual instructions..
Aug 15, 20223.3.8
  • Improved instructions for face verification
    • More accurate instructions were added in image form