amitaymolko / react-native-rsa-native

A native implementation of RSA key generation and encryption/decryption.
MIT License
232 stars 112 forks source link

RSA is null when running on Expo #116

Closed gabriel-ayusso closed 2 years ago

gabriel-ayusso commented 2 years ago

Hi,

There are any reason to RSA being null when using Expo + Expo Go to run RN modules on this?

I'm trying the following code:

import RNRSA, { RSA, RSAKeychain } from 'react-native-rsa-native';

// code

const crypto = () => {
    console.log('>>>>> debug', RNRSA, RSA, RSAKeychain)
}

// more code... 

The result of this is >>>>> debug null null null, so I can't use RSA library.

[EDIT] I've also tried the following too:

import * as RSA from 'react-native-rsa-native';

// code

const crypto = () => {
    console.log('>>>>> debug', RSA)
}

// more code... 

With gave me the following:

>>>>> debug Object {
  "RNRSA": null,
  "RNRSAKeychain": null,
  "RSA": null,
  "RSAKeychain": null,
  "default": null,
}

Thanks in advance!

dalloglio commented 2 years ago

I'm also going through this situation. Does anyone know what's going on and can help?

gabriel-ayusso commented 2 years ago

I'm also going through this situation. Does anyone know what's going on and can help?

Hi @dalloglio, I`m getting some luck with hybrid-crypto-js. But after all, it does not match with my encryption, and I not be able to decrypt. So... I'm keep searching meanwhile I develop other features...

Please, let me know if you have some news too... I'm considering to use expo crypto instead, but in that case I'll need to rewrite all from scratch (and I'm not sure if I'll have this amount of time)

Thank you in advance

thebenlamm commented 2 years ago

Possible duplicate of https://github.com/amitaymolko/react-native-rsa-native/issues/83

Looks like this library just doesn't work with Expo

dalloglio commented 2 years ago

I'm also going through this situation. Does anyone know what's going on and can help?

Hi @dalloglio, I`m getting some luck with hybrid-crypto-js. But after all, it does not match with my encryption, and I not be able to decrypt. So... I'm keep searching meanwhile I develop other features...

Please, let me know if you have some news too... I'm considering to use expo crypto instead, but in that case I'll need to rewrite all from scratch (and I'm not sure if I'll have this amount of time)

Thank you in advance

@gabriel-ayusso I tested this library hybrid-crypto-js and it didn't work either. I kept searching and luckily found this library pagarme-card-hash which is compatible with applications written using expo and react-native. My big problem was with applications with managed workflow. So, this library solved my problem. Hope this can help you too.