Session keys
Explore session keys, how to create them, and how to use them with the Abstract Global Wallet.
Session keys are temporary keys that are approved to execute a pre-defined set of actions on behalf of an Abstract Global Wallet without the need for the owner to sign each transaction.
They unlock seamless user experiences by executing transactions behind the scenes without interrupting the user with popups; powerful for games, mobile apps, and more.
How to use session keys
Create a session key
Create a new session key that defines specific actions allowed to be executed on behalf of the Abstract Global Wallet using createSession.
This session key is an account that is approved to execute the actions defined in the session configuration on behalf of the Abstract Global Wallet.
Store the session key
Store the session key in the location of your choice, such as local storage or a backend database.
Keys are approved to execute the actions defined in the session configuration on behalf of the Abstract Global Wallet until they expire.
Use the session key
Create a SessionClient
instance using either:
- toSessionClient if you have an existing AbstractClient available.
- createSessionClient if you don’t already have an AbstractClient, such as from a backend environment.
Use the client to submit transactions and perform actions (e.g. writeContract) without requiring the user to approve each transaction. Transactions are signed by the session key account and are submitted from
the Abstract Global Wallet.
Optional - Revoke the session key
Session keys naturally expire after the duration specified in the session configuration.
However, if you need to revoke a session key before it expires, you can do so using revokeSessions.
Was this page helpful?