Skip to content

TypeScript API / laikacms/storage/web / WebStorageRepositoryOptions

Interface: WebStorageRepositoryOptions ​

Constructor options for WebStorageRepository.

Security & data integrity ​

The Web Storage API (localStorage/sessionStorage) is world-readable to any script running on the same origin — it is not a secret store, has no access control of its own, and every write it accepts is inherently unauthenticated (there is no server in the loop to check who's writing). Never store credentials, API keys, or other secrets in a WebStorageRepository. Authorization for client-writable content belongs on a server proxy path (e.g. laikacms/storage/jsonapi-proxy), not in this repository.

Properties ​

defaultExtension ​

ts
defaultExtension: string;

Extension used for newly created objects when no other extension is determined.


determineExtension? ​

ts
optional determineExtension?: DetermineExtension;

ignoreList? ​

ts
optional ignoreList?: string[];

Same default-exclusions convention as the other storage repositories.


namespace? ​

ts
optional namespace?: string;

Prefix every physical Web Storage key is namespaced under (${namespace}:${key}), so a WebStorageRepository never reads, lists, overwrites, or deletes a key belonging to a different namespace or to unrelated data already present in the same Storage.

Default ​

ts
'laikacms'

serializerRegistry ​

ts
serializerRegistry: StorageSerializerRegistry;

storage? ​

ts
optional storage?: Storage;

Any object implementing the Web Storage interface (getItem, setItem, removeItem, key, length, clear) — localStorage, sessionStorage, or an in-memory shim for testing/SSR.

When omitted, globalThis.localStorage is resolved lazily, on the first operation that needs it — never at construction or import time — so this repository can be constructed (though not yet used) during SSR.

Released under the MIT License.