Table of Contents
- Welcome
- Encryption
- Encrypt
- Decrypt
- PKP Keys
- getPrivateKey
- getLitActionPrivateKey
- getLitActionPublicKey
- getLitActionWalletAddress
- Action Utilities
- setResponse
- Debugging
- showImportDetails
- Runtime Globals
- LitActions
- ethers
Welcome
Welcome to the Lit Actions SDK Docs. These functions can be used inside a Lit Action. You should prefix each function with “Lit.Actions.” so to call “encrypt()” you should do “Lit.Actions.encrypt()” To understand how these functions fit together, please view the Quick Start guide and Lit Actions overviewEncryption
Encryption and decryption functions. These functions are used to encrypt and decrypt data. The data is encrypted & decrypted using a symmetric key derived from the secret key of the PKP.Lit.Actions.Encrypt
Parameters
Returns Promise<string> The ciphertextLit.Actions.Decrypt
Decrypt data using AES with a symmetric keyParameters
-
paramsObject
PKP Keys
Key management functions for PKPs and for action identity keys.getPrivateKey returns a PKP’s key and is checked against group membership. The three getLitAction* functions deal with the key every action derives from its own CID; see Two kinds of keys. All key-returning calls share one limit of ten per execution (Limits).
Lit.Actions.getPrivateKey
Get the private key for a PKP walletParameters
Returns Promise<string> The private key secretLit.Actions.getLitActionPrivateKey
Get the private key for the currently executing Lit Action. The key is a secp256k1 scalar deterministically derived by the TEE’s KMS from this action’s IPFS CID, so it is stable across executions and nodes, and changes if any byte of the action source changes. No PKP or group permission is required: every action can read its own key. Returned as 0x-prefixed hex; strip the prefix before feeding it to non-ethers libraries. See Action-Identity Signing and Derived Actions. Returns Promise<string> The private key secret, 0x-prefixed hexLit.Actions.getLitActionPublicKey
Get the public key for a Lit Action by IPFS ID. Works for any CID, including actions that are not in any of your groups and have never been executed: the key is public information. Use it to verify signatures or receipts produced by another action, for example an issuer action whose CID is stamped into this one. See Signed Data in Untrusted Storage. Returned as 0x-prefixed SEC1 hex. Counts toward the per-execution key-operation limit.Parameters
Returns Promise<string> The public keyLit.Actions.getLitActionWalletAddress
Get the EVM wallet address for a Lit Action by IPFS ID. Works for any CID with no permission required. Convenient for comparing againstethers.utils.verifyMessage output when verifying another action’s signature. Counts toward the per-execution key-operation limit.
Parameters
Returns Promise<string> The wallet addressAction Utilities
Helpers available inside actions asLit.Actions.*.
Lit.Actions.setResponse
Set the response returned to the clientParameters
-
paramsObjectparams.responseany The response to send to the client. If this is not a string, it will be JSON-encoded before being sent. A value of undefined is encoded as null.
Debugging
Diagnostic functions for inspecting the runtime state of a Lit Action.Lit.Actions.showImportDetails
Log and return details of all modules imported by this Lit Action. Returns an array of objects with the resolved CDN URL and SHA-384 integrity hash for each imported module. The details are also written to the action’s console log via the print opCode. Returns Array of objects, one per imported module, each with aurl string (the resolved CDN URL) and a hash string (the SHA-384 integrity hash)
Runtime Globals
Globals automatically available inside the Lit Action runtime.LitActions
Global reference to the Lit Actions namespace for convenience. This alias is injected in the Lit Action execution environment and mirrorsLit.Actions.