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

BREAKING: Add JSON-RPC handler permission #905

Merged
merged 9 commits into from Nov 24, 2022
Merged

Conversation

Mrtenz
Copy link
Member

@Mrtenz Mrtenz commented Nov 3, 2022

This adds a new permission endowment:rpc, which Snaps need in order to use the onRpcRequest handler. It takes an object in order to specify if the Snap can receive JSON-RPC requests from other Snaps, Dapps, or both.

{
  initialPermissions: {
    'endowment:rpc': {
      snaps: true,
      dapps: false, // Default value
    }
  }
}

Closes #855.

@Mrtenz
Copy link
Member Author

Mrtenz commented Nov 11, 2022

Pending a release of @metamask/controllers.

@codecov-commenter
Copy link

codecov-commenter commented Nov 23, 2022

Codecov Report

Merging #905 (3d069ae) into main (421c727) will increase coverage by 0.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #905      +/-   ##
==========================================
+ Coverage   92.98%   93.02%   +0.03%     
==========================================
  Files          96       96              
  Lines        9642     9690      +48     
  Branches      905      909       +4     
==========================================
+ Hits         8966     9014      +48     
  Misses        676      676              
Impacted Files Coverage Δ
packages/snaps-utils/src/caveats.ts 100.00% <100.00%> (ø)
packages/snaps-utils/src/json-rpc.ts 100.00% <100.00%> (ø)
packages/snaps-utils/src/manifest/validation.ts 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@Mrtenz Mrtenz marked this pull request as ready for review November 23, 2022 16:33
@Mrtenz Mrtenz requested a review from a team as a code owner November 23, 2022 16:33
@Mrtenz Mrtenz changed the title Add JSON-RPC handler permission BREAKING: Add JSON-RPC handler permission Nov 24, 2022
@Mrtenz Mrtenz merged commit 4095eb8 into main Nov 24, 2022
@Mrtenz Mrtenz deleted the mrtenz/rpc-permission branch November 24, 2022 09:35
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 this pull request may close these issues.

Add permission for Snaps in order to receive JSON-RPC requests
3 participants