Skip to content

Conversation

@mathieuartu
Copy link
Contributor

@mathieuartu mathieuartu commented Nov 12, 2025

Related to the Unified Keyring Interface ADR
Fixes MUL-1225

Examples


Note

Adds the new Keyring V2 interface and supporting v2 types for account creation/export, capabilities, and keyring types, with tests and README note.

  • API v2:
    • @metamask/keyring-api/src/api/v2: New module exporting keyring.ts (KeyringV2), keyring-capabilities.ts (KeyringCapabilitiesStruct), keyring-type.ts (KeyringType), private-key.ts (encodings/import/export formats), create-account/* (BIP‑44 derive/discover and private key import options + union), and export-account/* (private key export options/results + union).
    • Update api/index.ts to export ./v2.
  • Accounts:
    • Add KeyringAccountTypeStruct in api/account.ts for validating KeyringAccountType.
  • Tests:
    • Add runtime validation tests for CreateAccountOptionsStruct and type tests (keyring.test-d.ts) covering enums, option unions, capabilities, and exports.
  • Docs:
    • README: add brief section pointing to KeyringV2 (WIP) and its path.

Written by Cursor Bugbot for commit 9f4da7f. This will update automatically on new commits. Configure here.

@mathieuartu mathieuartu self-assigned this Nov 12, 2025
@mathieuartu mathieuartu requested a review from a team as a code owner November 12, 2025 08:59
@mathieuartu mathieuartu changed the title feat(keyring-v2): add initial keyring v2 interface feat(keyring-api): add initial keyring v2 interface Nov 12, 2025
@mathieuartu mathieuartu force-pushed the feat/keyring-v2-interface branch from 5f083b8 to 5a7b40a Compare November 14, 2025 14:17
@danroc
Copy link
Contributor

danroc commented Nov 19, 2025

LGTM! @ccharly, do you want to discuss further how to enforce the methods and arguments based on the capabilities or should we merge this PR as is?

I'm fine with both approaches.

@ccharly
Copy link
Contributor

ccharly commented Nov 19, 2025

I think it's ok to go with this version for now, we can try to work in parallel with that "keyring capabilities combinations" ideas in parallel IMO 👍

return CreateAccountPrivateKeyOptionsStruct;
default:
// Return first struct as fallback - validation will fail with proper error indicating the type mismatch
return CreateAccountBip44DerivePathOptionsStruct;
Copy link
Contributor

Choose a reason for hiding this comment

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

For future improvements, I think we could have a specific Struct for this which is the union of all various type values, so it does not default only to bip44:derive-path, but that's fine for now

@mathieuartu mathieuartu added this pull request to the merge queue Nov 19, 2025
Merged via the queue into main with commit 8185566 Nov 19, 2025
35 checks passed
@mathieuartu mathieuartu deleted the feat/keyring-v2-interface branch November 19, 2025 13:39
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.

4 participants