> For the complete documentation index, see [llms.txt](https://docs.sudoplatform.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sudoplatform.com/guides/digital-account-protection/integrate-the-privacy-interaction-sdk.md).

# Integrate the Privacy Interaction SDK

Integrate the Privacy Interaction SDK into your application.

### Prerequisites <a href="#prerequisites" id="prerequisites"></a>

1. [Complete the Getting Started Guide](https://docs.sudoplatform.com/~/revisions/U8P5YQbTWlABRqHUlUfP/guides/getting-started)
2. [Integrate the User SDK](https://docs.sudoplatform.com/~/revisions/U8P5YQbTWlABRqHUlUfP/guides/users/integrate-the-user-sdk)

### Getting Started

* [Integrate the JS SDK](#integrate-the-js-sdk)
* [Integrate the iOS SDK](/guides/digital-account-protection/integrate-the-privacy-interaction-sdk.md#integrate-the-ios-sdk)
* [Integrate the Android SDK](#sdk-architecture)

### Integrate the JS SDK <a href="#integrate-the-js-sdk" id="integrate-the-js-sdk"></a>

To use the **Privacy Interaction SDK** in a Web or Node.js project, you must add `@sudoplatform/sudo-privacy-interaction` as a dependency to your project.

{% tabs %}
{% tab title="Typescript" %}

```bash
yarn add '@sudoplatform/sudo-privacy-interaction'
# or
npm install --save '@sudoplatform/sudo-privacy-interaction'
```

{% endtab %}
{% endtabs %}

In order to instantiate a Privacy Interaction client, make sure you have followed the instructions for [Getting Started](https://docs.sudoplatform.com/~/revisions/U8P5YQbTWlABRqHUlUfP/guides/getting-started) and [User SDK](https://docs.sudoplatform.com/~/revisions/U8P5YQbTWlABRqHUlUfP/guides/users/integrate-the-user-sdk) (see [Prerequisites](https://app.gitbook.com/o/-M39U3D2HOiBk9X4Eceg/s/-M2oeXSYkTAXJocuferm/~/edit/~/changes/616/guides/privacy-interaction/integrate-the-privacy-interaction-sdk#prerequisites) above).

To instantiate a client in your application, add the following:

{% tabs %}
{% tab title="Typescript" %}

```typescript
import { DefaultSudoPrivacyInteractionClient } from '@sudoplatform/sudo-privacy-interaction'
import { DefaultSudoUserClient } from '@sudoplatform/sudo-user'

const userClient = new DefaultSudoUserClient(/* refer to Users documentation */)

const privacyInteractionClient = new DefaultSudoPrivacyInteractionClient({
  sudoUserClient: userClient,
})
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
You only need one client instance for a given user per device. Instantiating multiple clients with the same configuration and using them at the same time may cause unexpected runtime errors to occur.
{% endhint %}

## Integrate the iOS SDK <a href="#integrate-the-ios-sdk" id="integrate-the-ios-sdk"></a>

To use the **Privacy Interaction SDK** in an iOS app, you need to install the SudoPrivacyInteraction package via Swift Package Manager

Open your project settings in XCode, and go to the `Package Dependencies` tab. Click on the `+` sign to add a dependency.&#x20;

Enter the repository URL [`https://github.com/sudoplatform/sudo-privacy-interaction-ios`](https://github.com/sudoplatform/sudo-email-ios) in the top right search box and select the `sudo-privacy-interaction-ios` repository.&#x20;

Select the required version and `Add Package`.&#x20;

Sudo Platform SDKs conform to semantic versioning so in most cases you will leave the Dependency Rule as `Up to Next Major Version` to receive regular updates without introducing any breaking changes.

This will resolve the local package dependency and install the latest version of the Privacy Interaction SDK.

{% hint style="info" %}
In order to instantiate a Privacy Interaction client, make sure you have followed instructions for [Getting Started](/guides/getting-started.md) and [User SDK](/guides/users/integrate-the-user-sdk.md)  (see [Prerequisites](#prerequisites) above)
{% endhint %}

To instantiate a client in your application, add the following:

{% tabs %}
{% tab title="Swift" %}

```swift
import SudoPrivacyInteraction
import SudoUser

let userClient = // ... see "Users" docs

let privacyInteractionClient = try DefaultSudoPrivacyInteractionClient(
    sudoUserClient: userClient
)
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
You only need one client instance for a given user per device. Instantiating multiple clients with the same configuration and using them at the same time may cause unexpected runtime errors to occur.
{% endhint %}

### Integrate the Android SDK <a href="#sdk-architecture" id="sdk-architecture"></a>

The Android SDK is open source and compatible with Android 7 (API level 24) and above.

{% tabs %}
{% tab title="Gradle" %}
Add this line to the dependencies section of the app module `build.gradle` and synchronize your project with Android Studio.

```kotlin
dependencies {
    implementation 'com.sudoplatform:sudoprivacyinteraction:$latest_version'
}
```

{% hint style="info" %}
The latest version of the SDK can be found at [SDK releases](/guides/digital-account-protection/sdk-releases.md).
{% endhint %}

{% hint style="info" %}
In order to instantiate a Privacy Interaction client, make sure you have followed instructions for [Getting Started](https://docs.sudoplatform.com/guides/getting-started) and [User SDK](https://docs.sudoplatform.com/guides/users/integrate-the-user-sdk) (see Prerequisities above)
{% endhint %}
{% endtab %}
{% endtabs %}

To instantiate a client in your application, add the following:

{% tabs %}
{% tab title="Kotlin" %}

```kotlin
val userClient = // ... see "Users" docs

val privacyInteractionClient = SudoPrivacyInteractionClient.builder()
    .setContext(appContext) 
    .setSudoUserClient(userClient)
    .build()
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
You only need one client instance for a given user per device. Instantiating multiple clients with the same configuration and using them at the same time may cause unexpected runtime errors to occur.
{% endhint %}

### SDK Architecture <a href="#sdk-architecture" id="sdk-architecture"></a>

The Privacy Interaction SDK is organized around three core resource types:

| Resource         | Description                                                            |
| ---------------- | ---------------------------------------------------------------------- |
| Virtual Presence | A connected user identity (e.g., email account) that the SDK monitors. |
| Data Holder      | An organization discovered to hold data for a virtual presence.        |
| Analysis Result  | A structured privacy analysis produced for each data holder.           |

The typical workflow is:

1. **Connect** a virtual presence (e.g., via OAuth authorization code or refresh token).
2. **Scan** — the platform automatically scans the connected account and discovers data holders.
3. **Analyze** — for each data holder, the platform performs a privacy analysis.
4. **Subscribe** — receive real-time updates as scanning and analysis progress.
