WalletConnect V2 with Lit Protocol
Lit Protocol is a decentralized key management network powered by threshold cryptography. A blockchain-agnostic identity layer, Lit can be used to power encryption, signing, and compute for web applications.
With the sunset of WalletConnect V1, we turned off being able to utilize WalletConnect with Lit's auth modal. We prioritized supporting WalletConnect V2 based on feedback from builders and are happy to announce it is now supported!
How to use WalletConnect with Lit
Get a project id from WalletConnect: https://cloud.walletconnect.com/app
Import the Lit package
We recommend using your own connect modals and leverage Lit’s checkAndSignAuthMessage
import {
checkAndSignAuthMessage
} from '@lit-protocol/auth-browser';
Generate the authSig
with Lit
Pass in your WalletConnect project ID
const newAuthSig = await checkAndSignAuthMessage({
chain: 'mumbai',
walletConnectProjectId: <Your WalletConnect project ID>,
});
Check out a demo
This is an example web app that shows how you can easily obtain an authSig
using the checkAndSignAuthMessage
function.
When the function is called, it prompts a wallet selection pop-up in the user's browser. Once the user's wallet is connected, the user is asked to sign a message, thereby confirming the ownership of their crypto address. The authSig
is then generated, which includes the signature of the user's signed message.
https://github.com/LIT-Protocol/js-sdk/tree/master/apps/demo-lit-connect-modal-next
How to utilize Lit with a wallet modal
The demo is an example of how to use RainbowKit’s modal and signAndSaveAuthSig
.
https://github.com/LIT-Protocol/sdk-examples/tree/main/connect-wallet-authsig
Why do we recommend this method?
App devs can use their own connect modals and leverage signAndSaveAuthSig
(over checkAndSaveAuthSig
) since it's a much better developer experience and user experience.
If you have any questions or comments, feel free to reach out to the team at Discord, Twitter or on GitHub.