react-native-aes-lite
v2.0.6
Published
Ultra-lightweight AES-CBC encryption for React Native, Expo and Web (Hermes-safe, zero native deps)
Maintainers
Readme
🚀 react-native-aes-lite
Ultra-lightweight AES-CBC encryption for React Native, Expo & Web. Hermes-safe. Zero native modules. TypeScript-ready.
✨ Features
- 🔐 AES-128 / AES-192 / AES-256
- 🧬 CBC mode with PKCS7 padding
- 🔑 Hex & ASCII key support
- 🌍 Works on Android / iOS / Web
- ⚡ Tiny bundle size (~6KB)
- 🧩 Zero dependencies
- 🛡 TypeScript support
📦 Installation
npm install react-native-aes-liteor
yarn add react-native-aes-lite🔐 Usage
import { AES, generateKey } from "react-native-aes-lite";
const aes = new AES();
const key = generateKey("hex", 32); // AES-256
const encrypted = aes.encrypt("hello world", key);
const decrypted = aes.decrypt(encrypted, key);
console.log(encrypted);
console.log(decrypted);🔑 Key Generation
generateKey("hex", 16); // AES-128
generateKey("hex", 24); // AES-192
generateKey("hex", 32); // AES-256
generateKey("ascii", 16);AES Level ASCII Length Hex Length
AES-128 16 chars 32 chars AES-192 24 chars 48 chars AES-256 32 chars 64 chars
📊 Benchmarks (Hermes Android - Pixel 6)
Payload Encrypt Decrypt
32B ~0.18ms ~0.17ms 128B ~0.42ms ~0.40ms 1KB ~2.9ms ~2.8ms
🗺 Roadmap
- AES-GCM mode
- HMAC-SHA256
- Streaming encryption
- Secure RNG polyfill
- ESM optimized build
⚠ Security Notice
Fallback RNG uses Math.random() when crypto.getRandomValues is unavailable. Not suitable for military-grade or financial-grade cryptography.
📜 License
MIT © 2026
