Skip to content

Conversation

dmitrizagidulin
Copy link
Contributor

Add support for React Native (RN-specific support for TextEncoder, crypto).
Shouldn't affect any existing code.

@davidlehn
Copy link
Member

How can this be tested? Some sort of test like what is done with karma should be added so we know this works and regressions are caught over time.

@dmitrizagidulin
Copy link
Contributor Author

@dlongley @davidlehn - I updated this PR with what we discussed (moved the TextEncoder and crypto dependencies to an external polyfill library, leaving just the package.json "react-native" mapping section).

Copy link
Member

@dlongley dlongley left a comment

Choose a reason for hiding this comment

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

LGTM -- @davidlehn?

Copy link
Member

@davidlehn davidlehn left a comment

Choose a reason for hiding this comment

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

This looks like a fairly simple solution, thanks. I hope externalizing the fixes is ok from a user perspective. I do still have a concern about how to test this. I'm guessing that would add quite a bit of complexity if done here. Is it tested somewhere else indirectly?

@dmitrizagidulin
Copy link
Contributor Author

This looks like a fairly simple solution, thanks. I hope externalizing the fixes is ok from a user perspective. I do still have a concern about how to test this. I'm guessing that would add quite a bit of complexity if done here. Is it tested somewhere else indirectly?

Yeah, there's no easy way to test it here in this lib. If it's any comfort, it'll be constantly tested downstream, in the DCC mobile wallet.

@davidlehn
Copy link
Member

In practice will people be able to determine the polyfill requirement? If someone installs a higher up lib/app that indirectly uses rdf-canonize, and they see related missing polyfill problems, will it be obvious to look at the README here to find the solution? Does it fail at runtime or in a pre-processing step?

I think there was talk of having code somewhere to throw errors if the required APIs were missing. Ideally would like to avoid that since it adds bloat that will never be used in properly setup app.

@dmitrizagidulin
Copy link
Contributor Author

In practice will people be able to determine the polyfill requirement? If someone installs a higher up lib/app that indirectly uses rdf-canonize, and they see related missing polyfill problems, will it be obvious to look at the README here to find the solution? Does it fail at runtime or in a pre-processing step?

I think there was talk of having code somewhere to throw errors if the required APIs were missing. Ideally would like to avoid that since it adds bloat that will never be used in properly setup app.

Agreed, yeah (and in any case, we can handle that question in a separate PR). My strategy is -- I'm going to add these usage examples in downstream libraries (the VC lib etc), which is the most likely place devs will encounter this lib.

@dmitrizagidulin
Copy link
Contributor Author

@davidlehn Sounds like comments have been addressed, can we merge this? (into the 3.4.0 branch?)

@davidlehn
Copy link
Member

Manually fixed conflict and merged. Thanks.

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