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

feat: Allow passing btoa for mobile execution service #2923

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

FrederikBolding
Copy link
Member

@FrederikBolding FrederikBolding commented Dec 3, 2024

Allow passing in a btoa (base64 encoding) function to the mobile execution service. This lets us use native code for the encoding on mobile. We use base64 encoding to prevent XSS due to the weird nature of how React Native WebView postMessage works, but currently do not use a native implementation for base64. This is mostly problematic for larger messages, such as the executeSnap payload, that end up taking over half a second for some example Snaps. This problem would only grow for larger Snaps. We already use react-native-quick-base64 for other purposes in mobile, so dropping it into Snaps will be quite simple.

Old approach:
Base64 encoding took 523 ms

New approach
Base64 encoding took 1 ms

Progresses #2910

@FrederikBolding FrederikBolding force-pushed the fb/native-base64-mobile branch from c007855 to ae074db Compare December 3, 2024 12:30
Copy link

codecov bot commented Dec 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.48%. Comparing base (c66e562) to head (ae074db).
Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2923   +/-   ##
=======================================
  Coverage   94.48%   94.48%           
=======================================
  Files         487      487           
  Lines       10428    10432    +4     
  Branches     1598     1599    +1     
=======================================
+ Hits         9853     9857    +4     
  Misses        575      575           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@FrederikBolding FrederikBolding marked this pull request as ready for review December 3, 2024 13:50
@FrederikBolding FrederikBolding requested a review from a team as a code owner December 3, 2024 13:50
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.

2 participants