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

Fix Custom Content Type Decryption #209

Merged
merged 1 commit into from
Jan 11, 2024

Conversation

nplasterer
Copy link
Contributor

  • Adds content to the json blob return from android
  • Converts base64 string (which is required since we cant base arrays across the native bridge) back to byte array

To pass data from native iOS and Android to RN we parse the information into json strings. To make Android match iOS we have to hand roll a lot of this. Because our test wasn't thorough I missed the content field in the json blob initially. We also missed the step to convert the base64 back into bytes after coming across the wire.

@nplasterer nplasterer self-assigned this Jan 11, 2024
@nplasterer nplasterer requested a review from a team as a code owner January 11, 2024 03:40
Copy link
Contributor

@cameronvoell cameronvoell left a comment

Choose a reason for hiding this comment

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

Worked for me, nice fix!

The buffer package is pretty lightweight and well-supported so there shouldn't be any issues adding it to the rn sdk.

As a minor size improvement, we may be able to replace the 'buffer' dependency with base64-js which is a dependency in buffer that is used for base64 decoding(link) and has its own method for converting from base64 string to byte array.

An alternative would be react-native-quick-base64 if we ever want to aim for performance improvements, say if decoding large files in custom content is every a thing, but that package is less popular.

I think a good path would be to merge with the buffer dependency to get this working and evaluate less popular alternatives as potential improvements 👍

@cameronvoell cameronvoell merged commit d5ac040 into main Jan 11, 2024
4 of 5 checks passed
@cameronvoell cameronvoell deleted the np/fix-custom-content-type-bug branch January 11, 2024 06:29
Copy link
Contributor

🎉 This PR is included in version 1.23.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants