iOS API

The mobile application must interact with the Sehaci iOS SDK and Apple Wallet (PassKit Framework) in the correct order to retrieve encrypted mobile driver's license (mDL).

Interaction sequence for the mobile app, Sehaci SDK and PassKit Framework

Initalization

To start user document request, a nonce value has to be requested from the SDK. This nonce, with appropriate entropy, serves as a salting value for secure document encryption.

let identityRequest = await SehaciSDK.prepare()

The return type is PKIdentityRequest , which can be directly used in the next step for the request to Apple Wallet.

Since the initalization method uses async-await , you can use guard statement to improve error handling.

guard let identityRequest = await SehaciSDK.prepare() else {
    responseString = "Failed to get Nonce"
    delegate?.updateState(.remoteResponded)
    return responseString
}

Request to Apple Wallet

  1. Create a controller responsible for interaction with the Apple Wallet

let controller = PKIdentityAuthorizationController()
  1. Check if the user has an mDL stored in Wallet

controller.checkCanRequestDocument(descriptor) { canRequest in
    // Show or hide the identity button.
}
  1. The request on the PKIdentityAuthorizationController must include identityRequest object returned in the Initalizaton step.

do {
    let encryptedDocument = try await controller.requestDocument(identityRequest)
} catch {
    // Handle PKIdentityError
}

Verify Document

After receiving the encrypted mDL from Apple Wallet, it must be decrypted, and the document data elements must be verified and validated:

let verifyResult = await SehaciSDK.verify(encryptedDocument) 

A successful response from the verify() method means the data has been successfully delivered to the Sehaci Verify Platform. It does NOT mean that document is successfully verified and validated!

The document's verification status can be checked using Verify API, via Webhooks, or manually in the Sehaci Portal.

Last updated