Skip to navigation

Changes from v3

Learn about major changes in the SDK's API from v3 to v4.

This guide is relevant for the current Mobile SDK. While we highly recommend using the latest version, if you are using a legacy integration, refer to the iOS or Android documentation.

SDK name change

  • The SDK name has been changed from PerimeterX to HUMAN.

    • Android: import com.humansecurity.mobile_sdk.HumanSecurity
    • iOS: import HUMAN
  • Repository Update for Android: Update your build.gradle file to use the new SDK repository location:

    https://jfrog.humansecurity.com/artifactory/human-android-sdk/
  • Class Renaming: The main class has been renamed from PerimeterX to HumanSecurity. All SDK classes now have the HS prefix instead of PX.

  • Function Relocation: Some functions previously in PerimeterX have been moved to HSBotDefender and HSAccountDefender classes based on their context.

  • Delegate Renaming: PerimeterXDelegate has been renamed to HSBotDefenderDelegate.

  • Error Handling: Error query functions have been consolidated into the HSBotDefender/errorType(error:) function.

  • Removal of HSTimeoutInterceptor (Android):

    • The HSTimeoutInterceptor class has been removed.
    • You can now set different timeouts directly in the OkHttp client configuration.

Policy object changes

  • The policy object has been restructured from a single-level object to nested objects for different policy types:
    • HSAutomaticInterceptorPolicy: Configurations for “Automatic Interceptor”
    • HSHybridAppPolicy: Configurations for “Hybrid App”
    • HSDetectionPolicy: Configurations related to the SDK’s detection mechanisms
    • HSDoctorAppPolicy: Configurations for the “Doctor App”

Bot Defender

  • The HSBotDefender/headersForURLRequest(forAppId:) function previously returned nil or null if called before HumanSecurity/start(appId:policy:). It has now been updated to always return a value (never empty). However, it must be called after HumanSecurity/start(appId:policy:).

Hybrid App

  • To enable “Hybrid App,” call the HSHybridAppPolicy/set(webRootDomains:forAppId:) function. Set webRootDomains to the bare registrable root (example.com). A leading dot is accepted and equivalent. Do not list a subdomain. See Hybrid App integration for more information.

New in iOS

  • The HumanSecurity/setupWebView(webView:navigationDelegate:) function allows for manual “Hybrid App” integration, unlike the automatic method available in previous versions.
  • The HSHybridAppPolicy/automaticSetup option enables the same automatic “Hybrid App” integration that was available in previous versions.

Environment

Android

  • SDK Build Specifications:

    • The SDK is now built for API 35 and Kotlin 2.1.0.
  • New Dependencies:

    • The SDK has a new list of dependencies (see below). When fetching the SDK from our Artifactory, these dependencies are automatically included.

If you need to change the version of some dependencies, you may integrate the SDK manually and select the exact versions that work for your app.

implementation 'androidx.core:core-ktx:1.15.0' // any version (select 1.10.1 if your app has 'targetSdkVersion 33')
implementation 'androidx.lifecycle:lifecycle-process:2.8.7' // min v2.6.0 (select 2.6.2 if your app has 'targetSdkVersion 33')
implementation 'androidx.datastore:datastore-preferences:1.1.1' // any version (select 1.0.0 if your app targets API 33)
implementation 'com.google.android.material:material:1.12.0' // min v1.6.0 (select 1.9.0 if your app has 'targetSdkVersion 33')
implementation 'com.fasterxml.uuid:java-uuid-generator:4.3.0' // min v3.0.0
implementation 'io.ktor:ktor-client-okhttp:3.0.3' // min v3.0.0