Skip to content

Conversation

@GuillaumeRx
Copy link
Contributor

[WORK IN PROGRESS]

This PR adds the use of StorageService to store the Snap source codes. Due to this storage being async, the SnapController initialization is now async and the preinstalled snaps setup now lives in init()

@socket-security
Copy link

socket-security bot commented Dec 16, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​metamask/​storage-service@​0.0.1751009989100

View full report

Comment on lines 4678 to 4682
const { result } = await this.messenger.call(
'StorageService:getItem',
this.name,
snapId,
);
Copy link
Member

Choose a reason for hiding this comment

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

In case we want to add other properties in the future, should this be an object containing sourceCode?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about this and it's in my list of improvements. I wanted to validate the approach first :)

* @returns The source code for the snap.
*/
async #getSourceCode(snapId: SnapId) {
const { result } = await this.messenger.call(
Copy link
Member

Choose a reason for hiding this comment

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

Can the usage of the StorageService throw?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not for getItem

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 this pull request may close these issues.

4 participants