> ## Documentation Index
> Fetch the complete documentation index at: https://turnkey-0e7c1f5b-bc-add-sdk-typedoc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# EncryptPrivateKeyToBundle

# Function: encryptPrivateKeyToBundle()

> **encryptPrivateKeyToBundle**(`params`): `Promise`\<`string`>

Defined in: [turnkey.ts:304](https://github.com/tkhq/sdk/blob/ee72856c3f450731d7501ab05001215768b71500/packages/crypto/src/turnkey.ts#L304)

Encrypts a private key bundle using HPKE and verifies the enclave signature.

## Parameters

### params

`EncryptPrivateKeyToBundleParams`

An object containing the private key, key format, bundle, user, and organization details. Optionally, you can override the default signer key (for testing purposes)

## Returns

`Promise`\<`string`>

* A promise that resolves to a JSON string representing the encrypted bundle.

## Throws

* If enclave signature verification or any other validation fails.
