The iProov iOS API Client is a simple wrapper for the iProov REST API v2 written in Swift and using Alamofire. We also have an Android API client available here.
In production, the iProov REST API should only ever be called directly from your back-end, however this library is designed to help you with debugging/evaluating the iProov iOS SDK, to get up-and-running quickly with a pure on-device demo.
Use of the iOS API Client requires providing it with your API secret. You should never embed your API secret within a production app.
...Although, if by any chance you happen to use Swift on your back-end then you can probably use this code on your server, with just a few modifications (for example, you will need to handle images without UIKit).
We recommend the iOS API Client is installed as a Swift Package:
-
Select
File
→Add Package Dependencies…
in the Xcode menu bar. -
Search for the iOS API Client package using the following URL:
https://github.com/iProov/ios-api-client
-
Set the Dependency Rule to be Up to Next Major Version.
-
Click Add Package to add the iOS API Client dependency to your Xcode project and to your app target, and then click again to confirm.
The iOS API Client can also be installed as a Cocoapods dependency. Simply add the following line to your Podfile:
pod 'iProovAPIClient'
And then run pod install
.
getToken()
- Get an enrol/verify token.enrolPhoto()
- Once you have an enrolment token, you can enrol a photo against it.validate()
- Validates an existing token.enrolPhotoAndGetVerifyToken()
- A helper function which chains togethergetToken()
for the enrolment token,enrolPhoto()
to enrol the photo, and thengetToken()
for the verify token, which you can then use to launch the SDK.
Example of using iProov API Client together with iProov to get a verify token for an existing user and then launch the iProov SDK to perform the verification using Genuine Presence Assurance:
import iProovAPIClient
import iProov
let apiClient = APIClient(baseURL: "https://eu.rp.secure.iproov.me",
apiKey: "{{ Your API key }}",
secret: "{{ Your API secret }}")
apiClient.getToken(assuranceType: .genuinePresence,
type: .verify,
userID: "[email protected]") { result in
switch result {
case let .success(token):
IProov.launch(streamingURL: "https://eu.rp.secure.iproov.me",
token: token) { status in
print(status)
}
case let .failure(error):
print(error)
}
}
The iProov iOS API Client is licensed under the BSD-3 license.