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

RSA.verify null is not an object

Open cretumarius opened this issue 5 years ago • 6 comments

Possible Unhandled Promise Rejection (id: 0): TypeError: null is not an object (evaluating '_reactNativeRsaNative.RSA.verify')

I'm trying to verify with publicKey if a signature signed with privateKey is trusted. The signature is RSA PKCS#1v1.5 SHA 256. RSA.verify(signature, payload, publicKey).then( ... ) This should be correct regarding documentation.

Thanks in advance.

cretumarius avatar Jun 08 '20 17:06 cretumarius

@crafterm any solution ?

akiladevinda avatar Oct 02 '20 12:10 akiladevinda

same problem with RSA.decode

aalhitennf avatar Jul 14 '21 21:07 aalhitennf

i ditched expo and recreated my project with react native cli. problem gone.

aalhitennf avatar Jul 16 '21 08:07 aalhitennf

Not sure but I think the README documentation and the actual library are different:

export function verify(data: string, secretToVerify: string, key: string): Promise<boolean>;

vs what is in the README

static verify(signature : string, message : string, keyTag : string) : Promise<boolean>

Given this and my little knowledge on how to verify signatures, I am confused on how to make it work as it says in the documentation since the actual library differs from the params that you're supposed to send.

johhansantana avatar Jul 22 '21 16:07 johhansantana

itched expo and recreated my project with react native cli. problem gone.

Yes, for me too. The problem I find is with the random byte generation in expo. The vast majority of libraries do not support applications using Expo.

dalloglio avatar Sep 02 '21 18:09 dalloglio

For my specific problem, the solution was this library: pagarme-card-hash. No more problems with RSA.

dalloglio avatar Sep 02 '21 18:09 dalloglio