Skip to content
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

Cache encryption keys for improved manageState performance #2315

Closed
FrederikBolding opened this issue Apr 8, 2024 · 1 comment · Fixed by #2316
Closed

Cache encryption keys for improved manageState performance #2315

FrederikBolding opened this issue Apr 8, 2024 · 1 comment · Fixed by #2316
Assignees

Comments

@FrederikBolding
Copy link
Member

No description provided.

@Montoya
Copy link
Collaborator

Montoya commented Apr 8, 2024

this rules! wish we had done this sooner

FrederikBolding added a commit that referenced this issue Apr 10, 2024
This PR is a refactor of the Snap state encryption logic, it moves the
logic from the manageState RPC method implementation to the
SnapController. It re-implements the encryption/decryption logic using a
different set of methods, as the previously used implementation had
encapsulated the encryption key. With this refactor it is now possible
to cache the encryption key used by the Snap in the runtime, making
continuous requests to update the state much faster (numbers TBD).

With this refactor it is now the responsibility of the SnapController to
manage encrypting/decrypting the Snap state and thus the method hooks
`getSnapState` and `updateSnapState` have had breaking changes, they are
now asynchronous and expected to fully handle encryption/decryption.
Because of that, this change required changes to both snaps-jest and
snaps-simulator for compatibility.

This will not work as-is on mobile, since the encryptor on mobile does
not have feature parity with `browser-passworder`. This will need to be
addressed before we can use this change on mobile.

Closes #2315

---------

Co-authored-by: Maarten Zuidhoorn <maarten@zuidhoorn.com>
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 a pull request may close this issue.

2 participants