Prove® Platform iOS SDK
Learn how to integrate the client-side iOS SDK into your native new application.
Installation
Prove provides the iOS SDK in Swift. It is a lightweight XCFramework with a download size of 2.5 MB and an install size of 1.5 MB for the minimum required components. It only relies on iOS native APIs. Prove’s iOS SDK minimally supports the previous three major versions. Prove has seen successful transactions with iOS v11.
Prove manages a repository with the libraries to enable integration.
Execute the following to remotely import CocoaPod from the Prove pod repository:
Send the Type of Flow: Mobile
Unlike the Web SDK, when using the iOS SDK, use the mobile flow. Pass mobile to the Start() function on the server. In a mobile flow, Mobile Auth executes first and if that fails, it will perform one-time password (OTP) validation on the mobile phone.
In the mobile flow, once either Mobile Auth or the OTP validation is complete, the AuthFinishStep function executes.
Mobile Auth
In order for Mobile Auth to succeed, the user needs to disable the VPN and Private Relay on iOS.
Authenticate()
The SDK requires an authToken
as a parameter for the Authenticate() function. This token returns from the Start() call of the server SDK. The token is session specific so it is only used for a single flow. It also expires after 15 minutes.
Retrieve authToken
To start the flow, you’ll need to send a request to your backend server with the phone number, flow type, and an optional challenge of either the date of birth (YYYY-MM-DD
) or social security number (last four digits).
Setup Authenticator
Once you have the authToken
, build the authenticator for the mobile flow.
Cellular data connection is sometimes unavailable during testing. The Builder class offers a method, which permits simulated successful session results while connected to Wi-Fi network only (without a cellular data connection available). This feature is particularly useful for testing on the Emulator. This is available in Sandbox only. This allows Mobile Auth℠ to simulate successfully.
Performing the Authentication
The ProveAuth object is thread-safe and used as a singleton. Most Prove Auth methods are blocking and therefore cannot execute in the main application thread. The application manages threads, such as with an executor service providing at least two threads, because the SDK may handle multiple simultaneous blocking requests.
Validate the Mobile Phone
In the AuthFinishStep, you’ll specify a function to call once the possession checks are complete on the mobile phone. In the code below, you’ll notice an endpoint called /verify
. This is an endpoint on your backend server that calls the Validate()
function to validate the phone number. If it was successful, the server calls the Challenge()
function and then returns the results that will include user information. See below for a few example fields that return and then pre-fill on a form for the user to verify.
OTP Configuration
There are two functions to implement for the OTP handling - a start and a finish step.
In order to set the OTP handlers, implement OtpStartStep and OtpFinishStep interfaces. The Swift snippet has an example.
Retry functionality is unavailable in OTP.
OtpStartStep
example:
OtpFinishStep
example:
Verify the User Information
Once the user has made any edits to their pre-fill information, submit that information to the backend server so the Complete()
call can then verify the user information.