interface AuthCallbackParams {
    chain: string;
    cosmosWalletType?: CosmosWalletType;
    expiration?: string;
    jsParams?: any;
    litActionCode?: string;
    litActionIpfsId?: string;
    nonce: string;
    resourceAbilityRequests?: LitResourceAbilityRequest[];
    resources?: string[];
    sessionKey?: SessionKeyPair;
    statement?: string;
    switchChain?: boolean;
    uri?: string;
    walletConnectProjectId?: string;
}

Hierarchy (view full)

Properties

chain: string

The chain you want to use. Find the supported list of chains here: https://developer.litprotocol.com/docs/supportedChains

cosmosWalletType?: CosmosWalletType

Cosmos wallet type, to support mutliple popular cosmos wallets Keplr & Cypher -> window.keplr Leap -> window.leap

expiration?: string
jsParams?: any

An 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.

litActionCode?: string

The 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');
litActionIpfsId?: string

You 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;
}
nonce: string

The blockhash that the nodes return during the handshake

resourceAbilityRequests?: LitResourceAbilityRequest[]
resources?: string[]

Optional and only used with EVM chains. A list of resources to be passed to Sign In with Ethereum. These resources will be part of the Sign in with Ethereum signed message presented to the user.

sessionKey?: SessionKeyPair

The serialized session key pair to sign. If not provided, a session key pair will be fetched from localStorge or generated.

statement?: string

The statement that describes what the user is signing. If the auth callback is for signing a SIWE message, you MUST add this statement to the end of the SIWE statement.

switchChain?: boolean

Optional and only used with EVM chains right now. Set to true by default. Whether or not to ask Metamask or the user's wallet to switch chains before signing. This may be desired if you're going to have the user send a txn on that chain. On the other hand, if all you care about is the user's wallet signature, then you probably don't want to make them switch chains for no reason. Pass false here to disable this chain switching behavior.

uri?: string
walletConnectProjectId?: string

Optional project ID for WalletConnect V2. Only required if one is using checkAndSignAuthMessage and wants to display WalletConnect as an option.