-
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(keyring-eth-hd)!: move seed generation to deserialization #100
Conversation
I haven't reviewed all the changes in detail, but the idea makes sense to me. I’d like to get @mikesposito’s opinion as well, as my main concern is the potential impact on the interface, other keyrings, and the KeyringController. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mikesposito We will have to update the KeyringController to await |
…raphy (#102) <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? Are there any issues or other links reviewers should consult to understand this pull request better? For instance: * Fixes #12345 * See: #67890 --> Uses the latest version of `@metamask/keytree`, which allows passing `cryptographicFunctions` for derivation of the mnemonic seed. Also reintroduces constructor arguments to allow passing of `cryptographicFunctions` to `HdKeyring`. Follow-up PR to #100 --------- Co-authored-by: Charly Chevalier <[email protected]>
<!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? Are there any issues or other links reviewers should consult to understand this pull request better? For instance: * Fixes #12345 * See: #67890 --> Our HD keyring [has been updated](MetaMask/accounts#100) to support different kinds of cryptographic functions to randomly generate a mnemonic, which may be an asynchronous operation in some cases. This PR updates the `generateRandomMnemonic` on the `Keyring` type accordingly, even though `eth-hd-keyring` does not implement the type yet, because `KeyringController` uses it as keyring interface.
This PR refactors the
eth-hd-keyring
constructor to remove the deserialization step directly in the constructor. This lets us turndeserialize
into a proper async function and use an async version ofmnemonicToSeed
(which should be swapped out for something faster in the future).This is a breaking change and requires that all usage of
eth-hd-keyring
callsdeserialize
with the arguments previously passed into the constructor. This seems to already be the case in theKeyringController
, but may deserve a more thorough look.This PR also changes the function signature of
generateRandomMnemonic
, making this an async function as well.Appreciate any feedback and/or sanity checks on this!