Skip to content

feat(keyring-eth-hd)!: add legacyEntropySource#602

Open
ccharly wants to merge 7 commits into
cc/feat/entropyfrom
cc/feat/hd-keyring-legacy-entropy-source
Open

feat(keyring-eth-hd)!: add legacyEntropySource#602
ccharly wants to merge 7 commits into
cc/feat/entropyfrom
cc/feat/hd-keyring-legacy-entropy-source

Conversation

@ccharly

@ccharly ccharly commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Introducing the new entropy source ID to the v2 HdKeyring.

This will allow us to use it in combination with :withKeyringV2 to filter out HD keyrings with their new deterministic entropy source.

This way we can have mapping between both:

const entropySource = this.messenger.call('KeyringController:withKeyringV2', {
  filter: ({ keyring }) =>
    isHdKeyring(keyring) && keyring.legacyEntropySource === legacyEntropySource,
  ({ keyring }) => keyring.entropySource
);

// OR:
const legacyEntropySource = this.messenger.call('KeyringController:withKeyringV2', {
  filter: ({ keyring }) =>
    isHdKeyring(keyring) && keyring.entropySource === entropySource,
  ({ keyring }) => keyring.legacyEntropySource
);

Note

Medium Risk
Breaking rename/repurpose of entropySource affects consumers that assumed the legacy keyring id; migration depends on correctly populating legacyEntropySource.

Overview
Breaking change to v2 HdKeyring entropy identifiers: public entropySource is now the canonical fingerprint entropy:bip44:mnemonic:<uuid> (Bip44MnemonicEntropyId), and the previous KeyringController keyring id moves to optional public legacyEntropySource on HdKeyringOptions for migration-era bidirectional lookup via withKeyringV2.

@metamask/keyring-sdk adds AsEntropyId to narrow string template types to EntropyId at compile time; tests use a real canonical entropy id and cover legacyEntropySource when set vs omitted.

Reviewed by Cursor Bugbot for commit 8504e52. Bugbot is set up for automated code reviews on this repo. Configure here.

@ccharly
ccharly force-pushed the cc/feat/hd-keyring-legacy-entropy-source branch from 40ba82f to ced99f2 Compare July 22, 2026 17:08
@ccharly
ccharly changed the base branch from main to cc/feat/entropy July 22, 2026 17:08
@ccharly
ccharly force-pushed the cc/feat/entropy branch 3 times, most recently from d1ef1fe to bdafc36 Compare July 22, 2026 17:26
@ccharly
ccharly force-pushed the cc/feat/hd-keyring-legacy-entropy-source branch from ced99f2 to 200af20 Compare July 22, 2026 17:26
@ccharly ccharly changed the title feat(keyring-eth-hd)!: add legacyEntropySource feat(keyring-eth-hd)!: add legacyEntropySource Jul 22, 2026
@ccharly
ccharly marked this pull request as ready for review July 22, 2026 19:47
@ccharly
ccharly requested a review from a team as a code owner July 22, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant