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

lumox

v0.2.0

Published

Local-first encrypted storage engine

Readme

Lumox

A TypeScript SDK for local-first encrypted storage with optional IPFS backup capabilities.

npm version NPM Downloads npm bundle size

License: MIT

Features

  • Local-First Storage: Encrypted chat data stored locally using SQLite compiled to WebAssembly
  • Strong Encryption: End-to-end encryption using the WebCrypto API
  • Cross-Platform: Works in browsers, Node.js, and React Native
  • Modular Design: Easily integrate specific components or use the full SDK
  • Comprehensive Error Handling: Detailed error codes and messages for effective debugging
  • Configurable Logging: Flexible logging system that adapts to your application needs

Installation

# Using npm
npm install lumox

# Using yarn
yarn add lumox

# Using pnpm
pnpm add lumox

Quick Start

import { LumoxClient, SqliteStorageProvider, WebCryptoProvider } from 'lumox';
import initSqlJs from 'sql.js';

async function main() {
  // Initialize SQL.js
  const SQL = await initSqlJs();
  
  // Create storage and crypto providers
  const storage = new SqliteStorageProvider({ sqlInstance: SQL });
  const crypto = new WebCryptoProvider();
  
  // Initialize Lumox client
  const lumox = new LumoxClient({ storage, crypto });
  await lumox.initialize();
  
  // Generate encryption key
  await lumox.generateEncryptionKey();
  
  // Send an encrypted message
  const messageId = await lumox.sendMessage('alice', 'bob', 'Hello, encrypted world!');
  console.log(`Message sent with ID: ${messageId}`);
  
  // Retrieve and decrypt messages
  const messages = await lumox.getMessages('alice', 'bob');
  console.log('Messages:', messages);
  
  // Export database for backup
  const dbExport = await lumox.exportData();
  console.log(`Exported ${dbExport.byteLength} bytes of data`);
  
  // Clean up
  await lumox.close();
}

main().catch(console.error);

API Reference

LumoxClient

The main client for interacting with the Lumox system.

const lumox = new LumoxClient({
  storage: storageProvider,
  crypto: cryptoProvider,
  logger: loggerInstance // Optional
});

Methods

  • initialize(): Initialize the client components
  • generateEncryptionKey(): Create a new encryption key
  • exportEncryptionKey(): Export the current encryption key as a string
  • importEncryptionKey(keyData): Import an encryption key
  • sendMessage(senderId, receiverId, content, metadata?): Send an encrypted message
  • getMessages(user1Id, user2Id, limit?, offset?): Retrieve and decrypt messages
  • exportData(): Export the database as a Uint8Array
  • importData(data, overwrite?): Import database data
  • close(): Clean up resources

StorageProvider

Interface for storage implementations.

// Default SQLite implementation
const storage = new SqliteStorageProvider({
  sqlInstance: SQL,
  // Optional: filename for persistent storage in browsers
  filename: '/sql/chat.db',
  // Optional: initial data to load
  initialData: existingDbData,
  // Optional: logger instance
  logger: loggerInstance
});

CryptoProvider

Interface for encryption implementations.

// Default WebCrypto implementation
const crypto = new WebCryptoProvider({
  // Optional: logger instance
  logger: loggerInstance
});

Error Handling and Logging

Lumox provides a comprehensive error handling and logging system. See Error Handling and Logging for details.

Advanced Usage

Persistence in Browser

For persistent storage in browsers, you can use the optional absurd-sql integration:

import { SQLiteFS } from 'absurd-sql';
import IndexedDBBackend from 'absurd-sql/dist/indexeddb-backend';

// Set up absurd-sql for persistence
const sqlFS = new SQLiteFS(SQL.FS, new IndexedDBBackend());
SQL.register_for_idb(sqlFS);
SQL.FS.mkdir('/sql');
SQL.FS.mount(sqlFS, {}, '/sql');

// Create storage with persistence
const storage = new SqliteStorageProvider({
  sqlInstance: SQL,
  filename: '/sql/chat.db'
});

Importing and Exporting

Export and import database for backup or migration:

// Export database
const dbData = await lumox.exportData();

// Save to a file in Node.js
await fs.promises.writeFile('backup.sqlite', Buffer.from(dbData));

// Later, import the database
const importData = await fs.promises.readFile('backup.sqlite');
await lumox.importData(new Uint8Array(importData.buffer), true);

Roadmap

v1.0 (Current)

  • Local storage using SQLite-WASM
  • End-to-end encryption with WebCrypto
  • Comprehensive error handling and logging

v1.5 (Planned)

  • Identity integration for key derivation
  • Support for Web3 wallets (Ethereum, Solana)
  • DID integration

v2.0 (Future)

  • IPFS backup capabilities
  • Conflict resolution for multi-device sync
  • Enhanced privacy features

Development

# Install dependencies
pnpm install

# Build the project
pnpm build

# Run tests
pnpm test

# Run example
pnpm example

# Run error handling example
pnpm example:errors

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License.

Acknowledgments

  • SQL.js for SQLite compilation to WebAssembly
  • The WebCrypto API team for browser encryption capabilities
  • IPFS project for decentralized storage concepts

Built with ❤️ for secure, local-first communications.