react-native-rsa-native icon indicating copy to clipboard operation
react-native-rsa-native copied to clipboard

How to test code using this library?

Open kodzonko opened this issue 2 years ago • 0 comments

generating keys and encryption/decryption seem to work for me in React Native environment but fail when I run these functions in jest unit tests:

import { RSA } from "react-native-rsa-native";

const encrypted = await RSA.encrypt("test", <RSA public key I generated on device>);
const decrypted = await RSA.decrypt(encrypted, <RSA private key I generated on device>);

example error:

Cannot read properties of undefined (reading 'encrypt')

Also generating keys on PC doesn't work (same error - properties of undefined).

How do I test code that involves react-native-rsa-native? Is it even possible or do I need to patch these functions to run on a computer?

kodzonko avatar Sep 01 '23 23:09 kodzonko