> This page is for Applications Protection.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.humansecurity.com/llms.txt.

# How to upgrade from v3

# Major Changes in the SDK's API

This article covers the major changes in the SDK's API.

## Bye Bye PerimeterX... Hello HumanSecurity

* **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.

## The Policy

* **Policy Object Structure:**
  * **Before:** The policy object was a single-level object that included all SDK configurations.
  * **Now:** The policy object includes the following nested objects:
    * `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".

* **Server Domain Configuration:**
  * **Before:** You had to set your server(s) domain(s) for both "Automatic Interceptor" and "Hybrid App" within the same function.
  * **Now:** There are separate functions for setting domains for each policy.

## Bot Defender

* **`headersForURLRequest` Function:**
  * **Before:** The `HSBotDefender/headersForURLRequest(forAppId:)` function returned `nil` or `null` if called before `HumanSecurity/start(appId:policy:)`.
  * **Now:** This function will always return a value (never empty). However, it **must** be called **after** `HumanSecurity/start(appId:policy:)`.

## Hybrid App

* **Enabling Hybrid App:**
  * To enable "Hybrid App," call the `HSHybridAppPolicy/set(webRootDomains:forAppId:)` function.
  * **Note:** Set `webRootDomains` to the bare registrable root (`example.com`). A leading dot is accepted and equivalent. Do not list a sub-domain. See [Hybrid App integration](/applications/hybrid-app-integration) for more information.

### New in iOS

* **Manual Integration:**
  * The `HumanSecurity/setupWebView(webView:navigationDelegate:)` function allows for manual "Hybrid App" integration, unlike the automatic method available in previous versions.

* **Automatic Setup Option:**
  * 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.
  * **Note:** 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.

    ```groovy
    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
    ```