Delegated Account implementation
Brewit uses a flexible session key implementation (Smart Sessions) to allow users to create delegated account.Select a policy and conditions
Select a policy and conditions to allow or disallow access to your account based on the type of permission you want to grant. Currently we support 2 types of policies:
- Full Access - Allow access to specific tokens to perform unlimited swap or spend operations. Brewit uses Sudo Policy for this.
- Limited Access - Allow access to specific tokens to perform limited spend operations. Brewit uses ERC20SpendingLimitPolicy for this.
Create a subaccount session
A session is needed to validate the transactions from the subaccount for these policies to work. We allow session validation using several session validators.
- Ownable Session Validator - This validator is used to validate the embedded wallet session of social/ email login auth providers.
- WebAuthn Passkey validator - This is slightly modified version of the original WebAuthn passkey validator to support the ISessionValidator.
Enable the smart session module
Once the session validator is set, we can create a subaccount session by enabling the smart session module on the smart account and adding the session details to enable the session.
Track/ Edit/ Remove the subaccount
We track the session details in the subaccount by querying the particular policy. We also allow the user to edit or remove the subaccount by calling the appropriate functions on the smart session module.