iOS SDK
Getting Started
Latest release: version 3.4.5
Requirements
- iOS 13.0 and higher
- Internet connection
- The Xcode version should be the latest
Resources
- Integration Sample (Swift): Shufti Pro iOS-SDK
Installation
It’s always recommended to use the updated version
- Add this pod into your Podfile.
pod 'ShuftiPro', :tag => '3.4.5', :git => "https://github.com/shuftipro/iOS-binary-pod"
- 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'
end
end
end
end
Basic Usage
Make sure you have obtained the client id and secret key or access token before proceeding
Authorization
Shufti Pro provides two types of authorization to its users. The following shows the code snippet of how to use the authorization keys to authenticate the SDK.
Basic Auth
Make auth object using client id and secret key
let authKeys = [
"auth_type" : "basic_auth",
"client_id" : "xxxxx-xxxxx-xxxxx",
"secret_key": "xxxxx-xxxxx-xxxxx"
]
Access Token
Or make auth object using access token
let authKeys = [
"auth_type" : "access_token",
"access_token" : "xxxxx-xxxxx-xxxxx"
]
You can get client id or secret key and generate access token like this
Configuration
The Shufti Pro’s mobile SDKs can be configured on the basis of parameters provided in the config object. Make config object
let configs = [
"open_webview" : false,//pass true for verification through hybrid view
"async" : false,
"dark_mode": false,
"video_kyc": false,
]
Config object parameters are explained here.
Request Object
This object contains the service objects and their settings through which the merchant wants to verify end users. 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" : "",
"show_consent" : "",
"show_privacy_policy" : "",
"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 using the given 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 app depends on the device's processing power for the verification process. Also, all the proofs are taken for all services in native flow first and then and only then, is a request made to the server in the form of JSONObject.
You can enable native flow by passing false
for open_webview
key in Config
object.
Config.put("open_webview",false);
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 as every service is performed, verification results are shown simultaneously in case of decline, and the user can retry the request.
You can enable native flow by passing true
for open_webview
key in Config
object.
Config.put("open_webview",true);
In both flows, Shufti Pro provides the facility to their customers to tailor the identity verification services according to their needs.
SDK Flow

Callbacks
Callbacks are received whenever the SDK is terminated or closed, whether after request completion or if the verification journey is left mid-way. The call backs are received in
(result) in
print(result) // Callback response for verification verified/declined
let reponse = result as! NSDictionary
Following is the list of callbacks we receive in the above function.
Keys | Values | Description |
---|---|---|
Event | request.unauthorized | The auth header is not correct and, client id/secret key may be invlaid. |
Event | request.pending | This event is returned for all on-site verifications until the verification is completed or timeout. |
Event | verification.accepted | Verification accepted callback |
Event | verification.declined | Verification declined callback |
Event | permission.denied | This event is returned if the user did not give camera and other permissions to sdk. |
Event | request.timeout | This will occur if request has timed-out |
Event | verification.cancelled | This callback is returned when verification is cancelled midway by the end user |
Event | request.received | This event states that the verification request has been received and is under processing |
Event | request.invalid | The request invalid event occurs when the parameters specified in the request payload are not in the correct format. |
Error | Internet Connection Error | This callback is returned in case of lost internet connectivity |
You can check complete response of shuftipro from here
Callbacks Handling
All the callbacks can be handled inside the client's calling activity. The response and callback handling can be seen in the image below:
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
else 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
else 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 remove the screen from verification flow, you need to provide that parameter to the SDK through request/config object. For instance;
Request Object
"show_consent" : "0" // providing this parameter 0 value will hide the verification consent screen
"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
"show_privacy_policy" : "0" // value will remove the privacy policy content shown at result screen
"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
Localization
Shufti Pro provides its users with the facility to translate the SDK entirely into their desired language or customize the text of the SDK according to their requirements. The text of the SDK can be customized 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 provided parameters 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 Descriptionkey 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.4.5', :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'
end
end
end
end
Nfc verification is allowed only on e-passports under document, document_two and address service only. The NFC service is not available in the hybrid web view for now.
SDK size
The complete size of Shufti Pro's android SDK is 15.1 MB.
Changelog
SDK Versions | Changes |
---|---|
3.4.5 |
|
3.4.4 |
|
3.4.3 |
|
3.4.1 |
|
3.4.0 |
|
3.3.9 |
|
3.3.8 |
|