> 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/password-manager/password-entitlements.md).

# Password Manager Entitlements

The **Password Manager SDK** enables you to examine the resources used and their limits for a registered user. Resource limits are described by an **Entitlement**, an object with a name and a limit indicating some maximum usage value. Resource usage is tracked for each Sudo.

{% hint style="info" %}
To allocate entitlements to your users or groups of users, refer to the Entitlements [Administrative API](/guides/entitlements/administrative-api.md).
{% endhint %}

## Entitlement Types

The following table describes the entitlements used to control access to the Password Manager:

| Entitlement                          | Type    | Description                                                                                                            |
| ------------------------------------ | ------- | ---------------------------------------------------------------------------------------------------------------------- |
| `sudoplatform.vault.vaultMaxPerSudo` | Numeric | Maximum number of vaults a Sudo can have at a time. If zero, this user is not entitled to access the Password Manager. |

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

```typescript
/* ... */
export type EntitlementName = 'vaultMaxPerSudo' | ...
```

{% endtab %}

{% tab title="Swift" %}

```swift
public struct Entitlement {
    /* ... */
    public enum Name: String {
        case maxVaultPerSudo
    }
}
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
data class Entitlement(
    // ...
) : Parcelable {
    /** Enum that represents the different types of entitlements available */
    enum class Name {
        MAX_VAULTS_PER_SUDO
    }
}
```

{% endtab %}
{% endtabs %}

## Getting Entitlements

The `getEntitlement` method returns the set of Password Manager Entitlements and their limits granted to the signed in user.

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

```typescript
try {
    const entitlements = await client.getEntitlement()

    entitlements.forEach((ent) =>
        console.log(`This user can have up to ${ent.limit} of ${ent.name}`))
} catch (error) {
    // Handle/notify user of the error.
}
```

{% endtab %}

{% tab title="Swift" %}

```swift
var client: PasswordManagerClient!

client.getEntitlement { (result) in 
    switch result {
    case .success(let entitlements):
        entitlements.forEach {
            print("This user can have up to \($0.limit) of \($0.name)")
        }

    case .failure(let error):
        /* Handle error logic */
        return
    }
}
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
// val client: SudoPasswordManagerClient

launch {
    try {
        val entitlement = withContext(Dispatchers.IO) {
            client.getEntitlement()
        }

        entitlement.forEach {
            println("This user can have up to ${it.limit} of ${it.name}")
        }
    } catch (e: SudoPasswordManagerException) {
        // Handle/notify user of exception
    }
}
```

{% endtab %}
{% endtabs %}

The `getEntitlementState` method returns the usage value of each Password Manager Entitlement for each Sudo.

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

```typescript
try {
    const entitlementStates = await client.getEntitlementState()

    entitlementStates.forEach((ent) =>
        console.log(`Sudo ${ent.sudoId} has consumed ${ent.value}/${ent.limit} of ${ent.name}`))
} catch (error) {
    // Handle/notify user of the error.
}
```

{% endtab %}

{% tab title="Swift" %}

```swift
var client: PasswordManagerClient!

// Entitlement state
client.getEntitlementState { (result) in 
    switch result {
    case .success(let entitlements):
        entitlements.forEach {
            println("Sudo \($0.sudoId) has consumed \($0.value)/\($0.limit) of \($0.name)")
        }

    case .failure(let error):
        /* Handle error logic */
        return
    }
}
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
// val client: SudoPasswordManagerClient

launch {
    try {
        val entitlementState = withContext(Dispatchers.IO) {
            client.getEntitlementState()
        }

        entitlementState.forEach {
            println("Sudo ${it.sudoId} has consumed ${it.value}/${it.limit} of ${it.name}")
        }
    } catch (e: SudoPasswordManagerException) {
        // Handle/notify user of exception
    }
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Read more about the Sudo Platform entitlements system and how to integrate with it in the [Entitlements](/guides/entitlements.md) section of the Sudo Platform documentation.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.sudoplatform.com/guides/password-manager/password-entitlements.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
