Session Keys - [early access feature]
Sessions can be used to send transactions from a dApp on behalf of a user without requiring their confirmation with a wallet.
The user is guaranteed that the dApp can only execute transactions that comply with the policies of the session up until the session expires. Let's go through the steps on how you could enable sessions in your dApps with Argent:
1. Installation
2. Create an offchain session as a dapp
To do this, you first need to have a deployed account. This account will authorise the session and interact with the contracts of your dapp. You can get that by using an injected instance of a wallet:
3. Come up with the list of permissions/approved methods for your sessions
Next up, you’ll need to communicate a list of whitelisted methods with argent. The method property needs to be with the following format: method: 0x.. instead of the selector. You also need to generate the session keypair you want to grant these rights to.
4. Sign the session with the account you created
Using established sessions
Once you sign the session with the account you created, users can now use it to do transactions without having to approve again:
Having done these, congratulations! you just enabled sessions in your dApp!
It's worth noting that session keys are at the time of writing, just supported on Argent Web Wallet as an early access feature, thus if you need to use them in your dApp, do reach out to us at dapps@argent.xyz.
Last updated