Skip to content

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
@codecov
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 109 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
@FrederikBolding FrederikBolding deleted the fb/native-base64-mobile branch February 18, 2025 12:02
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.

3 participants