Quick Start
Quick start guide for the DocIDV iOS SDK.
Starting the SDK
Here is an example of how to launch the SDK from your host app:
func startDocIDV() {
IDnowDocIDV.shared.start(
token: "YOUR_TOKEN",
fromViewController: self,
listener: { [weak self] (result: IDnowDocIDV.IdentResult.type, statusCode: IDnowDocIDV.IdentResult.statusCode, message: String) in
// Handle the result here
})
}
This code calls the main start method to launch the DocIDV library. It takes several parameters:
| Parameter | Type | Description |
|---|---|---|
| token | String | The identification token provided for the session. |
| isRoutedSession | Bool | Boolean which can be set by customers to allow resuming an ident that was started from another side. |
| preferredLanguage | String | The preferred language code for the SDK, e.g., "fr". Defaults to English ("en") if not specified. |
| bindingKey | String | Used for device binding use cases. It helps establish a correlation between a user's verified identity and their mobile device. This is particularly useful for device authentication and re-authentication scenarios. The bindingKey for a completed identification can be fetched via an API endpoint and compared with the one used during SDK initialization. |
| fromViewController | UIViewController | The view controller that will present the SDK. It is also used to determine the appearance mode (light/dark) from your app. |
| listener | IDnowDocIDVResultListener | A callback used to receive the result of the identification session, providing a result type and a status code. |
Handling the Result
Ensure the SDK is started with the listener callback to handle the session's outcome:
switch result {
case .ERROR:
print("Session finished with error. Status code: \(statusCode), Message: \(message)")
case .CANCELLED:
print("Session cancelled by user. Status code: \(statusCode), Message: \(message)")
case .FINISHED:
print("Session finished successfully.")
default:
break
}
Handling errors
When the result is .ERROR, the statusCode will indicate the specific issue. Here is the enum describing each case:
public enum statusCode: Int {
case E10 = 10 // Default Error
case E100 = 100 // Token format incorrect
case E101 = 101 // Token not found (404 on get-info call)
case E102 = 102 // Token expired or already used (410 on get-info call)
case E103 = 103 // Identification already completed (412 on start call)
case E110 = 110 // Failed to parse ident-info response
case E111 = 111 // Server error on ident-info call
// ... and so on for the other error codes
case E170 = 170 // Backend forced websocket closure (e.g., timeout)
case E171 = 171 // Backend sent PROCESS_FAILED command
case EUnreachable = 1000 // Network unreachable
}
Handling Specific Errors
- For
E102(Token expired), it is recommended to request a new identification token and restart the process. - For
E103(Already completed), it is recommended to inform the user that they have already submitted all required information and should wait for the final result. - For
E170(Timeout), it is recommended to notify the user that the session timed out or was started on a different device and ask them to try again. - For all other error codes, it is recommended to show a generic error message and ask the user to try restarting the process.