Optional
capabilityNot limited to capacityDelegationAuthSig, we want to be able to pass in any other authSigs for other purposes.
Optional
capacityOptional
chainOptional
expirationOptional
jsAn object that contains params to expose to the Lit Action. These will be injected to the JS runtime before your code runs, so you can use any of these as normal variables in your Lit Action.
Optional
litThe litActionCode is the JavaScript code that will run on the nodes. You will need to convert the string content to base64.
Buffer.from(litActionCodeString).toString('base64');
Optional
litYou can obtain the Lit Action IPFS CID by converting your JavaScript code using this tool: https://explorer.litprotocol.com/create-action
Note: You do not need to pin your code to IPFS necessarily. You can convert a code string to an IPFS hash using the "ipfs-hash-only" or 'ipfs-unixfs-importer' library.
async function stringToIpfsHash(input: string): Promise<string> {
// Convert the input string to a Buffer
const content = Buffer.from(input);
// Import the content to create an IPFS file
const files = importer([{ content }], {} as any, { onlyHash: true });
// Get the first (and only) file result
const result = (await files.next()).value;
const ipfsHash = (result as any).cid.toString();
if (!ipfsHash.startsWith('Qm')) {
throw new Error('Generated hash does not start with Qm');
}
return ipfsHash;
}
Optional
pkpAn array of resource abilities that you want to request for this session. These will be signed with the session key.
If you want to request the ability to decrypt an access control condition, then you would pass
[{ resource: new LitAccessControlConditionResource('someResource), ability: LitAbility.AccessControlConditionDecryption }]
Optional
sessionThe session capability object that you want to request for this session. If you pass nothing, then this will default to a wildcard for each type of resource you're accessing.
If you passed nothing, and you're requesting to perform a decryption operation for an access
control condition, then the session capability object will be a wildcard for the access control condition,
which grants this session signature the ability to decrypt this access control condition.
Optional
sessionThe serialized session key pair to sign. If not provided, a session key pair will be fetched from localStorge or generated.
Optional
switchIf you want to ask Metamask to try and switch the user's chain, you may pass true here. This will only work if the user is using Metamask. If the user is not using Metamask, then this will be ignored.
Generated using TypeDoc
This is a callback that will be called if the user needs to authenticate using a PKP. For example, if the user has no wallet, but owns a Lit PKP though something like Google Oauth, then you can use this callback to prompt the user to authenticate with their PKP. This callback should use the LitNodeClient.signSessionKey function to get a session signature for the user from their PKP. If you don't pass this callback, then the user will be prompted to authenticate with their wallet, like metamask.