Skip to content

feat(keyring-eth-money-mpc): add read-only mode for clients without MFA - #722

Merged
matthiasgeihs merged 4 commits into
mainfrom
feat/mpc-money-keyring-read-only
Dec 2, 2026
Merged

matthiasgeihs merged 4 commits into
mainfrom
feat/mpc-money-keyring-read-only

Conversation

@matthiasgeihs

Copy link
Copy Markdown
Contributor

Today the extension can still instantiate the MPC money keyring, which means 2FA can be triggered even where the client doesn't support MFA. Following the Slack discussion, the client now tells the keyring whether MFA is available, and without it the keyring only exposes the account address.

The keyring takes a required isMfaAvailable option, derived from the client's MFA feature flag.

With isMfaAvailable: false (read-only):

  • setup calls check-key-share with a profile token without 2FA and stores only the address derived from the returned publicKey. No relayer session, key share or mnemonic is involved.
  • setup throws when the profile has no active key. The backend returns the public key of the latest share, which may be pending, so it's only trusted together with an activeEpoch. A pending share without an active epoch comes from an unfinished create, and a pending rotation keeps the public key.
  • Signing, rotateKeyShares, checkKeyShare and syncKeyShare throw before any network call.
  • The V2 adapter returns the account with an empty methods list.
  • A full persisted state is kept on serialize, so turning the flag off can't drop the key share. It just isn't used for signing.

Migrating from read-only to read/write: a keyring constructed with isMfaAvailable: true that loads an address-only state keeps returning the address, throws on signing until setup runs, and then imports the key share with 2FA. Import throws if the imported address differs from the stored one. The V2 createAccounts now always runs the inner setup (a no-op once set up) so this path is reachable.

Depends on consensys-vertical-apps/va-mmcx-mpc-service-api#106, which adds publicKey to the check-key-share response. Until that ships, read-only setup throws "no MPC key for this profile".

Examples

Clients construct the keyring with new MpcMoneyKeyring({ ...opts, isMfaAvailable }), where isMfaAvailable comes from the MFA feature flag.

matthiasgeihs and others added 2 commits November 26, 2026 22:19
Co-authored-by: Cursor <cursoragent@cursor.com>
@matthiasgeihs
matthiasgeihs marked this pull request as ready for review December 1, 2026 11:09
@matthiasgeihs
matthiasgeihs requested a review from a team as a code owner December 1, 2026 11:09
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

Preview builds have been published. Learn how to use preview builds in other projects.

Expand for full list of packages and versions.
@metamask-previews/eth-money-mpc-keyring@0.4.0-preview-bbc134d

Co-authored-by: Cursor <cursoragent@cursor.com>
ccharly
ccharly previously approved these changes Dec 1, 2026
…g-read-only

Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	packages/keyring-eth-money-mpc/CHANGELOG.md
@matthiasgeihs
matthiasgeihs added this pull request to the merge queue Dec 2, 2026
Merged via the queue into main with commit 1a12c89 Dec 2, 2026
27 checks passed
@matthiasgeihs
matthiasgeihs deleted the feat/mpc-money-keyring-read-only branch December 2, 2026 08:34
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