feat(seedless-onboarding-controller): generic encryptor result type aligned with KeyringController#8411
Draft
feat(seedless-onboarding-controller): generic encryptor result type aligned with KeyringController#8411
Conversation
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
Summary
This change aligns SeedlessOnboardingController vault encryption typing with the full Encryptor type from @metamask/keyring-controller, including the encryption result type. Callers can now thread a third generic, EncryptionResult, so the controller’s encryptor matches KeyringController’s three-parameter Encryptor shape instead of a local two-parameter alias.
What changed
SeedlessOnboardingController and SeedlessOnboardingControllerOptions now take an optional third type parameter, EncryptionResult, bounded by EncryptionResultConstraint and defaulting to DefaultEncryptionResult.
The internal #vaultEncryptor and options encryptor field use Encryptor<EncryptionKey, SupportedKeyDerivationParams, EncryptionResult> from @metamask/keyring-controller.
VaultEncryptor was removed from types.ts; consumers should use Encryptor from @metamask/keyring-controller with explicit key, derivation params, and encryption result types.
Tests and MockVaultEncryptor were updated to use Encryptor and DefaultEncryptionResult instead of VaultEncryptor / raw EncryptionResult from browser-passworder where appropriate.
Breaking changes
VaultEncryptor is removed — replace with Encryptor from @metamask/keyring-controller and supply the third type argument when needed.
SeedlessOnboardingControllerOptions no longer defaults EncryptionKey and SupportedKeyDerivationParams — when referencing the options type, pass both (and optionally EncryptionResult) explicitly.
Details and migration notes are in packages/seedless-onboarding-controller/CHANGELOG.md under Unreleased.
References
MetaMask/metamask-mobile#27384
Checklist
Note
Medium Risk
Medium risk due to breaking TypeScript API/typing changes (
SeedlessOnboardingControllerOptionsgenerics and removal ofVaultEncryptor) that require downstream updates, though runtime behavior is unchanged.Overview
Updates
SeedlessOnboardingControllerandSeedlessOnboardingControllerOptionsto support a third genericEncryptionResult, constrained byEncryptionResultConstraintand defaulting toDefaultEncryptionResult, so the vaultencryptormatches@metamask/keyring-controller’s fullEncryptor<EncryptionKey, SupportedKeyDerivationParams, EncryptionResult>typing.Removes the local
VaultEncryptortype alias and updates mocks/tests (MockVaultEncryptor, test helpers) to useEncryptorplusDefaultEncryptionResult, with changelog entries documenting the new generics and breaking type changes.Reviewed by Cursor Bugbot for commit 6de2e9e. Bugbot is set up for automated code reviews on this repo. Configure here.