Skip to content

How to test code using this library? #160

@kodzonko

Description

@kodzonko

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions