npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-aes-lite

v1.0.9

Published

AES encryption for React Native + Expo Web

Readme

📦 react-native-aes-lite

npm version platforms license typescript

Lightweight AES encryption/decryption utility for React Native and Expo. No native modules, no linking — just pure JavaScript.


📖 Overview

react-native-aes-lite provides simple AES block-based text encryption and decryption using a 128-bit key. It is ideal for app-side data scrambling, offline encoding, demos, and educational use.

✔ Encrypt text → hex
✔ Decrypt hex → text
✔ Generate AES keys
✔ Works offline
✔ No native dependencies
✔ React Native CLI support
✔ Expo app support
✔ Expo web support


🚨 Security Warning

This library is not suitable for securing sensitive data.

It does not implement:

  • IV / salt
  • AES-GCM
  • AES-CBC
  • key derivation
  • authenticated encryption
  • secure storage

If you need production-grade crypto → use a native AES solution.


📦 Install

npm install react-native-aes-lite

or

yarn add react-native-aes-lite

🚀 Usage

import { AES, generateKey } from "react-native-aes-lite";

const aes = new AES();
const key = generateKey("hex", { length: 16 });

const encrypted = aes.encrypt("hello world", key);
console.log("Encrypted:", encrypted);

const decrypted = aes.decrypt(encrypted, key);
console.log("Decrypted:", decrypted);

Example output:

Encrypted: f52066d59d6c581c3918e652efe8cb45
Decrypted: hello world

🔑 Key Generation

const key = generateKey("hex", { length: 16 });

Formats supported:

  • hex (recommended)
  • base64
  • ascii

Key lengths:

  • 16 bytes (AES-128)
  • 24 bytes (AES-192)
  • 32 bytes (AES-256)

📘 API Reference

class AES

new AES()
encrypt(text: string, key: string): string
decrypt(cipherHex: string, key: string): string

generateKey(format?, options?)

generateKey(
  format?: "hex" | "base64" | "ascii",
  options?: { length?: number; readable?: boolean }
): string

📌 Example: Saving encrypted text

const aes = new AES();
const key = generateKey("hex");

const token = "USER_SESSION_XYZ";
const encrypted = aes.encrypt(token, key);

await AsyncStorage.setItem("token", encrypted);

const stored = await AsyncStorage.getItem("token");
const decrypted = aes.decrypt(stored, key);

⚡ Performance Notes

AES operations are synchronous.
Works best for short strings.

| Device | Speed | |--------|-------| | New iOS / Android | fast | | Mid-range phones | good | | Old hardware | slower |

Not recommended for large blobs.


🧭 Roadmap

Planned:

  • AES-256 support
  • Async API
  • CBC mode
  • IV generation
  • UTF-8 optimization
  • bundle size reduction

Not planned:

  • secure storage
  • authenticated encryption
  • native rewrite

🧩 Platform Support

| Platform | Status | |------------------|--------| | React Native CLI | ✅ | | Expo app | ✅ | | Expo web | ✅ | | Expo Snack | ❌ (npm modules unsupported) | | TypeScript | ⚠ static warnings may appear |


⚠ Expo Snack

Expo Snack does not support npm installation, so this package cannot run inside Snack. Use Expo locally instead:

expo start

🐞 Troubleshooting

Error: AES is not a constructor

Use default import fallback:

import aesKit from "react-native-aes-lite";
const { AES } = aesKit;

TS2305 — generateKey missing

Ensure latest version is installed.


📜 License

MIT © 2025 Ammachi