stable
browser-local
localStorage adapter for noy-db with optional key obfuscation — small vaults under the 5 MB cap, synchronous access.
@noy-db/to-browser-local·pnpm add @noy-db/to-browser-locallocalStorage-backed, for small vaults.
| Shape | record |
| Atomic CAS | ✗ |
| Locality | local |
| Speed | fast |
| Persistence | durable |
What it does
Stores encrypted envelopes in localStorage — synchronous access, small vaults
only (under the browser's ~5 MB cap). Optional obfuscate mode hashes storage
keys so vault/collection/record names aren't readable in DevTools. Prefer
browser-idb for most browser apps.
Notes
casAtomic: false— single-tab only; cross-tab writes share storage with no serialization, so concurrent tabs can race.- Record shape, one key per record.
- Factory:
toBrowserLocal(options?: BrowserLocalOptions).
Store-locator descriptor
See store-locator descriptors for the general model.
kind: 'browser-local', class: 'browser'. address is { prefix? };
options is { obfuscate?, clockUncertaintyMs? }. The simplest citizen of
its tier: localStorage needs no credentials and no transport, so both
binding and credentials are ignored at resolve time.
import { browserLocalStoreDescriptor, registerBrowserLocalStore } from '@noy-db/to-browser-local'
const descriptor = browserLocalStoreDescriptor({ prefix: 'myapp' }, { obfuscate: true })
See also
- to-* family
- browser-idb — the recommended browser store