Add Dynamic Permissions
This PR adds new RPC methods used to support dynamic permissions.
Fixes: https://github.com/MetaMask/snaps/issues/1821
Dynamic Permissions feature is specified in SIP-14.
Related metamask-extension PR: https://github.com/MetaMask/metamask-extension/pull/22878
Summary of changes in this PR
RPC Methods
Three new RPC methods are added to enable Dynamic Permissions feature functionality:
-
snap_requestPermissions -
snap_getPermissions -
snap_revokePermissions
All RPC methods added are following naming convention proposed in SIP-14.
Manifest
dynamicPermissions field is added to the manifest.
New structure DynamicPermissionsStruct is added to the manifest validation process and refined to follow the validation requirements proposed in the SIP-14.
Snap Controller
- Snap controller logic for allowlist requirements is updated to handle dynamic permissions in the same way as the initial permissions are handled.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 96.73%. Comparing base (
a0bdc87) to head (26562b8). Report is 2 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #2088 +/- ##
==========================================
+ Coverage 96.60% 96.73% +0.12%
==========================================
Files 337 340 +3
Lines 7610 7693 +83
Branches 1180 1198 +18
==========================================
+ Hits 7352 7442 +90
+ Misses 258 251 -7
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
No dependency changes detected. Learn more about Socket for GitHub ↗︎
👍 No dependency changes detected in pull request