How to Verify the SDK Integration in Your App

Intro

The SDK comes with an integration verification tool - "Doctor App". This is a tool that helps verify the SDK integration in your project by simulating a typical user flow in the application. When the "Doctor App" is enabled, a pop-up will appear as part of the app flow and guide the developer to simulate a user flow in order to gather the required information for testing the integration.

Android

The "Doctor App" includes assets that are used for the UI. Those assets are required only for the "Doctor App" usage and are not needed in your app production build. To minimize the SDK footprint, those assets are loaded dynamically at runtime.
If you run the "Doctor App," those assets will be loaded automatically (internet connection is required).

iOS

The "Doctor App" includes assets that are used for the UI. Those assets are required only for the "Doctor App" usage and are not needed in your app production build. To minimize the SDK footprint, those assets are loaded dynamically at runtime. If you run the "Doctor App" on a real device with iOS 14 or above, those assets will be loaded automatically (internet connection is required). However, if you run the "Doctor App" on a simulator or on a real device with iOS 13 or less, you will need to add the HUMAN.bundle file to your project. It is important to remember to remove it from your project before you build and deploy your app to production.

You can get the HUMAN.bundle by running the following command in the Terminal (please refer to the relevant SDK version):

curl -LO https://jfrog.humansecurity.com/artifactory/files/doctor-app-assets/ios/2.1/HUMAN.bundle.zip

How to add the HUMAN.bundle file to your project

  1. Download the HUMAN.bundle.zip file from the link above.
  2. Unzip it and drag the HUMAN.bundle file to your project (make sure to link it to the relevant targets).

The Doctor App's Flow

  1. Start the SDK with the "Doctor App" enabled. You can enable it by setting the HSDoctorAppPolicy/enabled to be true when initiating the SDK.

    • Android:
      Kotlin:

      import android.app.Application
      import com.humansecurity.mobile_sdk.HumanSecurity
      import com.humansecurity.mobile_sdk.main.HSPolicy
      
      class MainApplication: Application() {
      
          override fun onCreate() {
              super.onCreate()
              startHumanSDK()
          }
      
          private fun startHumanSDK() {
              try {
                  val policy = HSPolicy()
                  policy.doctorAppPolicy.enabled = true
      
                  HumanSecurity.start(this, "<APP_ID>", policy)
              }
              catch (exception: Exception) {
                  println("Exception: ${exception.message}")
              }
          }
      }
      

      Java:

      import android.app.Application;
      import android.util.Log;
      import com.humansecurity.mobile_sdk.HumanSecurity;
      import com.humansecurity.mobile_sdk.main.HSPolicy;
      
      public class MainApplication extends Application {
      
          @Override
          public void onCreate() {
              super.onCreate();
              startHumanSDK();
          }
      
          void startHumanSDK() {
              try {
                  HSPolicy policy = new HSPolicy();
                  policy.getDoctorAppPolicy().setEnabled(true);
      
                  HumanSecurity.INSTANCE.start(this, "<APP_ID>", policy);
              }
              catch (Exception exception) {
                  Log.e("MainApplication","Exception: " + exception.getMessage());
              }
          }
      }
      
    • iOS:
      Swift:

      import HUMAN
      
      class AppDelegate: UIResponder, UIApplicationDelegate {
      
          func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
              startHumanSDK()
              return true
          }
      
          func startHumanSDK() {
              do {
                  let policy = HSPolicy()
                  policy.doctorAppPolicy.enabled = true
      
                  try HumanSecurity.start(appId: "<APP_ID>", policy: policy)
              }
              catch {
                  print("Error: \(error)")
              }
          }
      }
      

      Objective-C:

      @import HUMAN;
      
      @implementation AppDelegate
      
      - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
          [self startHumanSDK];
          return YES;
      }
      
      - (void)startHumanSDK() {
          HSPolicy *policy = [[HSPolicy alloc] init];
          policy.doctorAppPolicy.enabled = YES;
      
          NSError *error = nil;
          [HumanSecurity startWithAppId:@"<APP_ID>" policy:policy error:&error];
          if (error != nil) {
              NSLog(@"Error: %@", error);
          }
      }
      
  2. Run your app. You should see the "Doctor App" UI displayed.

  3. Welcome Screen - Select whether to start a new test or load the summary of a previous test, if one exists.

    Welcome Screen

  4. Product Selection Screen - Select which product to test:

    1. Bot Defender
    2. Account Defender

    Product Selection Screen

  5. Instruction Screen - Review detailed instructions on how to start a new test, what is expected, and steps to resolve issues.

    Instruction Screen

  6. Test Selection Screen - Choose between:

    1. Native app framework - to test native URL requests.
    2. Web view framework - to test web view URL requests.

    Test Selection Screen

  7. Run the Test - Use your app according to the instructions.

  8. Summary Screen - Review the test results. Explore detailed insights for each test and get troubleshooting tips for failed tests.

    Summary Screen

  9. Export the test result to a JSON string from the summary screen. Share it with the support team if needed.

  10. When you exit the "Doctor App," your app is also terminated.

Note: Retrying blocked requests after the challenge is solved will not work while running the "Doctor App." In this case, your request handler will receive a "challenge was solved" error.

Don't forget to set HSDoctorAppPolicy/enabled to false when you finish validating the SDK integration.