MetaMask / MetaMask/metamask-extension
[Bug]: If new account create by user is present in a keyring of type Simple Key Pair, delete it from there.
- Dominant language
- TypeScript
- Stars
- 13.2k
- Forks
- 5.6k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 451
Description
### Describe the bug
If a user import into metamask an account which was created using the same metamask user account, user is able to import it and it is saved to a keyring of type **Simple Key Pair**. Now if the user creates more accounts using metamask those will be added to **HD Key Tree** - this will result in duplicate account issue as detailed here: https://github.com/MetaMask/metamask-extension/issues/12525
If we create and add account to **HD Key Tree** for the user we should check to ensure that the account is not part of a keyring of type **Simple Key Pair**, in case it is we should delete the account from keyring (and also delete keyring which will be empty after deleting account). We also should communicate this to the user.
At this point it might be useful to create more one account for user (till we are able to find one that is not imported already). So that user get an additional account for using create account feature.
More details here: https://docs.google.com/document/d/1WsolUuduD4zbmqPsCjRg6Nti1woWbdXmjjB8wheLGmg/edit?usp=sharing
### Version
10.9.1
### Browser
Chrome, Firefox, Microsoft Edge, Brave
### Operating system
Windows, MacOS, Linux
Contributor guide
Research direction
Start by tracing the account-creation flow and the Simple Key Pair and HD Key Tree keyring handling, then compare the duplicate-account behavior described in issue #12525. No source file or test is named, so identify the relevant account and keyring tests before changing behavior. Done means duplicate imported accounts are removed and the user is informed when a new account is created.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, security
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100