Skip to content

Creating an ID Matcher proof of concept app

Jonathan Ellis edited this page Aug 5, 2020 · 6 revisions

This quick-start guide will take you through the process of creating your own proof-of-concept demo of ID Matcher on iOS, without the need to write any back-end code.

Overview

A high-level description of the flow we're going to create is as follows:

  1. Launch a document scanner and extract the face image from the document.
  2. Pass the face image to the iProov iOS API Client, which will call the iProov REST API on your behalf to enrol the image, and returns a token.
  3. Launch the iProov iOS SDK with the token, which will match the user against their enrolled photo and verify their genuine presence.
  4. Register for callbacks and result from the SDK so that you can update your UI.

The above flow is shown in the following diagram:

⚠️ SECURITY NOTICE: This guide instructs you to put your iProov API key & secret into your iOS app. This is a major security issue and whilst acceptable for a PoC, you should never embed your API secret into any client software. Make sure you generate a fresh set of credentials before putting your app into production.

Requirements

Before starting out, here's what you'll need:

  • iProov credentials (API key & secret for your service provider). If you don't have these yet, you'll need to sign up on the iProov customer portal.

  • Identify which document scanner you would like to use, and obtain any API key/license from the software vendor as required. iProov works with any document scanner, the important thing is to ensure that your chosen document scanner will allow you to extract the dewarped face image from the scanned document. (If it does not, you will need to run your own face detection and perhaps perspective correction on the document image in order to extract the face, before passing it to iProov.)

Step-by-step guide

  1. Integrate your chosen document scanner into your app, and obtain the face image.

  2. You now need to submit the face image to the iProov REST API. In a production environment, you would do this securely from your back-end as a secure server-to-server call. However for PoC purposes you can simply use our iOS API client as a Swift interface to our API.

    Simply integrate it via Cocoapods (follow the install guide in the repo) and you're ready to enrol the photo and get a token:

    import iProovAPIClient
    
    let faceImage = UIImage() // UIImage obtained from document scanner
    
    // Credentials obtained from portal:
    let apiClient = APIClient(baseURL: "https://eu.rp.secure.iproov.me/api/v2", // Change if needed
                              apiKey: "{API Key}",
                              secret: "{API Secret}")
    
    let userID = UUID().uuidString // You can just randomly generate a user ID for testing purposes
    
    apiClient.enrolPhotoAndGetVerifyToken(userID: userID,
                                          image: faceImage,
                                          source: .opticalID, // The image was obtained from an optical scan
                                          success: { (token) in
                                                // We have got a verify token to pass to the iProov SDK
                                            }, failure: { (error) in
                                                // An error occurred
                                            })         		  
            

    ​The enrolPhotoAndGetToken() call actually makes 3 calls to the REST API to get an enrolment token, uploads the photo against the enrolment token, and then get a verify token against the newly enrolled user. ​

  3. Now you have a token, you're ready to integrate the iProov SDK and launch iProov to match the user against their ID. Follow the README guide here (it's just another Cocoapod install), and you're ready to go. All you need to do is call IProov.launch() with your iProov token:.

    import iProov
    
    IProov.launch(token: token, callback: { (status) in
    	// Update the UI with the progress/result/failure/error (see docs for more info)
    }) 

iProov will then appear, verify the user's identity and genuine presence, and provide callbacks to your app with progress updates and verification result. 🙌

NOTE: In a production app, you would now want to verify the token securely on the back-end rather than result in a client-side success, however for PoC purposes you should be fine to just trust the result on-device.