Skip to main content

Function

updateEncryptedKey(params)
Re-encrypts an existing wrapped key and appends the previous state to the versions array.

Parameters

params.pkpSessionSigs
SessionSigsMap
required
Session signatures identifying the PKP that owns the wrapped key.
params.litClient
LitClient
required
Lit client instance used to talk to the wrapped-keys service.
params.id
string
required
Identifier of the wrapped key to update.
params.ciphertext
string
required
New base64-encrypted ciphertext to store.
params.memo
string
Optional updated memo for the wrapped key.
params.evmContractConditions
string
Optional updated ACCs for EVM contract conditions.
params.userMaxPrice
bigint
Optional price ceiling for the Lit Action.

Returns

result
UpdateEncryptedKeyResult
Returns id, pkpAddress, and updatedAt of the updated wrapped key.

Example

const res = await wrappedKeysApi.updateEncryptedKey({
  pkpSessionSigs,
  litClient,
  id,
  ciphertext: 'base64-new',
  memo: 'rotated memo',
});

const withHistory = await wrappedKeysApi.getEncryptedKey({
  pkpSessionSigs,
  litClient,
  id,
  includeVersions: true,
});
console.log(withHistory.versions); // [{ ciphertext: 'old', ... }]