Quick Start
Getting started with React Native Quick Crypto
Introduction
React Native Quick Crypto (also known as RNQC) is the fastest, next-generation cryptography library for React Native. It is designed to be a drop-in replacement for all other React Native crypto libraries and is inspired by the Node.js crypto module, powered by a high-performance C++ JSI binding that executes directly on the native thread.
High Performance
Up to 100x faster than standard native bridges using JSI.
Node.js Compatible
A complete implementation of the standard Node.js crypto API.
Secure by Design
Operations run on a dedicated thread pool to keep the UI smooth.
Nitro Powered
Built on Nitro Modules for zero-overhead native communication.
Deep Dive
Want to understand the architecture? Read our in-depth guide: What is RNQC?
Terminology
Before we proceed, a few key concepts:
- JSI (JavaScript Interface): A direct C++ interface to the JS runtime, bypassing the slow React Native Bridge.
- Native Thread: The thread where C++ code executes. We offload heavy crypto work here to prevent UI freezes.
- Polyfill: We provide a seamless global
cryptoobject, just like in a browser or Node.js environment.
Architecture At a Glance
RNQC is unique because it uses a Hybrid Object model. It lives on both the Javascript thread and the Native thread simultaneously.
Automatic Installation
Follow these steps to integrate Quick Crypto into your React Native project.
Install the Package
Add the dependency using your preferred package manager.
npm install react-native-quick-crypto react-native-nitro-modulesyarn add react-native-quick-crypto react-native-nitro-modulespnpm add react-native-quick-crypto react-native-nitro-modulesbun add react-native-quick-crypto react-native-nitro-modulesiOS Setup (Cocoapods)
If you are developing for iOS, navigate to your ios directory and install the pods.
cd ios && pod installRebuild the App
Since this library includes native C++ code, you must rebuild your native binary.
npx react-native run-androidnpx react-native run-iosDon't forget: You cannot use this library with Expo Go. You must use a Development Build or straight React Native.
Create your first cryptographic operation
Once installed, usage is straightforward. The API mirrors Node.js exactly.
import React, { useEffect } from 'react';
import QuickCrypto from 'react-native-quick-crypto';
// Polyfill global.crypto for full compatibility
QuickCrypto.install();
export default function App() {
useEffect(() => {
// Standard Node.js API (SHA-256)
const hash = QuickCrypto.createHash('sha256')
.update('Hello World')
.digest('hex');
console.log('SHA-256:', hash);
// High-Performance Random Bytes (Native JSI)
const randomBuffer = QuickCrypto.randomBytes(16);
console.log('Random:', randomBuffer.toString('hex'));
// Next-Gen Algorithms (BLAKE3)
const b3Hash = QuickCrypto.blake3('Fastest Hash', { dkLen: 32 });
console.log('BLAKE3:', Buffer.from(b3Hash).toString('hex'));
}, []);
return null;
}Why Polyfill?
React Native does not provide a native crypto implementation or a global Buffer environment.
Calling QuickCrypto.install() injects our high-performance C++ bindings into global.crypto and global.Buffer. This is essential because many popular libraries (like ethers, jsonwebtoken, or viem) rely on these Node.js standard APIs to function correctly.
For Expo Users
Quick Crypto includes a Config Plugin for Expo.
Add the plugin to your app.json or app.config.js:
{
"expo": {
"plugins": [
["react-native-quick-crypto", { "sodiumEnabled": true }] // Optional configuration
]
}
}Then rebuild your development client:
npx expo prebuild
npx expo run:iosFAQ
Does this work with Expo Go?
No. Expo Go does not support custom native modules. You must use a Custom Development Client (CNG) or npx expo prebuild.
Is it faster than react-native-crypto?
react-native-crypto?Yes, significantly. We use direct C++ JSI bindings instead of the React Native Bridge, which eliminates serialization overhead.
Learn More
New here? Don't worry, we welcome your questions.
If you find anything confusing or have suggestions, please give your feedback on our GitHub Discussions.