Skip to content

feat: add gator permissions controller #6033

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

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
5eaf7d8
Add GatorPermissionsController package
V00D00-child Jun 25, 2025
b8008de
Add gator permissions controller to root ts build config and dependen…
V00D00-child Jun 26, 2025
c12992e
Add ERC-7715 type definitions and increase test coverage
V00D00-child Jun 27, 2025
924d80f
Increase test coverage
V00D00-child Jun 30, 2025
cbf1238
Add changelog
V00D00-child Jun 30, 2025
e67c32e
Add GatorPermissionsController package
V00D00-child Jun 25, 2025
fa9e582
Add gator permissions controller to root ts build config and dependen…
V00D00-child Jun 26, 2025
f00b3e5
Add ERC-7715 type definitions and increase test coverage
V00D00-child Jun 27, 2025
ef745e7
Increase test coverage
V00D00-child Jun 30, 2025
22ab42d
Add changelog
V00D00-child Jun 30, 2025
1affd31
Resolve lint error
V00D00-child Jun 30, 2025
803065b
Resolve lint error
V00D00-child Jun 30, 2025
95f93e4
Resolve lint error in readme
V00D00-child Jun 30, 2025
6f8850e
Export all types from GatorPermissionsController package
V00D00-child Jun 30, 2025
6408721
Update GatorPermissionsList to filter by by permission type and chainId
V00D00-child Jul 9, 2025
d420565
Remove gator_7715_permissions from USER_STORAGE_FEATURE_NAMES as the …
V00D00-child Jul 9, 2025
685514a
Update @metamask/profile-sync-controller deps to 20.0.0
V00D00-child Jul 9, 2025
66ee8c0
Upgrade @metamask/utils version
V00D00-child Jul 10, 2025
5ddd109
Use SnapController instead of UserStorageContoller to send rpc reques…
V00D00-child Jul 11, 2025
346dad0
Fix merge conflicts with CODEOWNER file
V00D00-child Jul 15, 2025
c6949ac
Use proper MetaMask logging
V00D00-child Jul 17, 2025
746a079
Change team name to delegation
V00D00-child Jul 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
/packages/transaction-controller @MetaMask/confirmations
/packages/user-operation-controller @MetaMask/confirmations

## Delegation Team
/packages/gator-permissions-controller @MetaMask/delegation

## Earn Team
/packages/earn-controller @MetaMask/earn
## Notifications Team
Expand Down Expand Up @@ -111,6 +114,8 @@
/packages/ens-controller/CHANGELOG.md @MetaMask/confirmations @MetaMask/core-platform
/packages/gas-fee-controller/package.json @MetaMask/confirmations @MetaMask/core-platform
/packages/gas-fee-controller/CHANGELOG.md @MetaMask/confirmations @MetaMask/core-platform
/packages/gator-permissions-controller/package.json @MetaMask/delegation @MetaMask/core-platform
/packages/gator-permissions-controller/CHANGELOG.md @MetaMask/delegation @MetaMask/core-platform
/packages/keyring-controller/package.json @MetaMask/accounts-engineers @MetaMask/core-platform
/packages/keyring-controller/CHANGELOG.md @MetaMask/accounts-engineers @MetaMask/core-platform
/packages/logging-controller/package.json @MetaMask/confirmations @MetaMask/core-platform
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Each package in this repository has its own README where you can find installati
- [`@metamask/eth-json-rpc-provider`](packages/eth-json-rpc-provider)
- [`@metamask/foundryup`](packages/foundryup)
- [`@metamask/gas-fee-controller`](packages/gas-fee-controller)
- [`@metamask/gator-permissions-controller`](packages/gator-permissions-controller)
- [`@metamask/json-rpc-engine`](packages/json-rpc-engine)
- [`@metamask/json-rpc-middleware-stream`](packages/json-rpc-middleware-stream)
- [`@metamask/keyring-controller`](packages/keyring-controller)
Expand Down Expand Up @@ -99,6 +100,7 @@ linkStyle default opacity:0.5
eth_json_rpc_provider(["@metamask/eth-json-rpc-provider"]);
foundryup(["@metamask/foundryup"]);
gas_fee_controller(["@metamask/gas-fee-controller"]);
gator_permissions_controller(["@metamask/gator-permissions-controller"]);
json_rpc_engine(["@metamask/json-rpc-engine"]);
json_rpc_middleware_stream(["@metamask/json-rpc-middleware-stream"]);
keyring_controller(["@metamask/keyring-controller"]);
Expand Down Expand Up @@ -194,6 +196,7 @@ linkStyle default opacity:0.5
gas_fee_controller --> controller_utils;
gas_fee_controller --> polling_controller;
gas_fee_controller --> network_controller;
gator-permissions-controller --> base_controller;
json_rpc_middleware_stream --> json_rpc_engine;
keyring_controller --> base_controller;
logging_controller --> base_controller;
Expand Down
14 changes: 14 additions & 0 deletions packages/gator-permissions-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- Initial release ([#6033](https://github.com/MetaMask/core/pull/6033))

[Unreleased]: https://github.com/MetaMask/core/
20 changes: 20 additions & 0 deletions packages/gator-permissions-controller/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
MIT License

Copyright (c) 2025 MetaMask

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
38 changes: 38 additions & 0 deletions packages/gator-permissions-controller/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# `@metamask/gator-permissions-controller`

A dedicated controller for reading gator permissions from profile sync storage. This controller fetches data from the encrypted user storage database and caches it locally, providing fast access to permissions across devices while maintaining privacy through client-side encryption.

## Installation

`yarn add @metamask/gator-permissions-controller`

or

`npm install @metamask/gator-permissions-controller`

## Usage

### Basic Setup

```typescript
import { GatorPermissionsController } from '@metamask/gator-permissions-controller';

// Create the controller
const gatorPermissionsController = new GatorPermissionsController({
messenger: yourMessenger,
});

// Enable the feature (requires authentication)
gatorPermissionsController.enableGatorPermissions();
```

### Fetch from Profile Sync

```typescript
const permissions =
await gatorPermissionsController.fetchAndUpdateGatorPermissions();
```

## Contributing

This package is part of a monorepo. Instructions for contributing can be found in the [monorepo README](https://github.com/MetaMask/core#readme).
26 changes: 26 additions & 0 deletions packages/gator-permissions-controller/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* For a detailed explanation regarding each configuration property and type check, visit:
* https://jestjs.io/docs/configuration
*/

const merge = require('deepmerge');
const path = require('path');

const baseConfig = require('../../jest.config.packages');

const displayName = path.basename(__dirname);

module.exports = merge(baseConfig, {
// The display name when running multiple projects
displayName,

// An object that configures minimum threshold enforcement for coverage results
coverageThreshold: {
global: {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
},
});
79 changes: 79 additions & 0 deletions packages/gator-permissions-controller/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"name": "@metamask/gator-permissions-controller",
"version": "0.0.0",
"description": "Controller for managing gator permissions with profile sync integration",
"keywords": [
"MetaMask",
"Ethereum"
],
"homepage": "https://github.com/MetaMask/core/tree/main/packages/gator-permissions-controller#readme",
"bugs": {
"url": "https://github.com/MetaMask/core/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/MetaMask/core.git"
},
"license": "MIT",
"sideEffects": false,
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
},
"./package.json": "./package.json"
},
"main": "./dist/index.cjs",
"types": "./dist/index.d.cts",
"files": [
"dist/"
],
"scripts": {
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
"build:docs": "typedoc",
"changelog:update": "../../scripts/update-changelog.sh @metamask/gator-permissions-controller",
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/gator-permissions-controller",
"publish:preview": "yarn npm publish --tag preview",
"since-latest-release": "../../scripts/since-latest-release.sh",
"test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter",
"test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache",
"test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose",
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
},
"dependencies": {
"@metamask/base-controller": "^8.0.1",
"@metamask/snaps-sdk": "^9.0.0",
"@metamask/snaps-utils": "^11.0.0",
"@metamask/utils": "^11.4.2"
},
"devDependencies": {
"@lavamoat/allow-scripts": "^3.0.4",
"@lavamoat/preinstall-always-fail": "^2.1.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/snaps-controllers": "^14.0.1",
"@ts-bridge/cli": "^0.6.1",
"@types/jest": "^27.4.1",
"deepmerge": "^4.2.2",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.2.2"
},
"peerDependencies": {
"@metamask/snaps-controllers": "^14.0.0"
},
"engines": {
"node": "^18.18 || >=20"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
}
}
Loading
Loading