# Google.Play.Integrity.IntegrityManagerV2

Manages requests for integrity information and dialogs.

## Summary

Replaces the V1 [IntegrityManager](https://developer.android.com/reference/unity/class/Google/Play/Integrity/IntegrityManager#classGoogle_1_1Play_1_1Integrity_1_1IntegrityManager) to provide enhanced error handling and remediation dialog support.

| ### Constructors and Destructors ||
|---|---|
| `https://developer.android.com/reference/unity/class/Google/Play/Integrity/IntegrityManagerV2#classGoogle_1_1Play_1_1Integrity_1_1IntegrityManagerV2_1a6ca53db74e415d056e67116517935195()` ||

| ### Public functions ||
|---|---|
| `https://developer.android.com/reference/unity/class/Google/Play/Integrity/IntegrityManagerV2#classGoogle_1_1Play_1_1Integrity_1_1IntegrityManagerV2_1a255ccbe50c81fcbd260e29d0a143b946(https://developer.android.com/reference/unity/class/Google/Play/Integrity/IntegrityTokenRequest#classGoogle_1_1Play_1_1Integrity_1_1IntegrityTokenRequest integrityTokenRequest)` | `PlayAsyncOperation< https://developer.android.com/reference/unity/class/Google/Play/Integrity/IntegrityTokenResponse#classGoogle_1_1Play_1_1Integrity_1_1IntegrityTokenResponse, https://developer.android.com/reference/unity/class/Google/Play/Integrity/IntegrityServiceError#classGoogle_1_1Play_1_1Integrity_1_1IntegrityServiceError >` Starts a PlayAsyncOperation to generate a token for integrity-related enquiries, and provides the token as its result. |
| `https://developer.android.com/reference/unity/class/Google/Play/Integrity/IntegrityManagerV2#classGoogle_1_1Play_1_1Integrity_1_1IntegrityManagerV2_1a2d0c7029563756b8b49cbb8d553f64c4(https://developer.android.com/reference/unity/class/Google/Play/Integrity/IntegrityDialogRequest#classGoogle_1_1Play_1_1Integrity_1_1IntegrityDialogRequest request)` | `PlayAsyncOperation< https://developer.android.com/reference/unity/namespace/Google/Play/Integrity#namespaceGoogle_1_1Play_1_1Integrity_1a664149de1380fe4ef98779a01ef9e3d2, https://developer.android.com/reference/unity/class/Google/Play/Integrity/IntegrityServiceError#classGoogle_1_1Play_1_1Integrity_1_1IntegrityServiceError >` Displays a dialog to the user. |

## Public functions

### IntegrityManagerV2

```c#
 IntegrityManagerV2()
```

### RequestIntegrityToken

```c#
PlayAsyncOperation< IntegrityTokenResponse, IntegrityServiceError > RequestIntegrityToken(
  IntegrityTokenRequest integrityTokenRequest
)
```
Starts a PlayAsyncOperation to generate a token for integrity-related enquiries, and provides the token as its result.

The JSON payload is signed and encrypted as a nested JSON Web Token (JWT), that is [JWE](https://tools.ietf.org/html/rfc7516) of [JWS](https://tools.ietf.org/html/rfc7515).

JWE uses [A256KW](https://tools.ietf.org/html/rfc7518#section-4.4) as a key wrapping algorithm and [A256GCM](https://tools.ietf.org/html/rfc7518#section-5.3) as a content encryption algorithm. JWS uses [ES256](https://tools.ietf.org/html/rfc7518#section-3.4) as a signing algorithm.

All decryption and verification should be done within a secure server environment. Do not decrypt or verify the received token from within the client app. In particular, never expose any decryption keys to the client app.

See <https://developer.android.com/google/play/integrity/classic#token-format>.

<br />

| Details ||
|---|---|
| **Returns** | A PlayAsyncOperation{IntegrityTokenResponse, IntegrityServiceError} that returns [IntegrityTokenResponse](https://developer.android.com/reference/unity/class/Google/Play/Integrity/IntegrityTokenResponse#classGoogle_1_1Play_1_1Integrity_1_1IntegrityTokenResponse) on successful callback or [IntegrityServiceError](https://developer.android.com/reference/unity/class/Google/Play/Integrity/IntegrityServiceError#classGoogle_1_1Play_1_1Integrity_1_1IntegrityServiceError) on failure callback. |

### ShowDialog

```c#
PlayAsyncOperation< IntegrityDialogResponseCode, IntegrityServiceError > ShowDialog(
  IntegrityDialogRequest request
)
```
Displays a dialog to the user.

This method can only be called once per Integrity API response (Token or Error).

<br />

Details Parameters `request` Contains all the information required to show the dialog. **Returns** A PlayAsyncOperation{TResult,TError} that returns [IntegrityDialogResponseCode](https://developer.android.com/reference/unity/namespace/Google/Play/Integrity#namespaceGoogle_1_1Play_1_1Integrity_1a664149de1380fe4ef98779a01ef9e3d2) on successful callback or [IntegrityServiceError](https://developer.android.com/reference/unity/class/Google/Play/Integrity/IntegrityServiceError#classGoogle_1_1Play_1_1Integrity_1_1IntegrityServiceError) on failure callback.