Version: 4.4.0

Resources

Getting Started

To integrate the PingOne Fraud for iOS SDK on your client:

  1. Add the SDK to your app using CocoaPods. If you’re new to CocoaPods, see the official documentation at https://guides.cocoapods.org/using/using-cocoapods for information about creating and using Podfiles.

  2. Open your project’s Podfile and add the following to your app’s target:

    STVersion = 'VERSION_NUMBER' 
    

    pod ‘PingOneFraudSDK’, :podspec => “https://assets.pingone.com/p1f/ios-sdk/#{STVersion}/p1f-sdk.podspec”

  3. Set the SDK version number. From the command line, install the PingOne Fraud pod library in your project:

    pod install
  4. Register PingOne Fraud.

    a. Import the PingOne Fraud module:

    import SecuredTouch
  5. If you look in your AppDelegate.swift file you’ll see that @UIApplicationMain appears directly before class AppDelegate. This is a special attribute that tells the Swift compiler to generate code to launch your application using default settings. You need to delete @UIApplicationMain from that file, and instead create a new Swift file called main.swift in your project, adding the following in this file:

    import Foundation
     import UIKit
     import SecuredTouch
     
     UIApplicationMain(
         CommandLine.argc,
         CommandLine.unsafeArgv,
         NSStringFromClass(STApplication.self),
         NSStringFromClass(AppDelegate.self)
     )
  6. Initialize the SDK. You’ll typically do this in your app’s application:didFinishLaunchingWithOptions: method. For example:

    let initParams = STInitParams(applicationId: "<appId>", andAppSecret: "<appSecret>", andServerHost: "<serverHost>")
    

    initParams.userId = "<currentUserId>" initParams.sessionId = "<sessionId>" initParams.debugMode = false

    let securedTouch = SecuredTouch.initSDK(initParams)

    securedTouch?.onSecuredTouchInitialized { (uuid) in print(“SecuredTouch Initialized (uuid!)”) }

    securedTouch?.onSecuredTouchError { (uuid, message, code) in print(“SecuredTouch onError - uuid: (uuid!), message: (message ?? “”), code: (code)”) }

    Parameter Description
    appId The PingOne application ID. See the PingOne Fraud admin documentation for instructions on getting the PingOne Fraud SDK access credentials.
    appSecret The PingOne application secret. See the PingOne Fraud admin documentation for instructions on getting the PingOne Fraud SDK access credentials.
    serverHost The Fraud service host. See the PingOne Fraud admin documentation for instructions on getting this information.
    userId If the user is already identified (signed on) when initializing the Fraud SDK, their user ID should be set here. If the user ID originates from PingOne, use the user ID for the PingOne environment. For all other cases, use a non-personal user identifier.
    sessionId The user’s session ID. To query the Fraud service for the trust scores through the backend system, the Fraud service and the backend system must have a shared identifier for each session. The session ID usually serves as this shared identifier.
    consoleLogEnabled (Optional) Set this to true to enable console logging by the SDK. Defaults to false.
    externalLogsEnabled (Optional) Set this to false to prevent the SDK from sending error logs to an external logging service. Defaults to true.
  7. Set an event listener to get calls on successful SDK initialization, or for when something goes wrong in the SDK.

    Parameter Description
    uuid Unique identifier for the entire lifetime of the SDK. This value stays the same as long as the app’s process is alive. Also available through securedTouch?.getInstanceUUID().
    message The nature of the failure.
    code Internal error code.
  8. Fetch a Fraud token. The SDK generates a token that’s used for Fraud BOT detection capabilities. You’ll need to share the token with your application backend so a call with the fetched token can be sent from this backend to the Fraud Evaluation API to retrieve the risk assessment for a session.

    To get the token from the Fraud SDK, add a call to:

    securedTouch?.getToken()

    An event is fired every time the token changes. For example:

    securedTouch?.onTokenReady {
       print("SecuredTouch Token is ready, \(securedTouch!.getToken()!)")
     }

    Don’t use your application to store the token, and instead share the token stored by the SDK.

  1. User log in and log out. You can do this differently, depending on the following:

  2. Add meaningful IDs to input fields and buttons. Meaningful IDs are required to ensure proper identification of the UI element for detection purposes. Here’s an example for a meaningful ID that can be added to a Login button:

    iOS Accessibility

  1. Set the session ID. To query the Fraud service for the trust scores through the backend system, the Fraud service and the backend system must have a shared identifier for each session. The session ID usually serves as this shared identifier. To set the session ID after the application has it, call:

    securedTouch?.setSessionId(<session-id>)
  2. Add tags. You can tag specific points in time during a session that will be saved by the Fraud service.

    Option Command
    Add a single tag securedTouch?.addTag(<tag-name>)
    Add a tag with additional information securedTouch?.addTag(<tag-name>, withValue: <tag-value>)
    Add multiple tags securedTouch?.addTag(<tag-name>, withValue: <tag-value>).addTag(<tag-name>)
  3. Flush the buffer. Flushing the buffer forces the SDK to send buffered data to directly to the PingOne Fraud backend platform. Usually the built-in automatic flush should be sufficient, so this function should not be used unless instructed to do so by Ping Identity Professional Services.

    securedTouch?.flush()

Useful operations

Context APIs

PingOne Fraud does not collect email addresses or phone numbers, but their anonymized features instead (such as, email domain, length, phone number, and country code).

Login page

Registration page

Account page

Checkout page

Product page

Catalog page

Challenge page

Cart page

Orders page

Chat page

Feed page

Feedback page