MetaMask / MetaMask/core

Remove `KeyringController` methods that are not keyring-agnostic

Open
#5,153 4 comments 0 reactions 1 assignee Claimed by @mikesposito View on GitHub
Epic team-wallet-framework wf-keyring
Dominant language
TypeScript
Stars
413
Forks
308
Avg merge
1d 4h
Merged PRs (30d)
253

Description

`KeyringController` currently provides some methods specific to certain types of keyrings (that is, certain Keyring classes). Though, KeyringController should be managing all keyrings in the same way, and its API should provide access to keyrings in a generic manner, agnostic to the specific keyring type the consumer wants to interact with.

This should include [removing all methods related to the QR keyring](https://github.com/MetaMask/core/issues/4341), as well as all other methods which are not applicable to the generic Keyring type, like:
- `addNewAccount` as it is a specific method for the main `HDKeyring`
- `addNewAccountForKeyring` as it is not compatible with all keyrings, and does not guarantee that the keyring passed is even managed by `KeyringController`
- `importAccountWithStrategy` as it is only applicable to `SimpleKeyring`
- Private keys (or JSON containing keys, depending on the strategy) could also be passed directly to `SimpleKeyring` builder options, with some adjustments to how the `SimpleKeyring` class handles initialization params
- `exportSeedPhrase` as it is only applicable to `HDKeyring`
- `exportAccount` as it is only compatible with `HDKeyring` and `SimpleKeyring`
- `getQRKeyring` as it is a QR-specific method
- `getOrAddQRKeyring`
- `restoreQRKeyring`
- `resetQRKeyringState`
- `getQRKeyringState`
- `submitQR*`
- `cancelQR*`
- `connectQRHardware`
- `unlockQRHardwareWalletAccount`
- `forgetQRDevice`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.