-
-
Notifications
You must be signed in to change notification settings - Fork 1
Persisting Granted Permissions with MM Profile Sync #84
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
Persisting Granted Permissions with MM Profile Sync #84
Conversation
|
Caution Review the following alerts detected in dependencies. According to your organization's Security Policy, you must resolve all "Block" alerts before proceeding. It is recommended to resolve "Warn" alerts too. Learn more about Socket for GitHub.
|
## **Description** This is a version bump for the preinstalled @metamask/message-signing-snap to v1.1.2 This latest version updates the `message signing snap` `endowment:rpc` to allow requests from a Snap and adds [npm:@metamask/gator-permissions-snap](https://www.npmjs.com/package/@metamask/gator-permissions-snap/v/0.2.1) to `initialConnections`. [](https://codespaces.new/MetaMask/metamask-extension/pull/32521?quickstart=1) ## **Related issues** relates to: MetaMask/message-signing-snap#128 required by: MetaMask/snap-7715-permissions#84 relates to: MetaMask/metamask-mobile#15141 ## **Manual testing steps** No user-facing changes ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
jeffsmale90
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good - I sure hope that we can improve the developer experience around the message signing snap though!
Maybe only configuring the message signing snap in local if an environment var STORE_DELEGATIONS is set or something so that we only need to set it up if we are testing something related to storage would be a worthwhile change in the short term.
packages/permissions-provider-snap/docs/usingMessageSigningSnap.md
Outdated
Show resolved
Hide resolved
packages/permissions-provider-snap/src/profileSync/profileSync.ts
Outdated
Show resolved
Hide resolved
packages/permissions-provider-snap/src/profileSync/profileSync.ts
Outdated
Show resolved
Hide resolved
|
The default ports in |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
packages/permissions-provider-snap/src/profileSync/profileSync.ts
Outdated
Show resolved
Hide resolved
packages/permissions-provider-snap/src/profileSync/profileSync.ts
Outdated
Show resolved
Hide resolved
packages/permissions-provider-snap/src/profileSync/profileSync.ts
Outdated
Show resolved
Hide resolved
packages/permissions-provider-snap/src/profileSync/profileSync.ts
Outdated
Show resolved
Hide resolved
…ature name, do not call getUserProfile
packages/permissions-provider-snap/src/profileSync/profileSync.ts
Outdated
Show resolved
Hide resolved
## **Description** This is a version bump for the preinstalled @metamask/message-signing-snap to v1.1.2 This latest version updates the `message signing snap` `endowment:rpc` to allow requests from a Snap and adds [npm:@metamask/gator-permissions-snap](https://www.npmjs.com/package/@metamask/gator-permissions-snap/v/0.2.1) to `initialConnections`. ## **Related issues** relates to: MetaMask/message-signing-snap#128 required by: MetaMask/snap-7715-permissions#84 relates to: MetaMask/metamask-extension#32521 ## **Manual testing steps** There are no user-facing changes to test ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> [](https://codespaces.new/MetaMask/metamask-extension/pull/34373?quickstart=1) Submit transactions to revoke gator permissions. Support single and batch revokes. ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: Adds a button for the user to revoke a gator permission. ## **Related issues** requires: #33996 requires: MetaMask/core#6033 requires: MetaMask/snap-7715-permissions#108 relates to: MetaMask/snap-7715-permissions#84 ## **Manual testing steps** 1. Generate a MM Flask build - `yarn dist --build-type flask --apply-lavamoat false` 2. Install the latest development version of `@metamask/permissions-kernel-snap` and `@metamask/gator-permissions-snap`. 3. Make a permission 7715 request to store a permission in profile sync. 4. Go to the "All Permissions page". 5. Click revoke to trigger a transaction to revoke a permission. 6. Sign the transaction. - Evidence of revoke permission transaction on testnet: https://sepolia.etherscan.io/tx/0x157ae09d68e0b922876f131648657fd780194625ff2d3825021a8293f6f16dd5 ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [x] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [x] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
## Explanation <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> ### @metamask/gator-permissions-controller #### Current State and Why Change is Needed MetaMask clients currently lack a dedicated system for managing gator permissions that are stored to profile sync via the `@metamask/gator-permissions-snap`. #### Solution and How It Works This change introduces a new `@metamask/gator-permissions-controller` package that provides a comprehensive solution for managing gator permissions in MetaMask clients with gator-snap integration. #### Changes That Might Not Be Obvious - Serialization Strategy: The controller `state` uses JSON serialization for storing permission data fetched from `@metamask/gator-permissions-snap`, which allows for efficient storage and retrieval while maintaining data integrity. The deserialize permission data is represented as a list of gator permissions filtered by permission type and chainId. - Default Permission Structure: The controller initializes with an empty structure for all three permission types, ensuring consistent state even when no permissions are configured #### Package Dependencies and Integration The new package depends on `@metamask/snaps-controllers` as a peer dependency, ensuring it can leverage sending RPC requests to an installed Metamask Snap. This integration allows the `GatorPermissionsController` to forward requests to `@metamask/gator-permissions-snap` to fetch users' Gator permissions that have been stored in the MetaMask Profile Sync service. The `@metamask/gator-permissions-snap` will take on the responsibility of authenticating with MetaMask Profile Sync service using an`SRP` identifier via integration with `@metamask/message-signing-snap`. #### No Dependency Upgrades Required This is a new package that introduces new functionality without requiring changes to existing dependencies. The package uses the current stable versions of `@metamask/base-controller`, `@metamask/utils `,`@metamask/snaps-sdk`, and `@metamask/snaps-utils` following the established patterns in the MetaMask codebase. ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> Related to(MM snap-7715-permissions): [Persisting Granted Permissions with MM Profile Sync](MetaMask/snap-7715-permissions#84) Requires(MM snap-7715-permissions):[Add new permissionsProvider_getGrantedPermissions RPC](MetaMask/snap-7715-permissions#108) Required by(MM Extension): MetaMask/metamask-extension#33996 ### Gator Permissions Data Flow ```mermaid graph TD %% dApp flow for storing permissions A[dApp<br/>client side RPC] -->|RPC| GPS[gator-permissions-snap] C -->|WRITE| D[(permissions stored<br/>across all sites)] %% User flow for reading permissions E[user<br/>permissions page] -->|UI| F[MM client] F -->|submitRequestToBackground| G[GatorPermissionsController] G --> MSYS[messagingSystem] MSYS -->|handleRequest| SC[SnapController] SC -->|RPC| GPS C -->|READ| D %% SRP Auth GPS -->|OAuth 2.0 Auth| MS[message-signing-snap] MS -->|SRP identifier & signature| C[profile sync service] %% Styling classDef dappStyle fill:#e1f5fe,stroke:#01579b,stroke-width:2px classDef userStyle fill:#f3e5f5,stroke:#4a148c,stroke-width:2px classDef serviceStyle fill:#e8f5e8,stroke:#1b5e20,stroke-width:2px classDef dataStyle fill:#fff3e0,stroke:#e65100,stroke-width:2px classDef authStyle fill:#ffebee,stroke:#c62828,stroke-width:2px classDef systemStyle fill:#fce4ec,stroke:#ad1457,stroke-width:2px class A dappStyle class E,F userStyle class GPS,C serviceStyle class D dataStyle class MS authStyle class G,MSYS,SC systemStyle ``` ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes
## **Description** Add a new build feature flag `GATOR_PERMISSIONS_ENABLED` that defaults to false. It is intended to serve as a feature flag for the development of the gator-permission page. - When `GATOR_PERMISSIONS_ENABLED=true`, the `/permissions` path will route to the `GatorPermissionsPage` component. - When `GATOR_PERMISSIONS_ENABLED=false` or empty, the `/permissions` path will continue to route to the `PermissionsPage` component. ## **Changelog** CHANGELOG entry: This PR is not End-User-Facing, and it is intended to serve as a feature flag for the development of the gator-permission page. ## **Related issues** relates to: MetaMask/core#6033 required by: #35219 relates to: MetaMask/snap-7715-permissions#84 ## **Manual testing steps** 1. Set `GATOR_PERMISSIONS_ENABLED=true` in `.metamaskrc` 2. Build Flask: `yarn dist --build-type flask --apply-lavamoat false ` 3. Navigate to the `All Permissions page` 4. A Blank page will show as a placeholder to the Gator permission management UI(ie, permission revocation flow). ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [x] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [x] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
## **Description**
This PR lays the foundation for the gator permissions revocation
feature. Introduces the following:
- The usage of the `GatorPemissionsController` to fetch gator
permissions that have been granted to sites.
- A dedicated selector that filters `GatorPemissionsController` state to
provide necessary data allowing components to render gator permissions
revocation features.
- Introduces the `GATOR_PERMISSIONS_REVOCATION_ENABLED` feature flag
that is set to `false`. This flag is used to continue building the gator
permissions view without impacting end-users.
- All UI changes are behind the `GATOR_PERMISSIONS_REVOCATION_ENABLED`
feature flag.
- Dynamic routing based on `GATOR_PERMISSIONS_REVOCATION_ENABLED`
feature flag.
- 'All permissions' click on the global menu.
- 'Back button' click on the site connection page.
- Targeting flask build - Once the feature is complete, it will target a
MM Flash realease
- Placeholder for gator `TokenTransferPage` to be implemented fully
#36207
[](https://codespaces.new/MetaMask/metamask-extension/pull/35219?quickstart=1)
## **Related issues**
requires: MetaMask/core#6033
requires: #35627
requires: MetaMask/snap-7715-permissions#108
requires: #35307
relates to: MetaMask/snap-7715-permissions#84
required by: #36207
## **Manual testing steps**
### Setting up required MM snaps(Installing snaps):
Local version of kernel-snap, gator-snap, and the message-signing-snap
from [snap-7715-permissions mono
repo](https://github.com/MetaMask/snap-7715-permissions) is required to
be running locally to fully test e2e manually. Follow the steps in the
README.md to get those snaps up and running. The development site at
`http://localhost:8000/` will be used to install the snaps and grant
some gator permissions.
- repo: [snap-7715-permissions mono
repo](https://github.com/MetaMask/snap-7715-permissions)
- branch: `dev`
- commit hash: `520fffde76c98701e9bac9eb080695e673b7736e`
### Testing e2e flow
1. Ensure `snap-7715-permissions mono` development server is up and
running
2. In MM extension `.metamaskrc` file, ensure the following env values
are set:
```bash
GATOR_PERMISSIONS_ENABLED=true
GATOR_PERMISSIONS_REVOCATION_ENABLED=true
PERMISSIONS_KERNEL_SNAP_ID='local:http://localhost:8081'
GATOR_PERMISSIONS_PROVIDER_SNAP_ID='local:http://localhost:8082'
```
4. Run `yarn start:flask`
5. Once MM extension is installed, navigate to the snaps development
site at `http://localhost:8000/`
- Install kernel-snap
- Install gator-snap
6. Go to "All Permissions Page" in MM extension
## **Screenshots/Recordings**
### **Installing snaps**
https://github.com/user-attachments/assets/b21a7827-d4d2-4b72-bfa9-ea7ff9a08bd4
### **Before**
https://github.com/user-attachments/assets/f3b4d4fe-8cad-4c48-a314-a65a8fd2dc14
### **After**
https://github.com/user-attachments/assets/490e03d4-54db-48e5-b4b2-f9b16d1d257a
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Adds gated Gator Permissions revocation flow: new
routes/pages/components, selectors and hook, global menu/nav updates,
env flag, locales, and comprehensive tests.
>
> - **Feature flag & config**
> - Add `GATOR_PERMISSIONS_REVOCATION_ENABLED` env (builds.yml) and
`isGatorPermissionsRevocationFeatureEnabled()` with tests.
> - **Routing & navigation**
> - Add routes: `GATOR_PERMISSIONS`, `TOKEN_TRANSFER_ROUTE`; register in
router and analytics map.
> - Update Global Menu “Connected sites” link to route to
`GATOR_PERMISSIONS` when flag is on.
> - Permissions page back button and title vary based on flag; header
visibility utils updated for new routes.
> - **UI**
> - New pages: `GatorPermissionsPage`, `TokenTransferPage` (scaffolded),
and `PermissionListItem` component.
> - Gator Permissions page lists Sites and Token transfer categories
(loading/empty states included).
> - **Data layer**
> - New selectors in `ui/selectors/gator-permissions` to
deserialize/aggregate permissions.
> - New hook `useGatorPermissions` to fetch/update permissions state.
> - **Tests**
> - Unit tests for env flag, selectors, hook; snapshots for new
pages/components.
> - E2E: permissions navigation and back behavior; global menu link
target.
> - **Locales**
> - Add strings for `sites` and `tokenTransfer` in `en` and `en_GB`.
> - **Fixtures**
> - Extend mock state with gator permissions fields and serialized map.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
ddf1657. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Tadej Vengust <[email protected]>
## **Description**
This PR lays the foundation for the gator permissions revocation
feature. Introduces the following:
- The usage of the `GatorPemissionsController` to fetch gator
permissions that have been granted to sites.
- A dedicated selector that filters `GatorPemissionsController` state to
provide necessary data allowing components to render gator permissions
revocation features.
- Introduces the `GATOR_PERMISSIONS_REVOCATION_ENABLED` feature flag
that is set to `false`. This flag is used to continue building the gator
permissions view without impacting end-users.
- All UI changes are behind the `GATOR_PERMISSIONS_REVOCATION_ENABLED`
feature flag.
- Dynamic routing based on `GATOR_PERMISSIONS_REVOCATION_ENABLED`
feature flag.
- 'All permissions' click on the global menu.
- 'Back button' click on the site connection page.
- Targeting flask build - Once the feature is complete, it will target a
MM Flash realease
- Placeholder for gator `TokenTransferPage` to be implemented fully
#36207
[](https://codespaces.new/MetaMask/metamask-extension/pull/35219?quickstart=1)
## **Related issues**
requires: MetaMask/core#6033
requires: #35627
requires: MetaMask/snap-7715-permissions#108
requires: #35307
relates to: MetaMask/snap-7715-permissions#84
required by: #36207
## **Manual testing steps**
### Setting up required MM snaps(Installing snaps):
Local version of kernel-snap, gator-snap, and the message-signing-snap
from [snap-7715-permissions mono
repo](https://github.com/MetaMask/snap-7715-permissions) is required to
be running locally to fully test e2e manually. Follow the steps in the
README.md to get those snaps up and running. The development site at
`http://localhost:8000/` will be used to install the snaps and grant
some gator permissions.
- repo: [snap-7715-permissions mono
repo](https://github.com/MetaMask/snap-7715-permissions)
- branch: `dev`
- commit hash: `520fffde76c98701e9bac9eb080695e673b7736e`
### Testing e2e flow
1. Ensure `snap-7715-permissions mono` development server is up and
running
2. In MM extension `.metamaskrc` file, ensure the following env values
are set:
```bash
GATOR_PERMISSIONS_ENABLED=true
GATOR_PERMISSIONS_REVOCATION_ENABLED=true
PERMISSIONS_KERNEL_SNAP_ID='local:http://localhost:8081'
GATOR_PERMISSIONS_PROVIDER_SNAP_ID='local:http://localhost:8082'
```
4. Run `yarn start:flask`
5. Once MM extension is installed, navigate to the snaps development
site at `http://localhost:8000/`
- Install kernel-snap
- Install gator-snap
6. Go to "All Permissions Page" in MM extension
## **Screenshots/Recordings**
### **Installing snaps**
https://github.com/user-attachments/assets/b21a7827-d4d2-4b72-bfa9-ea7ff9a08bd4
### **Before**
https://github.com/user-attachments/assets/f3b4d4fe-8cad-4c48-a314-a65a8fd2dc14
### **After**
https://github.com/user-attachments/assets/490e03d4-54db-48e5-b4b2-f9b16d1d257a
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Adds gated Gator Permissions revocation flow: new
routes/pages/components, selectors and hook, global menu/nav updates,
env flag, locales, and comprehensive tests.
>
> - **Feature flag & config**
> - Add `GATOR_PERMISSIONS_REVOCATION_ENABLED` env (builds.yml) and
`isGatorPermissionsRevocationFeatureEnabled()` with tests.
> - **Routing & navigation**
> - Add routes: `GATOR_PERMISSIONS`, `TOKEN_TRANSFER_ROUTE`; register in
router and analytics map.
> - Update Global Menu “Connected sites” link to route to
`GATOR_PERMISSIONS` when flag is on.
> - Permissions page back button and title vary based on flag; header
visibility utils updated for new routes.
> - **UI**
> - New pages: `GatorPermissionsPage`, `TokenTransferPage` (scaffolded),
and `PermissionListItem` component.
> - Gator Permissions page lists Sites and Token transfer categories
(loading/empty states included).
> - **Data layer**
> - New selectors in `ui/selectors/gator-permissions` to
deserialize/aggregate permissions.
> - New hook `useGatorPermissions` to fetch/update permissions state.
> - **Tests**
> - Unit tests for env flag, selectors, hook; snapshots for new
pages/components.
> - E2E: permissions navigation and back behavior; global menu link
target.
> - **Locales**
> - Add strings for `sites` and `tokenTransfer` in `en` and `en_GB`.
> - **Fixtures**
> - Extend mock state with gator permissions fields and serialized map.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
ddf1657. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Tadej Vengust <[email protected]>
What
The
@metamask/gator-permissions-snapwill automatically store granted permissions using MetaMask Profile Sync.How
yarn installstartup upyarn prepare:snapscript@metamask/message-signing-snapfor local dev@metamask/message-signing-snap: local:http://localhost:8080@metamask/permissions-kernel-snap: local:http://localhost:8081@metamask/gator-permissions-snap: local:http://localhost:8082Profile Sync SDK: OAuth 2.0 Authentication flow
See docs for more context, TL;DR
SRPidentifier that uses the message signing snap to derive a public key.SRPidentifier.Granted permissions store flow
See docs for more context, TL;DR
gator_7715_permissionsas the feature name to store all of the user's granted permissions.permissionContext(i.e., the encoded signed delegation) as the unique identifier for each item stored under thegator_7715_permissionsfeature name.Granted permissions retrieval flow(view)
See docs for more context, TL;DR
@metamask/gator-permissions-snaphomepage.Testing e2e locally
./packages/site/.env.development@metamask/gator-permissions-snaphomepage and you should see the granted permission detailsTask
message-signing-snapfor local testing orsignMessageandgetPublicKeymethods.@metamask/gator-permissions-snapmessage-signing-snapautomatically on the Gator snap install hook. Sincemessage-signing-snapis preinstalled, it will only install when running snaps locally. This will also establish connection between the two snap so rpc requestgator-snap->message-signing-snapwont fail.message-signing-snap: Request to message signing snap to sign messages is failing. We need to update the message signing snapendowment:rpcto allow requests from aSnapand addnpm:@metamask/gator-permissions-snaptoinitialConnections: I have a branch that makes these changes: chore: Update endowment:rpc to allow a snaps and add gator snap to initialConnections message-signing-snap#128message-signing-snap1.1.2release(npm publish): 1.1.2 message-signing-snap#129team-readable-permissionsto MetaMask-planning to members to teams.json: https://github.com/MetaMask/MetaMask-planning/pull/4822