Skip to main content

Table of Contents

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 overview

Encryption

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

  • params Object
    • params.pkpId string The ID of the PKP
    • params.message string The message to encrypt
Returns Promise<string> The ciphertext

Lit.Actions.Decrypt

Decrypt data using AES with a symmetric key

Parameters

  • params Object
    • params.pkpId string The ID of the PKP
    • params.ciphertext string The ciphertext to decrypt
Returns Promise<string> The decrypted plaintext

PKP Keys

Key management functions for PKPs. These functions are used to get keys for PKPs that can be used in javascript functions.

Lit.Actions.getPrivateKey

Get the private key for a PKP wallet

Parameters

Returns Promise<string> The private key secret

Lit.Actions.getLitActionPrivateKey

Get the private key for the currently executing Lit Action Returns Promise<string> The private key secret

Lit.Actions.getLitActionPublicKey

Get the public key for a Lit Action by IPFS ID

Parameters

  • params Object
    • params.ipfsId string The IPFS ID of the Lit Action
Returns Promise<string> The public key

Lit.Actions.getLitActionWalletAddress

Get the wallet address for a Lit Action by IPFS ID

Parameters

  • params Object
    • params.ipfsId string The IPFS ID of the Lit Action
Returns Promise<string> The wallet address

Action Utilities

Helpers available inside actions as Lit.Actions.*.

Lit.Actions.setResponse

Set the response returned to the client

Parameters

  • params Object
    • params.response any 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.

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 mirrors Lit.Actions.

ethers

The ethers.js v5 API exposed to Lit Actions for interacting with EVM chains. Includes wallets, providers, contracts, and cryptographic helpers.