-
-
Notifications
You must be signed in to change notification settings - Fork 266
Description
The keyring controller API is confusing and difficult to extend.
Today we have two "keyring controllers". The first is the original one, eth-keyring-controller, which is used by both projects. The second is @metamask/keyring-controller, which is used by mobile as a wrapper around eth-keyring-controller.
@metamask/keyring-controller mainly serves to coordinate changes between eth-keyring-controller and other controllers. It also handles some keyring-interaction related tasks that aren't handled by eth-keyring-controller, such as input parsing for imported accounts.
- Side-note: In the extension, the closest equivalent to this wrapper class is a collection of keyring-related methods that are directly in
metamask-controller.js. This collection of functions serves the same purpose that@metamask/keyring-controllerdoes for mobile.
My questions are:
- What is the KeyringController (
eth-keyring-controller) responsible for exactly? Why are some keyring methods called through the KeyringController, while others are called directly on keyrings? - What is the wrapper KeyringController class responsible for? Can we avoid the need for a wrapper class altogether?
- How can we extend the capabilities of keyrings and integrate keyrings with additional setup requirements without requiring custom methods in the keyring controller?
The outcome of this task should be a proposal in Notion.
Related issues:
- Refactor identity state management #1107
- Consolidate keyring interactions on extension and mobile #1101
Edit: Work towards this has begun, but there is a bunch of preparation required first. Here's a rough checklist of the work involved:
- Introduce new
Keyringinterface that matches existing APIs as closely as possible- Create the
typesrepo and all necessary basic types - Create new Keyring interface (work in progress here: Add
Keyringtypes utils#74)
- Create the
- browser-passworder
- Standardize and clean up the repository
- Migrate to TypeScript
- Rename the repository and package
- obs-store
- Standardize and clean up the repository
- Migrate to TypeScript
- Rename the repository and package
- eth-sig-util
- Standardize and clean up the repository
- Migrate to TypeScript
- Rename the repository and package
- eth-simple-keyring
- Standardize and clean up the repository
- Migrate to TypeScript (Migrate to TypeScript eth-simple-keyring#135)
- Rename the repository and package
- KeyringController
- Standardize and clean up the repository
- Migrate to TypeScript (Migrate to TypeScript KeyringController#195)
- Rename the repository and package
- eth-hd-keyring
- Standardize and clean up the repository
- Migrate to TypeScript (Migrate to TypeScript eth-hd-keyring#84)
- Rename the package
- eth-trezor-keyring
- Standardize and clean up the repository (Standardize repository eth-trezor-keyring#157)
- Migrate to TypeScript (Migrate to TypeScript eth-trezor-keyring#156)
- Rename the package (Rename package to use
@metamaskscope eth-trezor-keyring#158)
- eth-ledger-bridge-keyring
- Standardize and clean up the repository (Standardize repo eth-ledger-bridge-keyring#155)
- Migrate to TypeScript (Migrate to TypeScript eth-ledger-bridge-keyring#23)
- Rename the package