Title
Create new category
Edit page index title
Edit category
Edit link
iOS Trust SDK Native Interface
Using the iOS Trust SDK
This section is written for developers who want to use the Trust SDK to add local (on-device) authentication and identity verification capabilities to an iOS application.
The sample application for the Trust SDK is recommended as a starting point for learning how to integrate the SDK with your own code.
The developer needs a thorough knowledge of the Swift and/or Objective-C programming language on the iOS platform. It is also recommended that the developer has some understanding of TrustX technology.
The minimum supported iOS version is 14.3.
Add the Trust SDK to your Project
Copy the following xcframework files to your project folder and reference it in project general settings, frameworks and libraries
DaonTrustSDK.xcframeworkDaonNFCSDK.xcframeworkImport the Library
import DaonTrustSDKInitializing the Trust SDK
- The SDK provides simple and straightforward initialization mechanism:
let sdk = TrustSDK(withViewController: self, delegate: self)- Daon Trust SDK offers setting a DaonOptions object for customization purposes. You can set your own initialization timeout as well as the URL of the environment that you want to use:
let options = DaonOptions()options.serverUrl = "https://www.example.com"options.initializationTimeout = 15If you do not set the DaonOptions object, default values will be used. Initialization timeout default value is 10. By not setting the custom environment URL, you are requesting of the Daon Trust SDK to launch a QR code scanning feature which expects the QR code that carries the URL of your environment as a value.
- Finally, you can start the Onboarding process by calling 'start()' function of the TrustSDK:
sdk.start(withDaonOptions: options)Obtaining and Parsing Events from the Trust SDK
In utilizing DaonEventDelegate, three delegate methods need
to be called. Events that are returned are represented through the
DaonEvent object instances that are carrying feedback information about
the Onboarding process status and errors. The event delegate methods
required are listed below.
func didReceive(successResponse daonEvent: DaonEvent) {...}func didReceive(failedResponse daonEvent: DaonEvent) {...}func didReceive(infoResponse daonEvent: DaonEvent) {...}DaonEvent fields:
DaonEvent fields are derived from an event code and description:
- DaonEventCode - A field that contains event code
- String description - A field that contains a description of the event
A list of events, their codes and descriptions that are supported and provided by the Daon Trust SDK can be found below:
| Event Name | Code | Description |
|---|---|---|
webSessionCompleted | 100403 | Web session for onboarding process completed successfully. |
qrScanInvalidQRCode | 200103 | Scanned QR code is not valid. |
qrScanInterrupted | 200104 | QR code scanning interrupted. Please try again. |
webAppTerminated | 200402 | Web application process terminated. This can occur when the end-user presses the back button to navigate to a previous screen when they are on the first web screen of the Process Instance. |
webAppTimeout | 200403 | Web application process has timed out. |
cameraPermissionDenied | 200501 | Camera permission denied. |
noInternetConnection | 200502 | Internet connection not available. |
notSupportediOS | 200503 | Returned when current iOS version not supported. |
versionNotCompatible | 200505 | Returned when DaonTrust SDK client version not compatible with server version. |
urlNotWhitelisted | 200508 | Provided URL is not whitelisted. |
webLoadingTimeout | 200509 | Web page failed to load in given time frame. |
- DaonEventCode structure breakdown:
- The first pair of digits represents event status. Event status can be: Success (10), Fail (20), Info (30).
- The second pair of digits represents section of the event. Event sections can be: QR (01), MRZ (02), NFC (03), Web (04), Other (05).
- The third pair of digits represents ordinal code number for that section.
Native Interface
This section describes all classes that represent the public API interface between mobile developer integrators and the Daon Trust SDK.
TrustSDK
Represents the main entry point to the Daon Trust SDK.
| Method Name | Description |
|---|---|
| TrustSDK(withViewController: self, delegate: self) | Default constructor that requires host view controller and DaonEventDelegate as a Trust SDK event delegate. |
| start(withDaonOptions: options) | Starts the onboarding flow with SDK options object. |
| stop() | This method terminates the current SDK flow, dismisses any active view controller, and notifies the delegate with a failure event (sdkProgrammaticallyStopped). |
| addDocumentProcessor(processor: DaonDocumentProcessorModule) | Add a document processing module to the TrustSDK. This is typically used for MRZ reading and NFC scanning. |
DaonOptions
| Field Name | Description |
|---|---|
| String serverUrl | Server URL that will be used to initialize the Trust SDK. |
| TimeInterval initializationTimeout | The allotted wait time for the Trust SDK to initialize. Default value is 10 seconds (10000L). |
| String qrInstructionLabel | Description label in QR scan screen. If not set, the label will not be shown. |
| String spinnerLabel | Description label under spinner while loading scanned QR. If not set, the label will not be shown. |
| Bool isWebLoadedEnabled | Web loaded is a safety feature of the Trust SDK. onboarding web app that indicates when a valid web page has loaded. By default, this feature is set to true. This feature should be disabled only for development/debug purpose. |
| Bool isWhitelistingEnabled | Whitelisting is a safety feature of the Trust SDK that indicates if the web page is whitelisted. By default, this feature is set to true. This feature should be disabled only for development/debug purpose. |
| Bool isAnalyticsEnabled | The default value is TRUE. Optional parameter that indicates whether event logging is enabled or not. |
| Bool isWebToolbarEnabled | Enable this feature for back/ forward web actions in the navigation bar. This should be enabled only for development/ debugging purposes or if the web app requires web navigation. Defaults to FALSE. |
DaonEventDelegate
| Method Name | Description |
|---|---|
| didReceive(successResponse daonEvent: DaonEvent) | Event that will happened when user finishes the flow. |
| didReceive(failedResponse daonEvent: DaonEvent) | Termination event - This will be triggered if a critical event occurs and the user is unable continue the flow. Additional data will be provided through the event object. |
| didReceive(infoResponse daonEvent: DaonEvent) | Runtime event that will inform integrator on current SDK progress. Additional data will be provided though event object. |
DaonEvent
| Field Name | Description |
|---|---|
| DaonEventCode code | Field that contains event code. |
| description | Field that contains description/reason of the event. |
Builder
The Builder class allows users to construct an instance of DocumentProcessor with specific settings
| Method Name | Description |
|---|---|
| setLicense(license: String) | Used to set the license string that is mandatory in order for Trust SDK OCR and NFC features to work. |
| setErrorDialogMessage(message: String) | If a custom or default error message is desired, it can be set using this method. Otherwise, if left unset, the SDK will return an error message obtained from the error.localizedDescription property. |
| build() | Builds the final DocumentProcessor instance which you can use to scan your document. |