Skip to main content

Function

importPrivateKey(params)
Encrypts an existing private key with Lit and stores it as wrapped key metadata.

Parameters

params.pkpSessionSigs
SessionSigsMap
required
Session signatures tying the wrapped key to the PKP.
params.litClient
LitClient
required
Lit client instance for executing the Lit Action and accessing storage services.
params.privateKey
string
required
Hex-encoded private key to wrap (a 0x prefixed string for EVM keys).
params.publicKey
string
required
Public key corresponding to the private key being wrapped.
params.keyType
'K256' | 'ed25519'
required
Identifies the algorithm so the service can store the key correctly.
params.memo
string
required
Description stored with the wrapped key.
params.userMaxPrice
bigint
Optional executeJs price cap.

Returns

result
ImportPrivateKeyResult

Example

const { id } = await wrappedKeysApi.importPrivateKey({
  pkpSessionSigs,
  litClient,
  privateKey: wallet.privateKey,
  publicKey: wallet.publicKey,
  keyType: 'K256',
  memo: 'imported relayer key',
});