Skip to content

feat(keyring-sdk): add decodeMnemonic{,Words} - #612

Merged
ccharly merged 2 commits into
mainfrom
cc/feat/decode-mnemonic
Aug 3, 2026
Merged

feat(keyring-sdk): add decodeMnemonic{,Words}#612
ccharly merged 2 commits into
mainfrom
cc/feat/decode-mnemonic

Conversation

@ccharly

@ccharly ccharly commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Decoding helpers for mnemonics.


Note

Low Risk
Additive SDK API with tests and no changes to existing encode behavior; mnemonic handling is sensitive in principle but this only adds parsing helpers consistent with existing encoders.

Overview
Adds decode helpers in keyring-sdk that mirror the existing encodeMnemonic / encodeMnemonicWords APIs, turning BIP-39 English mnemonics back into 16-bit word-index byte buffers.

decodeMnemonicWords splits a space-separated phrase and maps each word through the English wordlist; decodeMnemonic UTF-8-decodes bytes first, then delegates to decodeMnemonicWords. Both reject unknown words with Invalid mnemonic word: "…". Tests cover empty input, round-trip with encodeMnemonic, and invalid-word errors. The unreleased changelog entry documents the new exports.

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

@ccharly

ccharly commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

@metamaskbot publish-preview

@github-actions

Copy link
Copy Markdown

Preview builds have been published. See these instructions (from the core monorepo) for more information about preview builds.

Expand for full list of packages and versions.
{
  "@metamask-previews/account-api": "2.0.0-914f87e",
  "@metamask-previews/hw-wallet-sdk": "1.0.0-914f87e",
  "@metamask-previews/keyring-api": "24.0.0-914f87e",
  "@metamask-previews/eth-hd-keyring": "15.0.0-914f87e",
  "@metamask-previews/eth-ledger-bridge-keyring": "13.0.1-914f87e",
  "@metamask-previews/eth-money-keyring": "4.0.0-914f87e",
  "@metamask-previews/eth-qr-keyring": "3.0.0-914f87e",
  "@metamask-previews/eth-simple-keyring": "13.0.0-914f87e",
  "@metamask-previews/eth-trezor-keyring": "11.0.0-914f87e",
  "@metamask-previews/keyring-internal-api": "12.0.0-914f87e",
  "@metamask-previews/keyring-internal-snap-client": "11.0.0-914f87e",
  "@metamask-previews/keyring-sdk": "3.0.0-914f87e",
  "@metamask-previews/eth-snap-keyring": "24.0.0-914f87e",
  "@metamask-previews/keyring-snap-client": "10.0.0-914f87e",
  "@metamask-previews/keyring-snap-sdk": "10.0.0-914f87e",
  "@metamask-previews/keyring-utils": "5.0.0-914f87e"
}

@ccharly
ccharly marked this pull request as ready for review August 3, 2026 09:41
@ccharly
ccharly requested a review from a team as a code owner August 3, 2026 09:41
@ccharly
ccharly enabled auto-merge August 3, 2026 11:04
@ccharly
ccharly added this pull request to the merge queue Aug 3, 2026
Merged via the queue into main with commit 07f04a1 Aug 3, 2026
24 checks passed
@ccharly
ccharly deleted the cc/feat/decode-mnemonic branch August 3, 2026 12:44
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.

2 participants