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

Add permission for Snaps in order to receive JSON-RPC requests #855

Closed
Mrtenz opened this issue Oct 24, 2022 · 0 comments · Fixed by #905
Closed

Add permission for Snaps in order to receive JSON-RPC requests #855

Mrtenz opened this issue Oct 24, 2022 · 0 comments · Fixed by #905
Assignees

Comments

@Mrtenz
Copy link
Member

Mrtenz commented Oct 24, 2022

Initially, Snaps only had an RPC handler in order to provide any functionality. Since then, we've added other possibilities for Snaps to work, like transaction insights through the onTransaction entry point, and keyrings through the keyring entry point. Both of these entry points require a permission to work. We should do the same thing for the onRpcRequest entry point, requiring a permission in order for a Snap to be able to receive requests.

This also makes it possible for a Snap to specify whether it should be able to receive requests from just dapps, just other Snaps, or both. For example:

{
  "initialPermissions": {
    "endowment:rpc": {
      "dapps": true,
      "snaps": true
    }
  }
}

Both values can default to false. At least one must be true for a valid permission. For example:

  • dapps: true, snaps: true - Requests from both other Snaps and dapps.
  • dapps: true, snaps: false OR dapps: true - Only requests from dapps.
  • dapps: false, snaps: true OR snaps: true - Only requests from other Snaps.
  • dapps: false, snaps: false - Invalid. At least one of them must be true.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants