Session Keys
Session keys within Particle’s AA Modular Stack.
Implementing Session Keys
Session keys are a powerful sub-technology of account abstraction allowing users to delegate signing permission under specific conditions to an external keypair, thus allowing applications to be used without requiring a signature popup or compromising security. In addition to this, session keys can be used for advanced use cases such as transaction automation (due to authentication delegation).
Particle Network has natively implemented session keys through both the Account Abstraction RPC and the AA SDKs (Introduction to Smart Wallet-as-a-Service), allowing developers to begin using session keys directly within the Particle Network tech stack.
Creating a session key
Creating a session key within Particle Network’s Account Abstraction RPC or AA SDK requires the usage of createSessions
and validateSession
(through the RPC endpoint you can access these through createSessions and validateSession). This functionality is only currently compatible with BICONOMY
version
2.0.0, other smart account implementations won’t work and will throw an error.
The underlying flow for implementing and leveraging a session key can be best described through these key steps:
- The session is authorized.
- The session is created containing:
sessionKeyData
, the metadata for the validation contract, including a temporary public address (representing the key), the associated user address, and other parameters (see this repository for an example).sessionValidationModule
, a custom validation contract to determine the validity of a UserOperation, replacing the standardvalidateUserOp
call make within typical operations.
- The session is registered on the blockchain.
- The session is created containing:
- UserOperations can now be signed on behalf of the user with the session key.
Example of a custom validation contract
A custom validation contract, or the sessionValidationModule
, should look similar to the example provided below, implementing the validateSessionUserOp
method:
Watch the full walkthrough tutorial for leveraging session keys with Particle's AA SDK.
Was this page helpful?