-
-
Notifications
You must be signed in to change notification settings - Fork 9
feat(keyring-api): add initial keyring v2 interface #397
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
Conversation
5f083b8 to
5a7b40a
Compare
|
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. |
|
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; |
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.
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
Co-authored-by: Charly Chevalier <[email protected]>
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.
@metamask/keyring-api/src/api/v2: New module exportingkeyring.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), andexport-account/*(private key export options/results + union).api/index.tsto export./v2.KeyringAccountTypeStructinapi/account.tsfor validatingKeyringAccountType.CreateAccountOptionsStructand type tests (keyring.test-d.ts) covering enums, option unions, capabilities, and exports.KeyringV2(WIP) and its path.Written by Cursor Bugbot for commit 9f4da7f. This will update automatically on new commits. Configure here.