Optional
authThe auth sig of the user. Returned via the checkAndSignAuthMessage function
Optional
chainOptional
domaindomain param is required, when calling from environment that doesn't have the 'location' object. i.e. NodeJs server.
Optional
expirationWhen this session signature will expire. The user will have to reauthenticate after this time using whatever auth method you set up. This means you will have to call this signSessionKey function again to get a new session signature. This is a RFC3339 timestamp. The default is 24 hours from now.
Optional
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
pkpThe public key of the PKP
Optional
resourceA LIT resource ability is a combination of a LIT resource and a LIT ability.
Optional
sessionThe serialized session key pair to sign. If not provided, a session key pair will be fetched from localStorge or generated.
Optional
statementThe statement text to place at the end of the SIWE statement field.
Generated using TypeDoc
The auth methods to use to sign the session key