remove device share web crypto - #1109
Open
Ethella wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the legacy “device share” WebCrypto-based caching flow from the Magic SDK provider, and introduces a lightweight cleanup path to delete any leftover device-share artifacts from older SDK versions.
Changes:
- Removes
deviceSharefrom message/request types and from theViewControllerrequest/response flow. - Deletes the legacy
device-share-web-cryptoutility (and related tests) and removesnetworkHashplumbing previously used for per-network device-share caching. - Adds
device-share-cleanupand invokes cleanup from SDK initialization (and keeps logout cleanup viaUserModule).
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/@magic-sdk/types/src/core/message-types.ts | Removes deviceShare from cross-window message request/response typings. |
| packages/@magic-sdk/provider/test/spec/util/device-share-web-crypto.spec.ts | Removes tests for the deleted legacy WebCrypto device-share utilities. |
| packages/@magic-sdk/provider/test/spec/core/view-controller/post.spec.ts | Removes device-share-related post behavior tests and stubbing. |
| packages/@magic-sdk/provider/test/spec/core/sdk/constructor.spec.ts | Removes assertion tied to the removed networkHash behavior. |
| packages/@magic-sdk/provider/test/factories.ts | Updates test ViewController factory to match the new constructor signature (no networkHash). |
| packages/@magic-sdk/provider/test/constants.ts | Removes TEST_NETWORK_HASH constant that supported the removed device-share cache flow. |
| packages/@magic-sdk/provider/src/util/view-controller-utils.ts | Removes deviceShare from the standardized request shape. |
| packages/@magic-sdk/provider/src/util/device-share-web-crypto.ts | Deletes legacy encrypt/decrypt/persist device-share WebCrypto implementation. |
| packages/@magic-sdk/provider/src/util/device-share-cleanup.ts | Adds legacy-storage cleanup to remove ds_*, ek, and iv keys. |
| packages/@magic-sdk/provider/src/modules/user.ts | Redirects logout cleanup import to the new cleanup utility. |
| packages/@magic-sdk/provider/src/core/view-controller.ts | Removes device-share send/receive/persist logic and networkHash plumbing. |
| packages/@magic-sdk/provider/src/core/sdk.ts | Calls device-share cleanup during SDK initialization; updates overlay controller construction signature. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+13
to
+22
| export async function clearDeviceShares() { | ||
| const keysToRemove: string[] = [ENCRYPTION_KEY_KEY, INITIALIZATION_VECTOR_KEY]; | ||
| await iterate((value, key) => { | ||
| if (key.startsWith(`${DEVICE_SHARE_KEY}_`)) { | ||
| keysToRemove.push(key); | ||
| } | ||
| }); | ||
| for (const key of keysToRemove) { | ||
| await removeItem(key); | ||
| } |
joshuascan
approved these changes
Aug 11, 2026
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.
📦 Pull Request
[Provide a general summary of the pull request here.]
✅ Fixed Issues
🚨 Test instructions
[Describe any additional context required to test the PR/feature/bug fix.]
Please 🚨 ONLY ADD ONE 🚨 of the following labels, failing to do so may lead to adverse versioning of your changes when published:
patch: Bug Fix?minor: New Feature?major: Breaking Change?skip-release: It's unnecessary to publish this change.Special Note
Please avoid adding any of the
Prioritylabels as they conflict with the labels above ☝️