alpha0010 / react-native-file-access

Filesystem access for React Native
MIT License
307 stars 19 forks source link

Crypto-js not working with writeFile? #11

Closed Nabeel20 closed 3 years ago

Nabeel20 commented 3 years ago

I am trying to use AES encryption with a text, decryption the text is ok but I got an error when trying to write text to file.

let encryptedAES = CryptoJS.AES.encrypt("Message", "My Secret Passphrase").toString();

I pass encryptedAES to writeFile but it fails. Any help?

alpha0010 commented 3 years ago

I just published 1.1.0 which supports base 64 encoded strings. React Native sometimes has errors when passing binary strings, so that may fix your issue.

If that still does not work, could you post the error message and a code snippet with the APIs you are using from this library?

Nabeel20 commented 3 years ago

Thank you for base64, and I think it its a problem with crypto-js "4.0.0" so I downgrade to version 3.3.0 and now AES encryption works fine!