> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crossmint.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CrossmintDecrypt

Class for decrypting verifiable credentials that have been encrypted with the `VerifiableCredentialEncryptionType.CROSSMINT_RECOVERABLE` encryption type.

This class uses a provided signature callback to authenticate the user and decrypt the credential.
To use the Crossmint decrypt endpoint, an API key with the `credentials.decrypt` scope must be provided.

## Constructors

### new CrossmintDecrypt()

> **new CrossmintDecrypt**(`userAddress`, `signCallback`, `authService`): [`CrossmintDecrypt`](./CrossmintDecrypt)

#### Parameters

| Parameter      | Type                                            |
| -------------- | ----------------------------------------------- |
| `userAddress`  | `string`                                        |
| `signCallback` | (`wallet`, `challenge`) => `Promise`\<`string`> |
| `authService`  | [`WalletAuthService`](./WalletAuthService)      |

#### Returns

[`CrossmintDecrypt`](./CrossmintDecrypt)

#### Defined in

[decryption/wallet.ts:25](https://github.com/Crossmint/crossmint-sdk/blob/main/packages/client/verifiable-credentials/src/decryption/wallet.ts#L25)

## Properties

| Property       | Type                                                                | Description                                                          | Defined in                                                                                                                                          |
| -------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `signCallback` | (`wallet`: `string`, `challenge`: `string`) => `Promise`\<`string`> | A callback function that signs the challenge with the user's wallet. | [decryption/wallet.ts:24](https://github.com/Crossmint/crossmint-sdk/blob/main/packages/client/verifiable-credentials/src/decryption/wallet.ts#L24) |
| `userAddress`  | `string`                                                            | -                                                                    | [decryption/wallet.ts:16](https://github.com/Crossmint/crossmint-sdk/blob/main/packages/client/verifiable-credentials/src/decryption/wallet.ts#L16) |

## Methods

### decrypt()

> **decrypt**(`credential`): `Promise`\<[`VerifiableCredential`](../interfaces/VerifiableCredential)>

Decrypts an encrypted verifiable credential.

This method validates the decrypted data to ensure it is a valid verifiable credential.

#### Parameters

| Parameter    | Type                                                                           | Description                                     |
| ------------ | ------------------------------------------------------------------------------ | ----------------------------------------------- |
| `credential` | [`EncryptedVerifiableCredential`](../interfaces/EncryptedVerifiableCredential) | The encrypted verifiable credential to decrypt. |

#### Returns

`Promise`\<[`VerifiableCredential`](../interfaces/VerifiableCredential)>

A promise that resolves to a `VerifiableCredential`.

#### Throws

Will throw an error if the decrypted data is not a valid verifiable credential.

#### Defined in

[decryption/wallet.ts:52](https://github.com/Crossmint/crossmint-sdk/blob/main/packages/client/verifiable-credentials/src/decryption/wallet.ts#L52)
