Skip to main content

Function

exportPrivateKey(params)
Decrypts a previously stored wrapped key in a Lit Action and returns the plaintext private key together with metadata.

Parameters

params.pkpSessionSigs
SessionSigsMap
required
Session signatures proving the PKP owns the wrapped key.
params.litClient
LitClient
required
Lit client connected to the network that holds the encrypted key.
params.network
'evm' | 'solana'
required
Selects the Lit Action that knows how to handle the key type.
params.id
string
required
Identifier returned from generatePrivateKey, importPrivateKey, or storeEncryptedKey.
params.userMaxPrice
bigint
Optional spending cap passed to the underlying executeJs call.

Returns

result
ExportPrivateKeyResult

Example

const { decryptedPrivateKey } = await wrappedKeysApi.exportPrivateKey({
  pkpSessionSigs,
  litClient,
  network: 'evm',
  id,
});