iOS SDK (Enhanced Version)
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:
Requirements
- iOS 13.0 and higher
- Internet connection
- Latest Xcode Version
Resources
- Integration Sample (Swift): Shufti Pro iOS-SDK
Integration
SDK Integration Guide
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.
- Cocoapods
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-Onsite'
2. 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 ['Socket.IO-Client-Swift', 'Starscream'].include? target.name
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
and Privacy - Microphone Usage Description
with corresponding explanation to end-user about how the app will use these permissions
Basic Usage
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 = [
"show_requirement_page": true
"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 = 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
}
}
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.
UI Customisation
To customize 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",
]
Localization
Shufti Pro offers users the capability to customize 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
SDK size
The complete size of Shufti Pro's iOS SDK is 9.8 MB.
Revision History
Date | SDK Versions | Description |
---|---|---|
Apr 17, 2024 | 1.1.3 | Improvement 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, 2024 | 1.1.2 | Improvement 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, 2024 | 1.1.1 | Improvement Implemented a new feature for face liveness verification, requiring users to align their faces with multiple overlays to authenticate their identity. |
Mar 20, 2024 | 1.1.0 | Improvement A language selection sheet now includes the option for translated languages. |
Mar 18, 2024 | 1.0.10 | Improvement 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, 2024 | 1.0.9 | Improvement Added support of XCode version 15.3 |
Feb 23, 2024 | 1.0.7 | Improvements: 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, 2023 | 1.0.4 | Improvement Added support of XCode version 15.1. |
Dec 13, 2023 | 1.0.3 | Improvement Improve user experience of iOS SDK. |
Dec 07, 2023 | 1.0.2 | Improvement Onsite SDK now offers an enhanced user interface along with improved features for localization, OCR Form, and a Retry Option. |