https://github.com/iproov/ios-api-client
iOS Swift API Client for iProov's REST API v2
https://github.com/iproov/ios-api-client
Last synced: 5 months ago
JSON representation
iOS Swift API Client for iProov's REST API v2
- Host: GitHub
- URL: https://github.com/iproov/ios-api-client
- Owner: iProov
- License: other
- Created: 2019-06-03T11:01:46.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2025-01-08T11:32:42.000Z (over 1 year ago)
- Last Synced: 2025-11-22T12:19:53.367Z (7 months ago)
- Language: Swift
- Homepage:
- Size: 329 KB
- Stars: 1
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# iProov iOS API Client
## Introduction
The iProov iOS API Client is a simple wrapper for the [iProov REST API v2](https://secure.iproov.me/docs.html) written in Swift and using [Alamofire](https://github.com/Alamofire/Alamofire). We also have an Android API client available [here](https://github.com/iProov/android-api-client).
## Important security notice
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](https://github.com/iProov/ios), 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](https://vapor.codes/)-[end](https://perfect.org/) 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).
## Installation
### Swift Package Manager
We recommend the iOS API Client is installed as a Swift Package:
1. Select `File` → `Add Package Dependencies…` in the Xcode menu bar.
2. Search for the iOS API Client package using the following URL:
```
https://github.com/iProov/ios-api-client
```
3. Set the _Dependency Rule_ to be _Up to Next Major Version_.
4. 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.
### Cocoapods
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`.
## Supported functionality
- `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 together `getToken()` for the enrolment token, `enrolPhoto()` to enrol the photo, and then `getToken()` for the verify token, which you can then use to launch the SDK.
## Example
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:
```swift
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: "user@example.com") { 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)
}
}
```
## License
The iProov iOS API Client is licensed under the BSD-3 license.