Uh oh!
There was an error while loading. Please reload this page.
feat: reduce KDF computing cost on clients - #6097
Conversation
mathieuartu
commented
Jul 10, 2025
@metamaskbot publish-preview |
mathieuartu
commented
Jul 10, 2025
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
mirceanis
left a comment
There was a problem hiding this comment.
Looks good!
Perhaps we can rephrase the changelog to reenforce the reason for this change.
Since this PR deals with encryption "soft" migration I'd take the opportunity to make sure that future "hard" migrations fail gracefully, meaning that clients don't fail entire operations if one of the entries does not decrypt. See lines like if (encryptedData.v === '1').... else throw.
WDYT @mathieuartu ?
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
mathieuartu
commented
Jul 16, 2025
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
Uh oh!
There was an error while loading. Please reload this page.
159efb2 to
ffa6d7aComparemathieuartu
commented
Jul 17, 2025
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
mathieuartu
commented
Jul 18, 2025
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
mathieuartu
commented
Jul 18, 2025
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
mathieuartu
commented
Jul 22, 2025
Going back to draft again as it seems to be working fine now but may have introduced a UI bug on mobile when adding or renaming accounts. Investigating. |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Explanation
Nscryptparameter used to compute the encryption key in order to significantly increase performance on clients.The tests below have been done measuring 30 consecutive clean onboardings and the time it took to encrypt or decrypt the first entry (before caching the key from the KDF)
References
Fixes:
Test drive client PRs:
Changelog
Checklist
Note
Lowers scrypt N and introduces a new shared salt with auto-migration, adds encrypt/decrypt callbacks, updates caching/derivation logic, and refreshes tests and changelog.
SCRYPT_N_V2 = 2) and introduceSHARED_SALT_V2.doesEntryNeedReEncryptionand auto-migrate entries encrypted with old salt or oldN.onEncrypt/onDecrypt) and fire them with payload metadata.sha2import.getItem,getAllFeatureItems,setItem,batchSetItems.EncryptedPayload), constants/plumbing adjustments.config.encryption.onEncrypt/onDecryptand forward to SDK in all storage operations.N/salt, and caching behavior; update CHANGELOG under Unreleased.Written by Cursor Bugbot for commit b5439f2. This will update automatically on new commits. Configure here.