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 requiring 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 session keys work
Applications can prompt users to approve the creation of a session key for their Abstract Global Wallet. This session key specifies:
- A scoped set of actions that the session key is approved to execute.
- A specific EOA account, the signer, that is permitted to execute the scoped actions.
If the user approves the session key creation, the signer account can submit any of the actions within the defined scope without requiring user confirmation; until the session key expires or is revoked.
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 or useCreateSession.
This session key configuration defines a signer account that is approved to execute the actions defined in the session on behalf of the Abstract Global Wallet.
Session keys must be whitelisted on the session key policy registry to be used on Abstract mainnet following a security review.
Store the session key
Store the session key securely using the guidelines outlined in Going to Production. The session config is required for the session key to be used to execute actions on behalf of the Abstract Global Wallet.
The signer account(s) defined in the session configuration objects are sensitive values that must be stored securely.
Use the recommendations for session key signer accounts outlined in Going to Production to ensure the signer account(s) are stored securely.
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?