// ─── Interfaces ───────────────────────────────────────────────── export type { IStorageService } from './storage.interface'; // ─── Key Registry ─────────────────────────────────────────────── export { StorageKey, ENCRYPTED_KEYS } from './storage.key'; export type { StorageKeyValue } from './storage.key'; // ─── Service Classes ──────────────────────────────────────────── export { LocalStorageService } from './local-storage.service'; export { IndexedDBService } from './indexed-db.service'; // ─── Pre-configured Instances ─────────────────────────────────── import { LocalStorageService } from './local-storage.service'; import { IndexedDBService } from './indexed-db.service'; /** * Default secure localStorage instance. * * Keys listed in `ENCRYPTED_KEYS` are automatically encrypted via * `@repo/utils` `EncryptionUtils`. All other keys are plain JSON. * * @example * ```ts * import { demoSecureStorage, StorageKey } from '@repo/core-storage'; * * await demoSecureStorage.setItem(StorageKey.ACCESS_TOKEN, 'eyJhbGci...'); * const token = await demoSecureStorage.getItem(StorageKey.ACCESS_TOKEN); * ``` */ export const demoSecureStorage = new LocalStorageService(); /** * Default IndexedDB instance. * * Uses `app_db` database with a `kv_store` object store. * Sensitive keys are encrypted at rest using the same * `EncryptionUtils` pipeline as `demoSecureStorage`. * * @example * ```ts * import { demoIndexedDB } from '@repo/core-storage'; * * await demoIndexedDB.setItem('offline_draft', { content: '...' }); * const draft = await demoIndexedDB.getItem('offline_draft'); * ``` */ export const demoIndexedDB = new IndexedDBService({ dbName: 'app_db', storeName: 'kv_store' }); export const demoIndexedDB2 = new IndexedDBService({ dbName: 'app_db', storeName: 'kv_store_2' });