-
Notifications
You must be signed in to change notification settings - Fork 310
React Native support #7
Comments
Using your ObjectiveC/Java libs for mobile would obviously also be an option, but since my business logic and UI are in JS, wrapping just the crypto primitives instead of the full protocol layer seems to make more sense. |
Neat. I have considered this, well, in part in that my hope was that I could add necessary algorithm support to - https://github.com/PeculiarVentures/node-webcrypto-liner which would enable building a signal implementation on it. In native land, mabe https://github.com/PeculiarVentures/node-webcrypto-ossl could be of use? |
From looking at
Since 2-4 are already async that should be pretty strait forward. Only 1. is currently a sync api and would have to be refactored, as calls through the react native bridge are all async. Wrapping a native cipher suite e.g. openssl could work, but perhaps using iOS and Android platform apis would be cleaner. |
Any progress guys? |
Pinging back as well. I'm also trying to integrate with React Native. Thanks! |
+1 |
It turns out there is already a way to surface the native webcrypto apis to JavaScriptCore using a bridge to the WebKit WebView https://github.com/saulshanabrook/react-native-webview-crypto Perhaps give this a try and see if all api requirments are met. |
@tanx the last time I tried that, I only got as far as exposing the The way I did it was by proxying WebCrypto API calls to a hidden WebView, passing arguments through the React Native Javascript bridge using the If this table is to be believed, both iOS and Android may now return implementation objects. Since this approach didn't work for me, I'm exploring the idea to replace the high level crypto calls with react-native-sodium instead. Hope this helps. |
@jjzazuet Proxying calls to a WebView is clever! It definitely maximizes WebCrypto API compatibility. As an alternative, mostly JS solution, I published isomorphic-webcrypto, which uses the Microsoft Research library for WebCrypto support in React Native. There are a few caveats for React Native:
This could be a place to start if someone wanted to build out a POC. |
OK, think I might have found a way to support this (and a bunch of other cool stuff on RN) via NodeJS-Mobile. This runs node on a bg process on both Android and iOS via Chakra core. Seemingly supporting most / all node. Thoughts? |
@tanx Did you get around to making that change? I'm in a similar position. |
Any progress or solution for this? |
+1 |
Two libraries we produced since this bug was opened: Summary of how 2key-ratchet differs from the standard signal protocol is here https://github.com/PeculiarVentures/2key-ratchet/blob/master/DIFFERENCES.md |
I was able to get this thing working in React Native. This is what I did:
There were other miscellaneous changes I had to make but these were the most important ones. |
Hey, I'm currently investigating using the library in a react native app. The JavaScriptCore runtime on iOS does not surface the WebCrypto apis though, so I'd have to create react native plugins that shim WebCrypto using native crypto primitives. I'm curious if you'd be open to accepting a PR that integrates this use case. Thanks
The text was updated successfully, but these errors were encountered: