Function: decryptExportBundle()

decryptExportBundle(params): Promise<string>

Defined in: turnkey.ts:103

Decrypt an encrypted export bundle (such as a private key or wallet account bundle).

This function verifies the enclave signature to ensure the authenticity of the encrypted data. It uses HPKE (Hybrid Public Key Encryption) to decrypt the contents of the bundle and returns either the decrypted mnemonic or the decrypted data in hexadecimal format, based on the returnMnemonic flag.

Parameters

params

DecryptExportBundleParams

An object containing the following properties:

  • exportBundle : The encrypted export bundle in JSON format.
  • organizationId : The expected organization ID to verify against the signed data.
  • embeddedKey : The private key used for decrypting the data.
  • dangerouslyOverrideSignerPublicKey [Optional]: Optionally override the default signer public key used for verifying the signature. This should only be done for testing
  • returnMnemonic : If true, returns the decrypted data as a mnemonic string; otherwise, returns it in hexadecimal format.

Returns

Promise<string>

  • A promise that resolves to the decrypted mnemonic or decrypted hexadecimal data.

Throws

  • If decryption or signature verification fails, throws an error with details.

Function: decryptExportBundle()

decryptExportBundle(params): Promise<string>

Defined in: turnkey.ts:103

Decrypt an encrypted export bundle (such as a private key or wallet account bundle).

This function verifies the enclave signature to ensure the authenticity of the encrypted data. It uses HPKE (Hybrid Public Key Encryption) to decrypt the contents of the bundle and returns either the decrypted mnemonic or the decrypted data in hexadecimal format, based on the returnMnemonic flag.

Parameters

params

DecryptExportBundleParams

An object containing the following properties:

  • exportBundle : The encrypted export bundle in JSON format.
  • organizationId : The expected organization ID to verify against the signed data.
  • embeddedKey : The private key used for decrypting the data.
  • dangerouslyOverrideSignerPublicKey [Optional]: Optionally override the default signer public key used for verifying the signature. This should only be done for testing
  • returnMnemonic : If true, returns the decrypted data as a mnemonic string; otherwise, returns it in hexadecimal format.

Returns

Promise<string>

  • A promise that resolves to the decrypted mnemonic or decrypted hexadecimal data.

Throws

  • If decryption or signature verification fails, throws an error with details.