Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

# ✨ Feature Request: Add 'ENABLE' Mode Support to Smart Sessions Module #97

Open
2 tasks done
joepegler opened this issue Oct 22, 2024 · 0 comments
Open
2 tasks done
Assignees
Labels
enhancement New feature or request

Comments

@joepegler
Copy link
Collaborator

Feature or Improvement Description

Implement 'ENABLE' mode support in the Smart Sessions Module of the Nexus SDK. This mode allows permissions to be granted off-chain by the user and then activated on-chain by the dapp just before use.

Benefits & Outcomes

  • Enhance flexibility in permission management for smart sessions
  • Reduce on-chain transactions for granting permissions, potentially lowering gas costs
  • Allow dapps to manage permissions more dynamically, activating them only when needed
  • Improve user experience by reducing the number of on-chain transactions users need to approve
  • Provide a more versatile toolkit for developers implementing smart sessions

Implementation Ideas

  1. Extend the SmartSessionMode enum in the Smart Sessions Module:

    enum SmartSessionMode {
      USE,
      ENABLE
    }
  2. Implement off-chain permission granting functionality:

    • Create a method for users to sign off-chain messages granting permissions
    • Store these signed permissions securely (consider local storage or a separate database)
  3. Develop on-chain activation for 'ENABLE' mode:

    • Create a new smart contract function to activate off-chain granted permissions
    • Implement verification of the user's off-chain signature in the smart contract
  4. Update the toSmartSessionsValidator function to support 'ENABLE' mode:

    const sessionsModule = toSmartSessionsValidator({
      account: nexusClient.account,
      signer: eoaAccount,
      mode: SmartSessionMode.ENABLE
    })
  5. Extend the Nexus client with new actions for 'ENABLE' mode:

    const enableSessionNexusClient = nexusClient.extend(
      smartSessionEnableActions(sessionsModule)
    )
  6. Implement new methods for the extended client:

    • grantOffChainPermission: For users to grant permissions off-chain
    • activatePermission: For dapps to activate the off-chain granted permission on-chain
  7. Update existing smart session creation and use flows to accommodate 'ENABLE' mode

  8. Implement proper error handling and edge case management for the new mode

  9. Develop comprehensive unit and integration tests for 'ENABLE' mode functionality

  10. Update documentation to reflect the new 'ENABLE' mode and its usage

References


  • I agree to follow this project's Code of Conduct.

Any References?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct.
@joepegler joepegler added the enhancement New feature or request label Oct 22, 2024
@joepegler joepegler self-assigned this Oct 22, 2024
@livingrockrises livingrockrises self-assigned this Oct 31, 2024
@joepegler joepegler removed their assignment Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants