Repository navigation
Conversation
Adopt the current vault keys as a stable vault key set, sealed for the password and for the Recovery Secret in their own metadata partitions, with a control record holding the password namespace auth key. - Add authenticateForRecovery and the non-persisted recoverySession state for the aal2 recovery verifier session - Add migrateToEnvelope with a resumable, encrypted checkpoint - Change the password of envelope-managed vaults by resealing the vault keys and swapping the password OPRF key under the metadata lock - Open the password envelope first in syncLatestGlobalPassword and submitGlobalPassword - Bump @metamask/auth-network-utils to ^0.4.0 Co-authored-by: Cursor <cursoragent@cursor.com>
…in fetchAllSecretData Open the envelope sealed for the password before falling back to the password's own keys, so a new device can restore after an envelope password change. Co-authored-by: Cursor <cursoragent@cursor.com>
…d envelope management Refactor the handling of control records in the Seedless Onboarding Controller to support multiple control records instead of a single control item. This includes changes to how control records are fetched, written, and serialized, enhancing the management of envelope states and improving the overall migration process. - Replace `ControlItem` with `ControlRecord` throughout the codebase. - Update methods to handle arrays of control records, ensuring compatibility with the new structure. - Modify the changelog to reflect the changes in how vault keys are sealed and managed under the new envelope system. This update lays the groundwork for improved envelope management and recovery processes in future implementations.
… reset actions Add new functionalities to the Seedless Onboarding Controller, including: - `recoverWithRecoverySecret`: Allows recovery of an envelope-managed vault using a Recovery Secret instead of a password, enhancing user recovery options. - `resetPasswordWithVaultKeys`: Enables setting a new global password on an unlocked, envelope-managed vault without requiring the old password. Additionally, update error handling to include new messages related to recovery processes and adjust the changelog to reflect these changes. This update improves the overall user experience during vault recovery and password management.
…recovery processes Refactor the Seedless Onboarding Controller to streamline the migration to envelope encryption. Key changes include: - Simplified `migrateToEnvelope` method to eliminate the need for a password during migration, allowing the current password to derive the vault keys directly. - Updated handling of control records to support multiple records and improve envelope management. - Introduced new error handling for recovery processes, including clearer messaging for envelope-related issues. - Adjusted tests to reflect changes in the migration process and ensure proper functionality. These enhancements improve user experience during vault recovery and password management, aligning with ongoing efforts to optimize the onboarding process.
…ality and error handling This update introduces improvements to the `resetPasswordWithVaultKeys` action within the Seedless Onboarding Controller. Key changes include: - Clarified conditions under which the password can be reset, specifically requiring a valid aal2 session and ensuring the local password is not synced. - Added new error messages, including `PasswordResetRequiresRecovery`, to provide clearer feedback during the password reset process. - Updated documentation and tests to reflect these changes, ensuring robust error handling and user guidance. These enhancements aim to streamline the password management experience and improve overall user interaction with the recovery process.
…and update dependencies This commit introduces significant changes to the Seedless Onboarding Controller, focusing on the handling of envelope keys. Key updates include: - Replaced the `deriveEnvelopeKeys` function with `deriveTestEnvelopeKeys` to standardize envelope key derivation across the codebase. - Updated various methods to utilize the new envelope key structure, ensuring consistency in how keys are managed and accessed. - Adjusted tests to reflect these changes, enhancing the reliability of the testing suite. - Updated the `yarn.lock` file to reflect changes in package dependencies. These modifications aim to improve the overall architecture of the envelope management system and streamline the onboarding process for users.
…carding pending envelope migration This update introduces a new behavior in the `recoverWithRecoverySecret` action, ensuring that any pending envelope migration checkpoint is discarded when a vault is restored using the Recovery Secret. Additionally, tests have been added to verify that the recovery session is maintained while the pending migration is cleared. Documentation has been updated to reflect these changes, improving clarity around the recovery process and its implications for envelope management.
…tarball Co-authored-by: Cursor <cursoragent@cursor.com>
|
@metamaskbot publish-preview |
…package.json` and update its reference in `yarn.lock` to use a local tarball instead of a portal link. This change ensures consistency in package management and resolves potential issues with package resolution.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a8247e6. Configure here.
| checksum: 10/2714a70eae53a1f46d293980c71a1ed2f59708247019444154e71fc15328e78ec95287ffc2d954a29f903224a1a9fe4d69fb17724e9039bcefd240752f1df26c | ||
| checksum: 10/3b7d596185f54672f4e024f9088a70876ba59b036c1375da0e9f5dbcd2f44d81f81eaaa4b4eb9dbde6d74864c49a261a4960b044053364c64261fd80bf0fa270 | ||
| languageName: node | ||
| linkType: hard |
There was a problem hiding this comment.
Gitignored tarball breaks dependency install
High Severity
Removing the portal resolution makes Yarn resolve @metamask/toprf-secure-backup from metamask-toprf-secure-backup-1.1.0.tgz. That archive is excluded by the root *.tgz gitignore and is not in this commit, so yarn install fails for CI and anyone without the local file.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit a8247e6. Configure here.
…gration behavior Added documentation to the `SeedlessOnboardingControllerMigrateToEnvelopeAction` type, specifying that any pending envelope migration checkpoint will be discarded when this action is called, as it pertains to the vault being replaced. This enhances clarity regarding the migration process and its implications for existing checkpoints.
|
@metamaskbot publish-preview |
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |


Explanation
Envelope-managed vaults let a user recover their secret data with a Recovery Secret instead of the global password, and let the password change without re-encrypting the vault keys.
This PR adds:
src/envelope/):EnvelopeStorepersists encrypted envelope and control records in their own metadata partitions.envelope-keysderives and seals/opens the envelope keys.pending-migrationcheckpoints an in-flight migration so a failed call can be retried with the same bytes.migrateToEnvelopemakes the current vault keys the stable vault key set, seals them for the Recovery Secret, and writes a control record. Secret data items and the vault itself are unchanged. The firstchangePasswordafter migration writes the password envelope.authenticateForRecoverystarts an aal2 recovery session (src/mfa-recovery/recovery-session.ts, held in non-persistedrecoverySessionstate).recoverWithRecoverySecretopens the Recovery Secret envelope, fetches secret data, and creates a local vault under a new password. Until that password is synced or reset, it is treated as outdated.resetPasswordWithVaultKeyssets a new global password on an unlocked, envelope-managed vault after a Recovery Secret recovery. It is only allowed whileenvelope.passwordAuthPubKeyis unset and with a valid aal2 session.changePassword,syncLatestGlobalPassword,submitGlobalPassword,fetchAllSecretData, andcheckIsPasswordOutdatednow read envelope state first and fall back to the existing key chain when no envelope exists. Envelope-managed vaults are restored infetchAllSecretData.EnvelopeStateandRecoverySessiontypes, all exported fromsrc/index.ts.Recovery flow:
References
Checklist
Note
High Risk
Changes core vault encryption, password sync, and multi-device recovery with new MFA (aal2) paths—mistakes could lock users out or mishandle secret metadata.
Overview
Adds envelope-managed vaults to seedless onboarding: vault keys stay stable in metadata while passwords and a Recovery Secret each get sealed key envelopes plus a chained control record.
New messenger actions cover the full flow:
authenticateForRecovery(aal2 recovery session),migrateToEnvelope(checkpointed migration),recoverWithRecoverySecret(restore without global password), andresetPasswordWithVaultKeys(set global password after recovery without the old one). State gains persistedenvelope/pendingEnvelopeMigrationand ephemeralrecoverySession, with new error types for aal2, envelope, and recovery conflicts.Existing password paths now prefer opening the password envelope (or detecting envelope status via control records) before the legacy TOPRF key chain:
changePasswordon envelope vaults only updates the password envelope and OPRF key under a metadata lock;syncLatestGlobalPassword,submitGlobalPassword,fetchAllSecretData, andcheckIsPasswordOutdatedfollow the same envelope-first rules. HeavySeedlessOnboardingController.envelope.test.tscoverage accompanies refactored shared test helpers;@metamask/auth-network-utilsis bumped to^0.4.0.Reviewed by Cursor Bugbot for commit 2703265. Bugbot is set up for automated code reviews on this repo. Configure here.