iOS

Install the library

To install the library you need cocoapads ad the cocoapads-artifactory plugin. You can install it as *gem in the terminal or download it at https://cocoapods.org

Copy
Copied
sudo gem install cocoapods
sudo gem install cocoapods-art

Ratepay will provide the credentials for the ~/.netrc file containing:

Copy
Copied
machine riskident.jfrog.io
login <USERNAME>
password <PASSWORD>

Please copy it to your home directory and add the RISK IDENT Cocoapod Artifactory repository:

Copy
Copied
cp .netrc ~/
pod repo-art add riskident-ios "https://riskident.jfrog.io/riskident/api/pods/ios-release"
pod repo-art update riskident-ios

Integration

Here we will describe the integration using a new empty project.

Add the ClientSecurityModule to your application

First, create a new Xcode project. In Xcode go to Files » New » Project. For example you can use Single View App.

Second, change to the project directory in your terminal and init a podfile:

Copy
Copied
Pod init

Your project directory should look like this:

Copy
Copied
$ ls –ahl
total 24
drwxr-xr-x  6 user staff 204B Jul 28 13:06 .
drwxr-xr-x  6 user staff 204B Jul 28 13:05 ..
-rw-r--r--@ 1 user staff 6.0K Jul 28 13:06 .DS_Store
drwxr-xr-x  7 user staff 238B Jul 28 13:05 New Application
drwxr-xr-x  5 user staff 170B Jul 28 13:05 New Application.xcodeproj
-rw-r--r--  1 user staff 269B Jul 28 13:06 Podfile

Third, you need to add riskident-ios repository to the beginning of the pod file:

Copy
Copied
plugin 'cocoapods-art', :sources => [
   ‘riskident-ios’
]

Fourth, add the pod ClientSecurityKit in your pods’ definitions in the pod file:

Copy
Copied
target 'New Application' do
  ...
  # Pods for New Application
  pod 'ClientSecurityKit'
  ...
end

Finally, install the ClientSecurityKit pod by running the following command:

Copy
Copied
$ pod install
Analyzing dependencies
Downloading dependencies
Using ClientSecurityKit (1.2.5)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
[!] Automatically assigning platform `ios` with version `11.0` on target `app` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

Collect and send data to Risk Ident

After installing the library, open your app’s .xcworkspace file to launch Xcode:

Copy
Copied
open "New Application.xcworkspace"

First, you need to import ClientSecurityKit

Copy
Copied
import ClientSecurityKit

Then, create a global reference:

Copy
Copied
var module : ClientSecurityModule?

And finally, you have to initialize the ClientSecurityModule inside of the ViewController class:

Copy
Copied
module = ClientSecurityModule(snippetId: String, requestToken: String, location: String? = nil)