Unable to resolve module crypto in react-native

Hi
I am trying to follow the below example in react-native, but it gives me an error for crypto. Any suggestion of how to use libp2p in react-native?

example: js-libp2p/index.js at master · libp2p/js-libp2p · GitHub

Error in react-native:

" const crypto = require(‘crypto’)
| ^
Unable to resolve module crypto from …\node_modules\libp2p-crypto\src\hmac\index.js: crypto could not be found within the project"

1 Like

Hi. I have the same issue on my project. How did you resolve this issue? It seems that the js-libp2p needs to be changed to not use node.js packages such as crypto.

Hi
Initially we used a hack which is in our old repo codes but due to speed and other issues (js not being as updated as go) we went with go version and compiling it for different platforms

Cool. Thank you for your reply. Can I ask which transport did you use for your gomobile application? Did you use TCP?