Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

do not allow re-initialization of keyring instance #55

Merged
merged 3 commits into from
Feb 14, 2022

Conversation

kumavis
Copy link
Member

@kumavis kumavis commented Jan 12, 2022

Based on LeastAuthority Audit December 2021: Suggestion 1 and Suggestion 5

this would be a breaking change in behavior (requires consumer to call generateRandomMnemonic() after initialization for creating new SRPs)

@kumavis kumavis requested a review from a team as a code owner January 12, 2022 01:07
Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@@ -43,7 +53,7 @@ class HdKeyring extends SimpleKeyring {

addAccounts(numberOfAccounts = 1) {
if (!this.root) {
this._initFromMnemonic(bip39.generateMnemonic());
throw new Error('Eth-Hd-Keyring: No secret recovery phrase provided');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: It would be nice to have this covered by a test as well

@kumavis kumavis merged commit 4b04a99 into main Feb 14, 2022
@kumavis kumavis deleted the explicit-generate-random branch February 14, 2022 18:52
@adonesky1 adonesky1 mentioned this pull request Apr 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants