๐ฆ react-native-aes-lite
$3
Hermes-Safe โข Expo-Ready โข Pure JavaScript โข Zero Native Modules

!platforms
!typescript
!bundle size
!license
react-native-aes-lite is a pure JavaScript AES-CBC encryption library made specifically for React Native.
It works on:
- Hermes (Android & iOS)
- Expo (managed + bare)
- React Native CLI
- Web
- Expo Snack (supported)
No native modules.
Zero dependencies.
Perfect for lightweight secure storage and payload obfuscation.
โจ Features
| Feature | Status |
|--------|--------|
| ๐ AES-128 / AES-192 / AES-256 | โ
|
| ๐งฌ CBC mode w/ PKCS7 padding | โ
|
| ๐ Hex or ASCII key support | โ
|
| ๐ฅ Hermes-safe UTF-8 encode/decode | โ
|
| ๐ Android / iOS / Web support | โ
|
| ๐ซ No native modules required | โ
|
| ๐ฆ ~6KB bundle size | โ
|
| ๐ Includes generateKey() helper | โ
|
| ๐งช Works inside Expo Snack | โ
|
๐ฆ Installation
npm install react-native-aes-lite
or
yarn add react-native-aes-lite
๐ Key Generation
``
js
import { generateKey } from "react-native-aes-lite";
const key = generateKey("hex", { length: 32 });
`
$3
| AES | ASCII | Hex |
|-----|--------|------|
| AES-128 | 16 chars | 32 hex |
| AES-192 | 24 chars | 48 hex |
| AES-256 | 32 chars | 64 hex |๐ Encrypt / Decrypt Example
`
js
import { AES, generateKey } from "react-native-aes-lite";
const aes = new AES();
const key = generateKey("hex", { length: 32 });
const encrypted = aes.encrypt("hello sreeraj", key);
const decrypted = aes.decrypt(encrypted, key);
console.log(encrypted, decrypted);
`
Example output:
`
Encrypted: :
Decrypted: hello sreeraj
``
๐ง API Reference
$3
- encrypt(text, key)
- decrypt(payload, key)
$3
Formats: hex, base64, ascii
โ Security Notes
- Hermes fallback RNG is not cryptographically secure.
- Not suitable for banking/military-level encryption.
- Safe for lightweight local data protection.
๐ Benchmarks (Hermes โ Pixel 6)
| Payload | Encrypt | Decrypt |
|---------|---------|---------|
| 32 bytes | ~0.18 ms | ~0.17 ms |
| 128 bytes | ~0.42 ms | ~0.40 ms |
| 1 KB | ~2.9 ms | ~2.8 ms |
| 10 KB | ~29 ms | ~28 ms |
๐บ Roadmap
- AES-GCM mode
- HMAC-SHA256
- Streaming encryption
- TypeScript typings
- ESM build
- Secure RNG polyfill for Hermes
๐ค Contributing
PRs welcome. city0666@gmail.com
Support
#### IF you need suggestion and support regarding this package
https://github.com/city0666
๐ License
MIT ยฉ 2025 Ammachi