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

1

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.

It is highly recommended to create a new session signer key for each user.

Using the same signer key for multiple sessions compromises security isolation - if the key is exposed, all associated sessions become vulnerable rather than containing the risk to a single session.

2

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.

It is recommended to encrypt the signer keys before storing them.

3

Use the session key

Create a SessionClient instance using either:

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.

4

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.