# 🚀 Nym Extension Storage Demo

⚠️ Demo Environment
This is a development demo. The mnemonics used here are for testing only and should never be used in production.
📋 How to use this demo:
1. Open your browser's developer console (F12)
2. The demo will run automatically when the page loads
3. You can also use the interactive functions shown below
4. Check the IndexedDB in your browser's dev tools to see stored data
✅ What this demo shows:
• Creating encrypted storage instances
• Storing and retrieving BIP39 mnemonics
• Managing multiple wallets
• Error handling for invalid data
• Cleaning up stored data

## Interactive Functions

Open the browser console and try these commands:

// Create a storage instance
const storage = await window.nymStorageDemo.createStorage();
// Run a quick test
await window.nymStorageDemo.quickTest(storage);
// Access test mnemonics
console.log(window.nymStorageDemo.mnemonics);
// Manual operations
await storage.store_mnemonic("my-wallet", "your mnemonic here...");
const mnemonic = await storage.read_mnemonic("my-wallet");
const exists = await storage.has_mnemonic("my-wallet");
const allKeys = await storage.get_all_mnemonic_keys();
await storage.remove_mnemonic("my-wallet");

## Architecture Overview

This storage component uses:

- Rust/WASM - Core storage logic compiled to WebAssembly
- IndexedDB - Browser-native persistent storage
- AES Encryption - Password-based encryption for sensitive data
- BIP39 Validation - Ensures mnemonic phrases are valid

🔒 Security Notes:
• All data is encrypted with your password before storage
• Mnemonics are validated against BIP39 standards
• Sensitive data is zeroed from memory when no longer needed
• Storage is isolated per browser origin