Node-rsa isn't working in react native. But, I've to use it for decryption in Mobile application

1.4k Views Asked by At

So, I'm developing a project which needs a website to generate the qr code with encryption and qr code scanner mobile application to scan and decrypt the qr code.

I've used node-rsa for encryption in react website. I've added a feature in site to scan and decrypt the qr code. There it is working fine.

But, when I tried to use node-rsa in react-native application. It's giving error for constants, crypto, nodeRsa().

I was trying to decrypt the qr code private key that was generated by node-rsa in my react client website.

Can someone help me with my problem?? Thanks in advance!

I've Used this to install node-rsa

npm install node-rsa --save

This error is I'm getting in React-native

1

There are 1 best solutions below

0
Pranay Agarwal On

sorry if I'm a bit late to this question.

The node-rsa library seems to use the crypto library under the hood. With NodeJS, crypto comes installed by default, but with React-Native that is not the case.

Here's the link to a similar issue. The problem seems to be with react-native rather than node-rsa. The devs suggest pulling in crypto as a dependency for your project.

https://github.com/facebook/react-native/issues/9427