strophe / strophejs

Strophe.js is an XMPP library for JavaScript

Home Page:http://strophe.im/strophejs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

strophe > 1.5.0 no longer works in React Native

saghul opened this issue · comments

(following from #465 (comment))

With the SCRAM refactor and Strophe now relying on the WebCrypto API, there is no good path for RN. All the polyfills seem unmaintained or downright sketchy (like proxying calls through a WebView).

IMHO having fallback implementations as previously would be desirable for environments without the WebCrypto API available.

To follow

It doesn't look feasible to me to go back to a state where we don't use WebCrypto.

We now support SASL SCRAM with SHA-256, SHA-384 and SHA-512 and for these we need WebCrypto.

Previously Strophe included its own implementation of SHA-1, but we don't have implementations for the other hashing algorithms and its not desirable to have to maintain our own versions of them only for React Native support.

Looks like this is an issue in Matrix-land as well:
matrix-org/matrix-js-sdk#2789

Ultimately, I think if you want to continue using newer versions of Strophe on React Native, you'll have to hold your nose and choose a 3rd party library.

For example either https://github.com/webview-crypto/react-native-webview-crypto or https://github.com/crypto-browserify/crypto-browserify

The webview hack from react-native-webview-crypto isn't pretty, but it works and is for example used by GUN, which is a large project. https://github.com/amark/gun

Well, that's disappointing. Yes there is support for new stuff now, but backwards compatibility was broken with no major version bump.

I think the only option would be to create a WebCrypto polyfill using https://github.com/margelo/react-native-quick-crypto but that is not something that can be done easily or quickly.

backwards compatibility was broken with no major version bump

Yes, sorry about that. We didn't know that this was backwards incompatible with React Native when the release was made.