Skip to content

Redesign Keyring Controller API #431

@Gudahtt

Description

@Gudahtt

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-controller does 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:

Edit: Work towards this has begun, but there is a bunch of preparation required first. Here's a rough checklist of the work involved:

Sub-issues

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions