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

refactor: profile-sync-sdk move snap methods to snap auth class #4708

Merged
merged 4 commits into from
Sep 16, 2024

Conversation

Prithpal-Sooriya
Copy link
Contributor

@Prithpal-Sooriya Prithpal-Sooriya commented Sep 16, 2024

Explanation

This is so we can keep some separation of concerns and prevent SIWE auth SDK from using these public snap methods.

References

Changelog

@metamask/profile-sync-controller

  • ADDED: assertSRP private method to ensure that only SRP auth can call the snap methods.
  • CHANGED: Moved the snap methods: isSnapConnected and connectSnap to the Snap Auth SDK.
  • REMOVED: getSnap exported method

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate

@Prithpal-Sooriya Prithpal-Sooriya added the team-notifications Notification Team changes. https://github.com/orgs/MetaMask/teams/notifications label Sep 16, 2024
@Prithpal-Sooriya Prithpal-Sooriya requested a review from a team as a code owner September 16, 2024 15:04
}
const res = await connectSnap(provider);
return res;
this.#assertSRP(this.#type, this.#sdk);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensures that we keep some separation of concerns between SIWE Auth and SRP Auth classes.
We do not want SIWE AuthType from calling these snap methods.

Copy link
Contributor

@matteoscurati matteoscurati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Prithpal-Sooriya Prithpal-Sooriya merged commit 29e75c3 into main Sep 16, 2024
116 checks passed
@Prithpal-Sooriya Prithpal-Sooriya deleted the notify/clean-up-sdk-connect-snap branch September 16, 2024 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-notifications Notification Team changes. https://github.com/orgs/MetaMask/teams/notifications
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants