margelo / react-native-quick-crypto

⚡️ A fast implementation of Node's `crypto` module written in C/C++ JSI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ERROR Error: Exception in HostFunction: <unknown>, js engine: hermes

rpatidar opened this issue · comments

i am seeing exception

ERROR Error: Exception in HostFunction: , js engine: hermes

i have a hash created with java code but need to verfiy with reat-native
in java we are using SHA256withRSA

exception is coming with below code

    pubKey = `MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAskBomu02R4n6GTY/36+3
    DKQOE2BAL9NR4142LnBsqa5wsDxj7y742aBVxcm0KCeuKq1Tkh/344PHoWiohuHG
    70Q1YSzzRiaCxfeOtDKITWCHOsdCUMvrNESZCy5giFU4DeXPn1YFwKKAmAtAxyRc
    dVb2DyJn4V0aUVP/QvP3JXqL+HN0kj3gqIVmIMalMD0vgo5LI1fJYu/6skaX+SZn
    /suCGDAtTr7i4vx2qnCdMlnYtFbclSrh/h96/q/g0P8VIEZvrZZZUNF32rkVofCS
    YciP/JaS580I8a6kHe61is+gyn/6ugL5ea066u6bIEj80oC202e/qih01pJSceuR
    awIDAQAB`
    
    console.log(base64ToBytes(response.payload))
    verifyResult = rnqc.createVerify("RSA-SHA256").update(base64ToBytes(response.payload)).verify({
      key: base64ToBytes(pubKey),
      //padding: rnqc.constants.RSA_PKCS1_PADDING,
      //saltLength: 32,
    }, base64ToBytes(response.signature))

I am also facing the same error

 ERROR  Error: Exception in HostFunction: <unknown>, js engine: hermes
 ERROR  Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., js engine: hermes

I am also facing the same error

 ERROR  Error: Exception in HostFunction: <unknown>, js engine: hermes
 ERROR  Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., js engine: hermes

Hi have you got the fix, I am also facing this issue.

I have the same issue.

This in my code.
export const encryptData = async (data) => { try { const publicKeyRF = await RNFS.readFile(publicKeyFilePath, "utf8"); const bufferVal = Buffer.from(data, "utf8") const dataEncryp = Crypto.publicEncrypt( { key: publicKeyRF, padding: Crypto.constants.RSA_PKCS1_PADDING, }, bufferVal ).toString("base64"); return dataEncryp; } catch (error) { console.log("Error") console.log(error) return null; } };

The console show this error:
[Error: Exception in HostFunction: ]

i don't remember how i actually fixed this worked for me.


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


    const publicKey = `-----BEGIN PUBLIC KEY-----
    YourPubKey
    -----END PUBLIC KEY-----`;
    const valid = await RSA.verifyWithAlgorithm(
      signedPayload.signature,
      signedPayload.payload,
      publicKey,
      RSA.SHA256withRSA
    );

I am also facing the same error

 ERROR  Error: Exception in HostFunction: <unknown>, js engine: hermes
 ERROR  Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., js engine: hermes

Hi have you got the fix, I am also facing this issue.

I encountered a similar issue, which turned out to be related to a package problem specifically with react-native-reanimated. For troubleshooting steps, you can refer to: https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting/#failed-to-create-a-worklet

I got the same error and was able to resolve it. The error was with react-native-reanimated.

Follow the installation section on this link - https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started/#step-2-add-reanimateds-babel-plugin

Step 1: Install the package
Install react-native-reanimated package from npm:

EXPO
NPM
YARN
npx expo install react-native-reanimated

Step 2: Add Reanimated's babel plugin
Add react-native-reanimated/plugin plugin to your babel.config.js.

module.exports = {
presets: [
... // don't add it here :)
],
plugins: [
...
'react-native-reanimated/plugin',
],
};

CAUTION
react-native-reanimated/plugin has to be listed last.

Why do I need this?

Step 3: Clear Metro bundler cache (recommended)
EXPO
NPM
YARN
npx expo start -c

I also had this error which seemed to be a result of being on expo 50 and react-native-reanimated 3.8.1. I was able to resolve it by downgrading to react-native-reanimated 3.6.3 and was then able to open and run my app on Expo Go

Thank you @sethfriman this works...