1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00
Commit Graph

27 Commits

Author SHA1 Message Date
Erik Marks
c03b6dd19b
Subject metadata cleanup (#13090)
This PR fixes some subject metadata-related issues that were missed in #13026.
2021-12-13 12:10:20 -08:00
Erik Marks
31cf7c10a4
Permission System 2.0 (#12243)
# Permission System 2.0

## Background

This PR migrates the extension permission system to [the new `PermissionController`](https://github.com/MetaMask/snaps-skunkworks/tree/main/packages/controllers/src/permissions).
The original permission system, based on [`rpc-cap`](https://github.com/MetaMask/rpc-cap), introduced [`ZCAP-LD`](https://w3c-ccg.github.io/zcap-ld/)-like permissions to our JSON-RPC stack.
We used it to [implement](https://github.com/MetaMask/metamask-extension/pull/7004) what we called "LoginPerSite" in [version 7.7.0](https://github.com/MetaMask/metamask-extension/releases/tag/v7.7.0) of the extension, which enabled the user to choose which accounts, if any, should be exposed to each dapp.
While that was a worthwhile feature in and of itself, we wanted a permission _system_ in order to enable everything we are going to with Snaps.
Unfortunately, the original permission system was difficult to use, and necessitated the creation of the original `PermissionsController` (note the "s"), which was more or less a wrapper for `rpc-cap`.

With this PR, we shake off the yoke of the original permission system, in favor of the modular, self-contained, ergonomic, and more mature permission system 2.0.

Note that [the `PermissionController` readme](https://github.com/MetaMask/snaps-skunkworks/tree/main/packages/controllers/src/permissions/README.md) explains how the new permission system works.

The `PermissionController` and `SubjectMetadataController` are currently shipped via `@metamask/snap-controllers`. This is a temporary state of affairs, and we'll move them to `@metamask/controllers` once they've landed in prod.

## Changes in Detail

First, the changes in this PR are not as big as they seem. Roughly half of the additions in this PR are fixtures in the test for the new migration (number 68), and a significant portion of the remaining ~2500 lines are due to find-and-replace changes in other test fixtures and UI files.

- The extension `PermissionsController` has been deleted, and completely replaced with the new `PermissionController` from [`@metamask/snap-controllers`](https://www.npmjs.com/package/@metamask/snap-controllers).
- The original `PermissionsController` "domain metadata" functionality is now managed by the new `SubjectMetadataController`, also from [`@metamask/snap-controllers`](https://www.npmjs.com/package/@metamask/snap-controllers).
- The permission activity and history log controller has been renamed `PermissionLogController` and has its own top-level state key, but is otherwise functionally equivalent to the existing implementation.
- Migration number 68 has been added to account for the new state changes.
- The tests in `app/scripts/controllers/permissions` have been migrated from `mocha` to `jest`.

Reviewers should focus their attention on the following files:

- `app/scripts/`
  - `metamask-controller.js`
    - This is where most of the integration work for the new `PermissionController` occurs.
      Some functions that were internal to the original controller were moved here.
  - `controllers/permissions/`
    - `selectors.js`
      - These selectors are for `ControllerMessenger` selector subscriptions. The actual subscriptions occur in `metamask-controller.js`. See the `ControllerMessenger` implementation for details.
    - `specifications.js`
      - The caveat and permission specifications are required by the new `PermissionController`, and are used to specify the `eth_accounts` permission and its JSON-RPC method implementation.
        See the `PermissionController` readme for details.
  - `migrations/068.js`
    - The new state should be cross-referenced with the controllers that manage it.
      The accompanying tests should also be thoroughly reviewed.

Some files may appear new but have just moved and/or been renamed:

- `app/scripts/lib/rpc-method-middleware/handlers/request-accounts.js`
  - This was previously implemented in `controllers/permissions/permissionsMethodMiddleware.js`.
- `test/mocks/permissions.js`
  - A truncated version of `test/mocks/permission-controller.js`.

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2021-12-06 19:16:49 -08:00
Niranjana Binoy
532927368d
Network Form Design and switch to full screen enhancements (#12302) 2021-10-25 16:38:43 -04:00
Etienne Dusseault
be0508d41e
Add send-hex-data-row to Storybook (#12085)
* send-hex-data

* id filename

* lint
2021-10-15 09:32:13 -02:30
Etienne Dusseault
1e5c0078dd
Add send-asset-row to Storybook (#12081)
* send-asset

* id filename
2021-10-15 09:30:36 -02:30
Etienne Dusseault
9de632e9d1
Fix contact-list Storybook (#12262) 2021-10-05 09:13:07 -05:00
ryanml
f741712255
Fixing confirmation screen storybook views (#12271) 2021-10-04 06:46:18 -07:00
ryanml
c14f46eb92
Fixing confirm-add-suggested-token storybook entry (#12261) 2021-10-01 09:07:29 -07:00
Etienne Dusseault
bf89226ca1
Add send-header to Storybook (#12084) 2021-09-29 13:43:18 -05:00
Etienne Dusseault
c2bbbdd19c
Add account-list component to Storybook (#12228) 2021-09-29 13:42:49 -05:00
Etienne Dusseault
bf4e565497
edit-gas-display (#12165) 2021-09-23 22:40:03 -03:00
Etienne Dusseault
3ec3baa3a1
send-content (#12167) 2021-09-23 22:39:22 -03:00
Etienne Dusseault
6b7444c257
Add add-recipient to Storybook (#12076) 2021-09-20 14:05:58 -05:00
Etienne Dusseault
d1d01f434d
Add contact-list-tab to Storybook (#12079) 2021-09-13 16:04:31 -05:00
Etienne Dusseault
68c5f23569
Add transaction-list to Storybook (#12011) 2021-09-13 16:01:29 -05:00
Alex Donesky
490d3b8d40
Integrate TokensController (#11552)
* Integrate controllers/tokensController

* address rebase issues

* small cleanup

* addressing feedback

* more feedback
2021-09-10 12:37:19 -05:00
Etienne Dusseault
09e79f273a
fix state problems with Storybook (#11984)
* fix state problems with Storybook

* lint

* lint

* Cleanup

Co-authored-by: ryanml <ryanlanese@gmail.com>
2021-09-07 13:51:41 -10:00
Etienne Dusseault
7d0d6013af
Add connected-accounts component to Storybook (#11637)
* name change

* add actions

* lintfix
2021-08-30 12:56:34 -10:00
Etienne Dusseault
7b4aac7755
Add connected-sites component to Storybook (#11415)
* connectd-sites

* fix image path for storybook

* lintfixd, namechange
2021-08-30 12:56:03 -10:00
Etienne Dusseault
71a9fe2ed1
Add confirm-token-transaction-base component to Storybook (#11414)
* confirm-token-transaction-base

* Update ui/pages/confirm-token-transaction-base/confirm-token-transaction-base.stories.js

Co-authored-by: Brad Decker <git@braddecker.dev>

Co-authored-by: Brad Decker <git@braddecker.dev>
2021-08-17 00:33:32 -05:00
David Walsh
5e18013468
Fix Storybook components by updating state for 1559 (#11676) 2021-07-30 05:06:35 -05:00
Etienne Dusseault
96b0730a89
add confirm-encryption-public-key component to Storybook (#11364)
* confirm-encryption-public-key

* lintfix

* lintfix
2021-07-20 09:29:38 -07:00
ryanml
a69ed05141
Removing obsolete client-side transaction metrics events (#11329)
* Removing metametrics send count tracking

* Removing client side Transaction Completed and Canceled events
2021-06-24 15:37:44 -07:00
Etienne Dusseault
d260b81cd5
Add confirm-deploy-contract component to Storybook (#11211)
* confirm deploy contract

* use downloaded image
2021-06-15 14:20:15 -07:00
Etienne Dusseault
4c341d83ab
Add Approval Confirmation Screen component to Storybook (#10998)
* add metametrics wrapper

* add history dep

* provide test data and mock react router

* add first confirmaion screen

* figure out a way to mock match.params

* render token approval with data

* fix lockfile

* fix lint

* remove use effect

* lintfix

* add . for src paths

* litfix

* Add knobs to change redux store for confirm-approve component (Storybook) (#11135)

* add knob for domain

* knobify

* remove logs

* remove comment

* lintfix

* fix comments

* add background calls + metriccs event to storybook acctions

* lintfixxxx
2021-05-25 08:20:09 +08:00
Shane
0fdc8a42ce
fix: remove unused metamask.rpcUrl from redux state + fix tests to reflect that (#10714) 2021-03-24 15:54:24 -07:00
kumavis
85cf35b2d1
Storybook: Signature Request (#10400)
* storybook - add signature request storybook entry

* storybook + improve test data + lint

* styles - apply flex and align center to --network
2021-02-09 00:49:49 +08:00