Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider using react-native-quick-crypto #1680

Open
mrousavy opened this issue Oct 6, 2022 · 4 comments
Open

Consider using react-native-quick-crypto #1680

mrousavy opened this issue Oct 6, 2022 · 4 comments
Labels
enhancement New feature or request feature request good first issue Good for newcomers

Comments

@mrousavy
Copy link

mrousavy commented Oct 6, 2022

Hey!

I noticed this repo uses react-native-crypto, which itself uses crypto-browserify under the hood. crypto-browserify is a JS-based implementation for crypto, which is slower than Margelo's react-native-quick-crypto, since that uses C++ (OpenSSL) with JSI under the hood.

If you want to replace react-native-crypto with the faster react-native-quick-crypto, I'm happy to help out or answer questions! 😄

@loatheb loatheb added enhancement New feature or request good first issue Good for newcomers labels Oct 6, 2022
@loatheb
Copy link
Contributor

loatheb commented Oct 6, 2022

Hi @mrousavy

Thanks for your suggestion, our project is a fully cross platform project with web and browser extension in addition to ios/android, this is a very critical reason why we didn't choose the native crypto library before like react-native-quick-crypto.

If using react-native-quick-crypto. It is necessary to encapsulate different functions executed for different platforms in some crypto-related function. This is a very troublesome workload, which may affect our sprint, so we have temporarily selected a library that is relatively unified across platforms and used by many wallets, but as a direction for performance optimization in the future, we will consider this native library.

@sunnylqm
Copy link

sunnylqm commented Oct 6, 2022

Hi @mrousavy nice to see you here. We do have an interest in but with some concerns. Libraries like react-native-quick-crypto, @craftzdog/react-native-buffer, react-native-quick-base64, react-native-bignumber are quite new and not battle-tested like the pure js counterparts. I've seen some issues like craftzdog/react-native-quick-base64#3 margelo/react-native-bignumber#55 , which showed some inconsistency and prevented us to adopt. So I think the first priority to promote is to have test suites to make sure the new implementations are 100% compatible with the classic ones.

@mrousavy
Copy link
Author

mrousavy commented Oct 6, 2022

Hey @loatheb!

Thanks for your suggestion, our project is a fully cross platform project with web and browser extension in addition to ios/android, this is a very critical reason why we didn't choose the native crypto library before like react-native-quick-crypto.

react-native-quick-crypto automatically falls back to react-native-crypto (aka crypto-browserify) if a native function isn't available (which is the case on web). :)


Hi @sunnylqm! 👋

For react-native-bignumber, we used the same tests as for BN.js. Apparently this specific case isn't covered by the BN.js tests?

We can take a closer look at that issue soon. We'd appreciate any feedback, e.g. if you notice similar issues or inconsistencies

As for battletesting/security, react-native-bignumber and react-native-quick-crypto both use OpenSSL under the hood. OpenSSL is pretty established 😅

@stackia
Copy link

stackia commented Aug 16, 2023

2023 update: react-native-quick-crypto is now becoming much more popular and widely adopted now, and both react-native-crypto & crypto-browserify have abandoned maintenance.

We should definitely reconsider this suggestion. Especially, we are having a hard time dealing with performance issues now...

cc @huhuanming @loatheb @sidmorizon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants