-
-
Notifications
You must be signed in to change notification settings - Fork 594
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
Adding .initRustCrypto()
support to Expo (React Native)
#4150
Comments
Sadly, it appears
Will keep digging to see if I can find a workaround. |
Yes, Olm is a C++ library so cannot be loaded without WASM |
@greynewell I haven't yet attempted this myself but what if you connected olm on the native side? https://github.com/jitsi/react-native-olm appears to go down that route. |
I was able to get https://github.com/jitsi/react-native-olm to compile and run. It only includes the Additionally to the above, the library also needs fixes for both platforms to work with recent React Native versions. I put in issues with details upstream. |
Actually, seems like there is a legacy-legacy version of Olm that does not depend on WASM.
https://gitlab.matrix.org/matrix-org/olm/-/blob/master/CHANGELOG.rst#L278-279 |
Confirming that decryption works in React Native without WASM by using |
@Johennes Care to drop a working example? |
I only have this set up in a private app at the moment, unfortunately, and only in PoC form. I'm also not using Expo, so I'm not sure if what I've done transfers easily. But, for what it's worth, here are the steps I took:
There is more work needed to create a crypto store that persists keys and such across app relaunches (the ones that ship with matrix-js-sdk don't work in React Native). But at least, as a puncture, I was able to decrypt events this way. |
Unfortunately, it's unlikely we'll support the Rust crypto library in an environment that doesn't support WASM. [I don't know if building it as a native node module or something might work in future, but that's not likely to happen in the short term.] You might be able to get the legacy library working for now, but we'll be removing it soon (element-hq/element-web#26922). element-hq/element-web#26922 (comment) discusses ways we might be able to improve this in future. |
hi , can you please mention specific version of react-native-quick-crypto which you used. i am also trying to integrate matrix in my react native app. and i am getting error that My RN Version: 0.72.3 |
We probably shouldn't be discussing on a closed issue but for lack of a better place and future reference: 0.6.1 should have That being said, I have since given up on trying to use matrix-js-sdk with React Native as it kept feeling like an uphill battle. There's nothing wrong with matrix-js-sdk. It's just that RN's environment is peculiar enough that trying to use a non-trivial library that wasn't specifically written for RN can be a royal pain in the ****. The further issues I ran into were that https://github.com/matrix-org/matrix-encrypt-attachment doesn't work with RN out of the box and that react-native-quick-crypto has very limited support for I have started an effort to make matrix-rust-sdk available in RN via a turbo module but it's still very far from being usable. |
Howdy! I've been working to enable
initRustCrypto()
inside of Expo:https://github.com/wdym-chat/expo-matrix-js-sdk/issues/5
I was able to sideload WASM support inside React Native using Cawfree's package, but ran into an issue:
cawfree/react-native-webassembly#28
I wanted to ask, has anyone here successfully initialized Rust crypto (or even the legacy crypto) in React Native, and if so, how did you achieve that?
I've been researching this issue pretty hard, and the working solutions out there seem to rely on extremely dated libs/runtimes and to be exclusive of Expo, so any suggestions would be welcomed.
The text was updated successfully, but these errors were encountered: