@norionsoft/qr-vault-local
v0.1.0
Published
Local storage adapters for @norionsoft/qr-vault — IndexedDB, localStorage, and in-memory
Readme
@norionsoft/qr-vault-local
Local storage adapters for @norionsoft/qr-vault — IndexedDB, localStorage, and in-memory.
Installation
npm install @norionsoft/qr-vault @norionsoft/qr-vault-localQuick Start
import { Vault } from '@norionsoft/qr-vault';
import { IndexedDBAdapter } from '@norionsoft/qr-vault-local';
const vault = new Vault({ adapter: new IndexedDBAdapter() });
await vault.put({
payload: 'U2FsdGVkX1/...',
meta: { label: 'My Wallet' },
});
const entries = await vault.list();Adapters
IndexedDBAdapter (primary)
import { IndexedDBAdapter } from '@norionsoft/qr-vault-local';
new IndexedDBAdapter({
database: 'qr-vault', // default
store: 'entries', // default
version: 1, // default
});Uses IndexedDB via the idb wrapper. Recommended for production browser use.
LocalStorageAdapter (fallback)
import { LocalStorageAdapter } from '@norionsoft/qr-vault-local';
new LocalStorageAdapter({
keyPrefix: 'qr-vault:', // default
});Falls back to localStorage for environments without IndexedDB. Subject to ~5MB storage limits.
MemoryAdapter (testing)
import { MemoryAdapter } from '@norionsoft/qr-vault-local';
new MemoryAdapter();In-memory Map-based adapter. Use for tests and ephemeral contexts.
Security
All adapters store only encrypted blobs (ds envelopes). No plaintext is ever stored.
Compatibility
- IndexedDBAdapter: All modern browsers, Node.js 18+ (with polyfill)
- LocalStorageAdapter: All browsers with localStorage support
- MemoryAdapter: Any JavaScript runtime
License
MIT — Norionsoft
