@webex/storage-adapter-local-storage 3.13.0-next.3 → 3.13.0-next.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,352 @@
1
+ ---
2
+ type: Architecture
3
+ title: '@webex/storage-adapter-local-storage architecture'
4
+ description: Repository-wide boundaries, resources, interactions, dependencies, and cross-cutting architecture.
5
+ tags: [architecture]
6
+ ---
7
+ <!-- sdd-generated-metadata
8
+ doc_kind: standing-doc
9
+ generated_from: architecture@0.3.0
10
+ generated_by: claude-code
11
+ approved_by: rsarika@cisco.com
12
+ updated_at: 2026-11-09T10:36:32Z
13
+ validation_status: pass-with-warnings
14
+ -->
15
+
16
+ # @webex/storage-adapter-local-storage architecture
17
+
18
+ Canonical repository-wide architecture for this package. This document owns facts that span the
19
+ package as a whole. Link to the owning module, ADR, or native contract instead of duplicating
20
+ owner-local detail.
21
+
22
+ Related context: [specification registry](specs/README.md) ·
23
+ [repository agent instructions](../AGENTS.md)
24
+
25
+ ## Applicability
26
+
27
+ Sections preceded by an `Include if` comment are conditional. Retain a conditional section only when
28
+ repository evidence satisfies its condition. Record `Unresolved` while the evidence or developer
29
+ answer is still missing; do not infer an answer from the repository type alone.
30
+
31
+ | Condition ID | Status | Evidence or reason | Owned section |
32
+ | ------------------------------------ | ---------- | ------------------ | ----------------------------------- |
33
+ | `repo.owns_datastore` | Applicable | src/index.js — owns the localStorage[basekey] JSON document | Repository data and schema |
34
+ | `repo.holds_client_state` | N/A | No state-management library; only WeakMap binding metadata at src/index.js | Client state model |
35
+ | `repo.components_interact` | N/A | One component in scope; no inter-module calls or events | Dependency and interaction topology |
36
+ | `repo.domain_data_across_components` | N/A | A single resource; no cross-component entities | Object and data ownership |
37
+ | `repo.caches_data` | N/A | No cache backend, TTL, or invalidation logic | Caching catalog |
38
+ | `repo.observability_convention` | Applicable | Injected-logger calls at src/index.js | Observability patterns |
39
+ | `repo.deploys_to_infra` | N/A | No Dockerfile, Kubernetes manifest, or IaC; delivery is an npm package | Runtime and infrastructure |
40
+ | `repo.shared_base_libs` | Applicable | `package.json` — webex-core plus the shared legacy babel/eslint/jest configs | Shared and base libraries |
41
+ | `repo.is_monorepo` | Applicable | Root `package.json` workspaces includes ./packages/@webex/*; all commands are yarn workspace-scoped | Package map and dependencies |
42
+ | `repo.multi_platform` | N/A | A single platform target: browser only (src/index.js), with Node explicitly excluded | Platform matrix |
43
+ | `repo.published_package` | Applicable | `package.json` deploy:npm, main, license: MIT | Release and versioning |
44
+ | `repo.embedded_in_host` | Applicable | Injected as config.storage.boundedAdapter and driven by webex-core | Host integration and theming |
45
+ | `repo.exposes_commands_or_artifacts` | Applicable | build:src emits `dist/index.js` and `dist/index.js.map` | Commands and generated artifacts |
46
+ | `repo.cross_repo_deps_material` | N/A | All dependencies are workspace-internal or the browser platform API | Cross-repository topology |
47
+ | `repo.security_arch_warranted` | Applicable | Persists OAuth tokens in plaintext localStorage — see Security architecture | Security architecture |
48
+
49
+ ## Design overview
50
+
51
+ This package is one of four interchangeable storage adapters in the Webex JS SDK monorepo. Its
52
+ entire purpose is to let webex-core's bounded storage layer persist to the browser `localStorage`
53
+ API while presenting the same asynchronous interface every other adapter presents.
54
+
55
+ The architectural shape is deliberately thin: a single source file, no internal layering, and no
56
+ state of its own beyond per-binding metadata. All structure that matters lives at the seams —
57
+ how the host selects this adapter, and how the adapter maps the host's namespace model onto one
58
+ `localStorage` entry.
59
+
60
+ Adapter selection happens entirely outside this package. `@webex/webex` declares a `browser` field
61
+ that substitutes `config-storage.shim.js` for `config-storage.js`, and only the shim instantiates
62
+ this adapter (sibling package webex, file `src/config-storage.shim.js`). A Node bundle of the same SDK keeps
63
+ `MemoryStoreAdapter`. That substitution is why a package with no runtime feature detection can
64
+ safely assume a browser global.
65
+
66
+ The one consequential internal decision is that every namespace shares a single `localStorage`
67
+ entry named by the constructor `basekey`. It makes a full purge trivial and needs no key-prefixing
68
+ convention, at the cost of whole-document access on every `get`, `put`, and `del` (a read and parse
69
+ for `get`, which never writes, and a read-modify-write for `put` and `del`, as the module's
70
+ operation inventory records), a `clear()` whose blast radius exceeds the binding that calls it — the
71
+ owner-confirmed logout intent — and
72
+ an isolation guarantee that is weaker than it looks. A rewrite round-trips sibling namespaces
73
+ through `JSON.parse`/`JSON.stringify`; namespace
74
+ and key lookup do not check own properties, so `Object.prototype` names are not usable; and the
75
+ document shape is never validated, so valid JSON written by another script on the origin in a
76
+ different shape is processed rather than rejected — which can fabricate a read or let a write resolve
77
+ without storing anything. The isolation and not-found guarantees therefore hold for a
78
+ schema-conforming document and ordinary key names, not unconditionally.
79
+ Detail lives in the [module specification](../src/docs/README.md).
80
+
81
+ Three adapter behaviors differ from the default `MemoryStoreAdapter` in ways consumers must know
82
+ about: `clear()` scope, synchronous failure on a missing global, and JSON-only value fidelity. All
83
+ three are specified in the module document.
84
+
85
+ ## Resource inventory and responsibilities
86
+
87
+ | Resource | Kind | Responsibility | Owner | Source | Detailed specification |
88
+ | -------- | ---- | -------------- | ----- | ------ | ---------------------- |
89
+ | `@webex/storage-adapter-local-storage` | package | Published npm library wrapping the browser `localStorage` API as a webex-core storage adapter | `@webex/web-client`, per `.github/CODEOWNERS` | `package.json` | `../src/docs/README.md` |
90
+ | `src` | module | The adapter implementation: constructor, `bind`, and the bound store (`get`, `put`, `del`, `clear`) | `@webex/web-client` | `src/index.js` | `../src/docs/README.md` |
91
+
92
+ ## Interaction and execution flows
93
+
94
+ The representative flow is host-driven: configuration supplies an adapter instance, webex-core binds
95
+ one namespace per plugin, and persisted state flows through the bound store into a single browser
96
+ storage entry.
97
+
98
+ ```mermaid
99
+ flowchart LR
100
+ Cfg["webex config-storage.shim.js<br/>new StorageAdapterLocalStorage('webex')"] -->|config.storage.boundedAdapter| Store[webex-core WebexStore]
101
+ Persist["@persist on Credentials / Device / User"] -->|boundedStorage.put| Store
102
+ Store -->|bind namespace, logger| Adapter[StorageAdapterLocalStorage]
103
+ Adapter -->|resolves| Bound[Bound store]
104
+ Store -->|get / put / del / clear| Bound
105
+ Bound -->|getItem / setItem / removeItem| LS[(localStorage basekey)]
106
+ Bound -.->|rejects NotFoundError| Store
107
+ ```
108
+
109
+ | From | To | Interaction or transport | Purpose | Failure or compatibility behavior |
110
+ | ---------- | ---------- | ------------------------ | -------- | --------------------------------- |
111
+ | `@webex/webex` (browser build) | this package | Import + construction, selected by the `browser` field substitution | Supply the browser `boundedAdapter` | Node builds never load it and keep `MemoryStoreAdapter` |
112
+ | `@webex/recipe-private-web-client` | this package | Import + construction with basekey `web-client-internal` | Supply a separate bounded store for the private web client | Pairs it with the local-forage adapter for unbounded storage |
113
+ | webex-core `WebexStore` | this package | In-process call `adapter.bind(namespace, {logger})` | Obtain a namespace-scoped store, cached per namespace behind `@oneFlight` | Rejects on a falsy namespace or missing logger |
114
+ | webex-core `WebexStore` | bound store | In-process `get`/`put`/`del`/`clear` | Read and write persisted plugin state | `get` rejects `NotFoundError` when absent; `clear()` removes the whole entry, not just the namespace |
115
+ | `@persist` decorators | webex-core `WebexStore` | `boundedStorage.put` on change (debounced) | Persist Credentials, Device, and User state | A rejected write propagates to the decorator's promise chain |
116
+ | bound store | `localStorage` | Synchronous same-origin browser API | Durable storage | Missing global: `get`/`put`/`del` reject, `clear()` throws synchronously; quota exhaustion is unhandled |
117
+
118
+ ## Dependency topology
119
+
120
+ | Dependency | Type | Used by | Purpose | Version, failure, or fallback policy |
121
+ | ---------- | ---- | ------- | ------- | ------------------------------------ |
122
+ | `@webex/webex-core` | Internal (workspace) | `src/index.js` | Supplies `NotFoundError`, the rejection type callers branch on | `workspace:*`; a type change here is a breaking change for consumers' `catch` branches |
123
+ | `@webex/storage-adapter-spec` | Internal (workspace, contract/test) | `test/unit/spec/storage-adapter-local-storage.js` | Declares the shared abstract adapter contract | `workspace:*`; currently non-executing in this package — see the module spec's Verification section |
124
+ | `@webex/test-helper-mocha` | Internal (workspace) | `test/unit/spec/storage-adapter-local-storage.js` | Provides `skipInNode`, which disables the only test suite under Node | `workspace:*` |
125
+ | Browser `localStorage` | External (platform) | `src/index.js` | The backing store | No feature detection and no fallback; absence is a hard failure |
126
+ | `@webex/babel-config-legacy`, `@webex/eslint-config-legacy`, `@webex/jest-config-legacy` | Internal (workspace, build) | `babel.config.js`, `.eslintrc.js`, `jest.config.js` | Shared build, lint, and test configuration | `workspace:*`; the jest config's `testEnvironment: 'node'` is what forces the Node test skip |
127
+
128
+ There are no dependency cycles. The single ordering constraint is that `@webex/webex-core` must
129
+ build before this package, since `NotFoundError` is imported from it. The package is a leaf: nothing
130
+ in the workspace imports it except the consumers listed above, all of which treat it as
131
+ configuration rather than as a library to extend.
132
+
133
+ ## Public and consumer surfaces
134
+
135
+ Exact API, event, command, package, file, or schema definitions remain in their native source and
136
+ owner specification. This table is the package's contract index; `.sdd/manifest.json` is
137
+ authoritative for publication state and canonical source.
138
+
139
+ | Surface | Type | Owner | Consumers | Compatibility policy | Source |
140
+ | ------- | ---- | ----- | --------- | -------------------- | ------ |
141
+ | `storage-adapter-local-storage-sdk` | SDK | `src` | `@webex/webex` (browser), `@webex/recipe-private-web-client`, authorization-browser automation fixtures | Published npm surface. The constructor signature and the `bind`/`get`/`put`/`del`/`clear` shape are breaking-change boundaries. No `.d.ts` or API report ships, so `package.json` is the only machine-readable declaration. | `package.json` |
142
+ | `local-storage-bounded-document` | File | `src` | Any future release of this package reading data written by an earlier one | Internal, with an owner-confirmed cross-release promise: the at-rest JSON document `{ "<namespace>": { "<key>": <value> } }` must stay readable by later releases, so a layout or encoding change needs a migration and is breaking. It carries no version field and no migration step today. | `src/index.js` |
143
+ | `webex-core-store-adapter-interface` | SDK | `@webex/webex-core` (external to this SDD root) | consumed by `src` | Internal. The `bind(namespace, {logger})` plus `get`/`put`/`del`/`clear` shape webex-core calls. This package implements it; it does not own it. | packages/@webex/webex-core/src/lib/storage/make-webex-store.js |
144
+
145
+ ## Repository data and schema
146
+
147
+ | Datastore or schema | Owning resource | Source of truth | Migration and compatibility rule |
148
+ | ------------------- | --------------- | --------------- | -------------------------------- |
149
+ | `localStorage[basekey]` JSON document | `src` | src/index.js | No version field, no migration step, no schema validation. A newer release must stay able to read a document written by an older one (owner-confirmed; module spec `MOD-018`), so a layout or encoding change needs a migration that reads the previous layout and is a breaking change. Without one, the effect would be missing or malformed values at read time rather than a detected upgrade. Entities and retention detail live in the [module specification](../src/docs/README.md). |
150
+
151
+ In the browser `webex` bundle the basekey is `webex` and the document holds the `@persist`ed
152
+ Credentials (including `supertoken`), Device, and User records. `@webex/recipe-private-web-client`
153
+ uses the separate basekey `web-client-internal`.
154
+
155
+ ## Cross-cutting architecture
156
+
157
+ ### Security
158
+
159
+ - Trust boundaries and identity flow: the package sits entirely inside the browser origin's trust
160
+ boundary. It performs no authentication, authorization, or identity checks of its own; it stores
161
+ whatever the host hands it under the configured basekey.
162
+ - Sensitive surfaces and data classes: OAuth access and refresh tokens. `@persist` writes
163
+ `Credentials` — including `supertoken` — through `boundedStorage.put`
164
+ (webex-core `src/lib/storage/decorators.js` and the `@persist('@')` decoration in
165
+ `src/lib/credentials/credentials.js`), and in a browser bundle the bounded adapter is this package
166
+ (sibling package webex, file `src/config-storage.shim.js`). Device and
167
+ User records persist by the same route.
168
+ - Encryption and secret boundaries: **none**. Values are stored as plaintext JSON, readable by any
169
+ script executing on the origin. The package implements no encryption, no integrity check, and no
170
+ expiry, so persisted tokens are exposed to any successful XSS. Mitigating that is a host and
171
+ application concern; it cannot be addressed inside this adapter without changing the stored
172
+ document contract.
173
+
174
+ ### Observability and operations
175
+
176
+ - Logging and correlation: every operation logs through the logger injected at `bind` time, never
177
+ through a module-level logger. Messages are prefixed `local-storage-store-adapter:`
178
+ (`src/index.js`). There is no correlation id; the host logger supplies context.
179
+ - Metrics, traces, and audit signals: none. The package emits no metrics and no traces, and records
180
+ no audit trail of reads or writes.
181
+ - Ownership and operational entry points: owned by `@webex/web-client`, assigned in `.github/CODEOWNERS`.
182
+ There is no dashboard, alert, or runbook; the package has no runtime of its own to operate.
183
+
184
+ ### Quality attributes
185
+
186
+ Expectations that fit a published browser SDK package:
187
+
188
+ - Footprint: one source file compiling to a single `dist/index.js` plus source map
189
+ (`build:src`, measured 2026-11-09).
190
+ - Compatibility: the published constructor and bound-store shape are stable surfaces; the at-rest
191
+ document carries no version field and no migration step, but cross-release readability is an
192
+ owner-confirmed promise, so a layout change needs a migration (see the module specification).
193
+ - Main-thread cost: `get` parses the entire document and `put`/`del` additionally re-serialize and
194
+ rewrite all of it, so their cost scales with total stored size across all namespaces rather than
195
+ with the value being written. `bind` and `clear` are exempt — `bind` touches no storage and
196
+ `clear` only calls `removeItem`.
197
+ - Verification: **currently unmet.** No automated test executes this package in either route — the
198
+ Node route skips all 21 declared cases and the browser route completes 0 tests and exits 1.
199
+ See the module specification's Verification section.
200
+
201
+ ## Observability patterns
202
+
203
+ | Signal | Convention or required fields | Propagation or naming rule | Primary evidence |
204
+ | ------- | ----------------------------- | -------------------------- | ---------------- |
205
+ | Logs | Injected logger only; messages prefixed `local-storage-store-adapter:`. `get` and `put` log at `debug`, `del` and `clear` at `info`, `bind` at `debug`. Keys appear in messages; values never do. | Logger is captured per binding at `bind` time and held in a module-level `WeakMap`; no module-level or global logger exists | src/index.js |
206
+ | Metrics | None emitted | — | — |
207
+ | Traces | None emitted | — | — |
208
+ | Audit | None recorded | — | — |
209
+
210
+ The `info`-versus-`debug` split between `del`/`clear` and `get`/`put` is inconsistent and has no
211
+ stated reason; it is recorded in the module spec as `MOD-014` rather than rationalized here.
212
+
213
+ ## Shared and base libraries
214
+
215
+ | Library | Inherited responsibility | Consumers | Version floor | Compatibility rule |
216
+ | ------- | ------------------------ | --------- | ------------- | ------------------ |
217
+ | `@webex/webex-core` | Error taxonomy (`NotFoundError extends StorageError extends Exception`) and the storage-layer contract this package implements | `src` | `workspace:*` | Changing the error type or the adapter interface breaks this package and every other adapter |
218
+ | `@webex/babel-config-legacy` | Transpilation settings for `build:src` | `babel.config.js` | `workspace:*` | Shared across legacy packages; not overridden here |
219
+ | `@webex/eslint-config-legacy` | Lint rules | `.eslintrc.js` (declared `root: true`) | `workspace:*` | Package-local root; the `/* eslint-env browser */` directive in `src/index.js` adds the browser env |
220
+ | `@webex/jest-config-legacy` | Unit-test runner configuration | `jest.config.js` | `workspace:*` | Imposes `testEnvironment: 'node'`, which is the direct cause of the skipped unit route |
221
+ | `@webex/legacy-tools` | `webex-legacy-tools` build and test runner binary | `package.json` scripts | `workspace:*` | Supplies both the `build:src` and the karma `test:browser` routes |
222
+
223
+ ## Package map and inter-package dependencies
224
+
225
+ | Package | Visibility | Responsibility | Depends on | Consumers |
226
+ | --------- | ---------- | -------------- | ---------- | --------- |
227
+ | `@webex/storage-adapter-local-storage` | Public (npm) | Browser localStorage bounded storage adapter | `@webex/webex-core`, `@webex/storage-adapter-spec`, `@webex/test-helper-mocha` | `@webex/webex`, `@webex/webex-node` (declared only), `@webex/recipe-private-web-client`, `@webex/plugin-authorization-browser`, `@webex/plugin-authorization-browser-first-party` |
228
+
229
+ This package is a workspace member under the root `workspaces` glob `./packages/@webex/*`, so every
230
+ command is `yarn workspace`-scoped. Three sibling adapters implement the same contract against
231
+ different backends: `@webex/storage-adapter-session-storage`, `@webex/storage-adapter-local-forage`,
232
+ and the in-core `MemoryStoreAdapter`. They are interchangeable by configuration and are **not**
233
+ behaviorally identical — notably in `clear()` scope — so swapping one for another is a behavioral
234
+ change, not a drop-in substitution.
235
+
236
+ The repository is classified `Orchestrator-plus-components`: one Git repository holding many
237
+ independently built and independently published workspace packages, coordinated by the root
238
+ `workspaces` declaration, root `AGENTS.md`, `CONTRIBUTING.md`, `.github/CODEOWNERS`, and a
239
+ repository-wide release pipeline. That classification follows the repository structure, not the SDD
240
+ root, even though this SDD root covers a single package with a single build. The doc tree mirrors it:
241
+ the monorepo-level documents are the repository root `AGENTS.md` and the root `docs/index.md`
242
+ package routing table, this package carries its own component-level standing docs and agent entry,
243
+ and coverage status is tracked per component in `.sdd/manifest.json`. The package holds no
244
+ templates; it refers to the monorepo root snapshot at `../../../.sdd/templates/repo-standards`.
245
+
246
+ Dependency direction is one-way: this package imports from `@webex/webex-core` and nothing in the
247
+ workspace imports it except as configuration. `@webex/webex-node` declares it as a dependency but
248
+ its sources never import it; the Node build resolves `MemoryStoreAdapter` through
249
+ `webex-node/src/config-storage.js` instead. Versions are synchronized by the monorepo's automated
250
+ release pipeline; all internal ranges are `workspace:*`.
251
+
252
+ ## Release and versioning
253
+
254
+ | Artifact | Publish target | Versioning rule | Deprecation window | Changelog or migration obligation |
255
+ | -------- | -------------- | --------------- | ------------------ | --------------------------------- |
256
+ | `@webex/storage-adapter-local-storage` | npm (`yarn workspace @webex/storage-adapter-local-storage deploy:npm`, which runs the package's `deploy:npm` script) | Versioned and released by the monorepo's automated release pipeline, not hand-maintained in this package | Not defined at package level | No package-local `CHANGELOG.md`; release notes are produced repository-wide. A change to the constructor signature, the bound-store method set, or the at-rest document layout is a breaking change for the consumers listed above. |
257
+ | `dist/index.js`, `dist/index.js.map` | Build output bundled into the npm artifact | Regenerated by `build:src` on every release | — | Not version-controlled — the repository-root `.gitignore` ignores `dist` |
258
+
259
+ ## Host integration and theming
260
+
261
+ | Host or integration | Mount or entry contract | Required providers or peers | Theming and accessibility constraints |
262
+ | ------------------- | ----------------------- | --------------------------- | ------------------------------------- |
263
+ | `@webex/webex` browser bundle | `config.storage.boundedAdapter = new StorageAdapterLocalStorage('webex')`, reached only through the `browser` field substitution of `config-storage.shim.js` | A browser context with `localStorage`; a host logger exposing `debug` and `info`; workspace `@webex/webex-core` | Not applicable — the package renders nothing |
264
+ | `@webex/recipe-private-web-client` | `storage.boundedAdapter = new StorageAdapterLocalStorage('web-client-internal')`, paired with the local-forage adapter for unbounded storage | Same as above | Not applicable |
265
+ | Authorization-browser automation fixtures | `config.storage.boundedAdapter = new StorageAdapterLocalStorage('webex')` inside the test harness page | A real browser driven by the automation runner | Not applicable |
266
+
267
+ The host owns binding lifetime and decides when `clear()` runs. This package registers no listeners
268
+ and exposes no teardown hook, so nothing requires disposal.
269
+
270
+ ## Commands and generated artifacts
271
+
272
+ | Command or artifact | Owner | Inputs | Output or side effect | Compatibility boundary |
273
+ | ------------------- | ----- | ------ | --------------------- | ---------------------- |
274
+ | `yarn workspace @webex/storage-adapter-local-storage build:src` | `@webex/web-client` | `src/**` | `dist/index.js` + `dist/index.js.map`. Measured 2026-11-09: exit 0, 1 file emitted. | `dist/index.js` is the published `main`; its shape is the consumer contract |
275
+ | `... test:style` | `@webex/web-client` | `src/**`, `.eslintrc.js` | Lint report. Measured 2026-11-09: exit 0, 0 errors, 1 warning. The warning is `src/docs/README.md` — the lint glob `./src/**/*.*` matches the canonical module spec, which ESLint then reports as ignored. | — |
276
+ | `... test:unit` | `@webex/web-client` | `test/unit/**` | Jest run. Measured 2026-11-09: exit 0, **21 skipped, 0 executed**. | Reports success while verifying nothing |
277
+ | `... test:browser` | `@webex/web-client` | `test/unit/**` | Karma run. Measured 2026-11-09: **exit 1**, **0 tests completed**, `beforeAll is not defined` in both browsers. | Fails before any case runs |
278
+ | `... test` | `@webex/web-client` | all of the above | Measured 2026-11-09: **exit 1** — `Couldn't find a script named "test:integration"`. | Known broken aggregate |
279
+ | `... deploy:npm` | release pipeline | `dist/**`, `package.json` | Publishes the package to npm | Publishing boundary |
280
+
281
+ ## Security architecture
282
+
283
+ The package has no authentication or authorization logic of its own, but it is the persistence
284
+ mechanism for the SDK's most sensitive browser-side data, which makes its boundary worth stating
285
+ explicitly.
286
+
287
+ Everything lives inside a single trust boundary: the browser origin. There is no privilege
288
+ separation between the data this adapter stores and any other script running on that origin.
289
+ `localStorage` is not partitioned by path, is readable synchronously by any same-origin script, and
290
+ is not cleared when a session cookie expires.
291
+
292
+ ```mermaid
293
+ flowchart LR
294
+ User[End user] -->|OAuth login| Creds["webex-core Credentials<br/>supertoken: access + refresh"]
295
+ Creds -->|@persist -> boundedStorage.put| Store[WebexStore bounded]
296
+ Store --> Adapter[storage-adapter-local-storage]
297
+ Adapter -->|plaintext JSON| LS[(localStorage 'webex')]
298
+ XSS[Any same-origin script] -.->|reads freely - no encryption| LS
299
+ ```
300
+
301
+ Architectural controls and their absence:
302
+
303
+ - Encryption at rest: none. Tokens are stored exactly as the host serializes them.
304
+ - Integrity: none. Nothing detects tampering with the stored document; a modified entry is parsed
305
+ and trusted.
306
+ - Expiry: none. Entries persist until `del`, `clear`, or the user clears site data. Token lifetime
307
+ is enforced by the host's credential logic, not by the store.
308
+ - Purge on logout: `clear()` removes the entire `basekey` entry, which does remove persisted
309
+ credentials. That purge is the one security-relevant behavior the adapter implements, and its
310
+ basekey-wide blast radius is owner-confirmed intent: logout must remove every namespace under the
311
+ basekey, including namespaces not bound in the current session (module spec `MOD-010`).
312
+ - Node safety: the adapter is unreachable in Node builds, so server-side token persistence through
313
+ this path is not possible.
314
+ - Prototype pollution (CWE-1321): binding the namespace `__proto__` and calling `put` installs the
315
+ key as an own property of the stored document root's prototype, which is then observable on the
316
+ values that inherit from it — universally for `Object.prototype`, but only on arrays when
317
+ `Array.prototype` is the target. The target follows the stored data rather than being fixed — `Object.prototype`
318
+ for an absent or object root, `Array.prototype` for an array root, and the matching wrapper
319
+ prototype for a primitive root; a `null` root rejects instead. The key `__proto__` is a second and
320
+ worse variant: it re-parents the target prototype rather than adding a property, which succeeds for
321
+ every built-in prototype except the immutable `Object.prototype` — splicing a caller-supplied
322
+ object into a built-in type's chain, or severing it. Both variants require the stored root to carry
323
+ no own `__proto__` key; a document that does carry one makes the lookup resolve to ordinary stored
324
+ data and neutralizes the path. `clear()` does not undo either variant. The module applies no own-property guard. No exploit path
325
+ exists in this repository as configured, because `webex-core` passes fixed plugin names, but that
326
+ is a property of the callers rather than of the adapter. Tracked as a code defect in the module
327
+ specification (`MOD-016`), not as accepted behavior.
328
+
329
+ Applications that cannot accept plaintext token persistence should configure a different bounded
330
+ adapter rather than modifying this one, since changing the stored representation would break the
331
+ at-rest document contract for existing users.
332
+
333
+ ## Domain language
334
+
335
+ | Term | Repository-specific meaning | Authoritative source |
336
+ | ------ | --------------------------- | ------------------------- |
337
+ | basekey | The single `localStorage` key under which one adapter instance stores every namespace. Fixed at construction and captured in a closure. | src/index.js |
338
+ | namespace | The host's isolation unit within the document, one per webex plugin. Selects a slice of the stored object. | src/index.js |
339
+ | binding (`Bound`) | A namespace-scoped store returned by `bind()`. Holds no data itself; its namespace and logger live in module-level `WeakMap`s. | src/index.js |
340
+ | bounded adapter | The webex-core storage role this package fills — durable, size-limited storage, as opposed to the unbounded adapter. Selected via `config.storage.boundedAdapter`. | webex-core storage spec (sibling package webex-core, file src/lib/storage/docs/README.md) |
341
+ | abstract adapter spec | The shared contract suite in `@webex/storage-adapter-spec` that every adapter is expected to satisfy. | storage-adapter-spec module spec (sibling package storage-adapter-spec, file src/docs/README.md) |
342
+
343
+ ## References and maintenance
344
+
345
+ - Decisions: no ADRs exist for this package yet.
346
+ - Instantiated specifications and routing: [specs/README.md](specs/README.md)
347
+ - Module specification: [`src/docs/README.md`](../src/docs/README.md)
348
+ - Package reference documentation: `README.md` at the package root is registered as reference-only
349
+ and is **not** authoritative. It describes `clear()` as namespace-scoped, which the code
350
+ contradicts.
351
+ - Update this document in the same change that alters package boundaries, the adapter's published
352
+ surface, the at-rest document layout, or how a host selects this adapter.
@@ -0,0 +1,136 @@
1
+ ---
2
+ type: Getting Started
3
+ title: Getting started
4
+ description: Local setup, build, run, and test routing for @webex/storage-adapter-local-storage.
5
+ tags: [onboarding]
6
+ ---
7
+ <!-- sdd-generated-metadata
8
+ doc_kind: standing-doc
9
+ generated_from: getting-started@0.3.0
10
+ generated_by: claude-code
11
+ approved_by: rsarika@cisco.com
12
+ updated_at: 2026-11-09T10:36:32Z
13
+ validation_status: pass-with-warnings
14
+ -->
15
+
16
+ # Getting started
17
+
18
+ Onboarding for **@webex/storage-adapter-local-storage**. All commands are run from the repository
19
+ root, not the package directory.
20
+
21
+ ## Prerequisites
22
+
23
+ | Tool or access | Version or requirement |
24
+ | -------------------------------------- | ---------------------- |
25
+ | Node | `package.json` declares `engines.node >= 18`; the repository `.nvmrc` pins `lts/jod` and the root agent instructions specify 22.14. Verified working: `v22.14.0`. |
26
+ | Yarn | `3.4.1`, workspace-managed |
27
+ | Firefox and Chrome | Required only for `test:browser`; the Karma runner launches both |
28
+ | Registry or VPN access | N/A — all internal dependencies resolve as `workspace:*` |
29
+
30
+ ## Install
31
+
32
+ Switch to Node 22.14 first (`nvm use 22.14`, as the repository root `AGENTS.md` instructs), then
33
+ run every command below from the root of the cloned repository:
34
+
35
+ ```bash
36
+ git clone https://github.com/webex/webex-js-sdk.git
37
+ yarn install
38
+ ```
39
+
40
+ ## Build
41
+
42
+ ```bash
43
+ yarn workspace @webex/storage-adapter-local-storage build:src
44
+ ```
45
+
46
+ Emits `dist/index.js` and `dist/index.js.map`. Measured 2026-11-09: exit 0, 1 file emitted. `dist/`
47
+ is not version-controlled — the repository-root `.gitignore` ignores `dist`.
48
+
49
+ ## Run
50
+
51
+ This package has no runnable entry point — it is a library consumed in-process. To exercise it,
52
+ configure it as a bounded adapter in a browser build of the SDK, as the sibling package webex does in
53
+ `src/config-storage.shim.js`:
54
+
55
+ ```js
56
+ import StorageAdapterLocalStorage from '@webex/storage-adapter-local-storage';
57
+ import WebexCore from '@webex/webex-core';
58
+
59
+ const webex = new WebexCore({
60
+ config: {storage: {boundedAdapter: new StorageAdapterLocalStorage('webex')}},
61
+ });
62
+ ```
63
+
64
+ ## Tests
65
+
66
+ ```bash
67
+ yarn workspace @webex/storage-adapter-local-storage test:unit
68
+ ```
69
+
70
+ > **Read this before trusting a green run.** Neither test route in this package actually executes
71
+ > the module. Check the reported test *count*, not the exit code.
72
+
73
+ | Tier | Command | Test location | Framework | External dependencies |
74
+ | ------------ | -------------------- | ------------- | ----------- | ----------------------------------- |
75
+ | Unit | `yarn workspace @webex/storage-adapter-local-storage test:unit` | `test/unit/spec` | Jest via `@webex/jest-config-legacy` | None |
76
+ | Browser | `yarn workspace @webex/storage-adapter-local-storage test:browser` | `test/unit/spec` | Karma + Mocha via `webex-legacy-tools` | Firefox, Chrome Headless |
77
+
78
+ Measured 2026-11-09 with Node v22.14.0:
79
+
80
+ - `test:unit` → exit 0, **21 tests skipped, 0 executed**. `testEnvironment` is `node`
81
+ (the shared config in workspace package `packages/legacy/jest`, reached through `jest.config.js`),
82
+ `localStorage` is absent, and `test/unit/spec/storage-adapter-local-storage.js` wraps the suite in
83
+ `skipInNode`.
84
+ - `test:browser` → **exit 1**, **0 tests completed**. Both browsers (Chrome Headless 156, Firefox 159)
85
+ report `ReferenceError: beforeAll is not defined`, because the `@webex/storage-adapter-spec` suite
86
+ uses a Jest global under Mocha, so the suite throws while being defined.
87
+ - `test:style` → exit 0, 0 errors, **1 warning**. The warning is `src/docs/README.md`: the lint
88
+ script globs `./src/**/*.*`, which matches the canonical module spec, and ESLint reports the
89
+ Markdown file as ignored. See the note under First-run verification.
90
+ - `test` (aggregate) → **exit 1**: `Couldn't find a script named "test:integration"`. Do not use it.
91
+
92
+ There is no integration or end-to-end tier. The nearest executing verification of the shared adapter
93
+ contract lives in a sibling package, where `@webex/webex-core` runs the same abstract suite against
94
+ `MemoryStoreAdapter` — that exercises the contract, not this implementation.
95
+
96
+ - Coverage or quality gate: **none**. Owner-verified absence.
97
+ - Enforcement source: the shared jest config (workspace package `packages/legacy/jest`) sets
98
+ `collectCoverage: false`; no threshold is configured, and the `Test - Coverage` job in the repository
99
+ workflow `.github/workflows/pull-request.yml` runs
100
+ `test:coverage`, which this package does not define.
101
+ - Test environment or QA dependencies: none beyond the local browsers for the Karma route.
102
+
103
+ ## Configuration and secrets
104
+
105
+ - Required configuration: none. The package reads no environment variables and no config file.
106
+ - Secret source: N/A for development. Be aware at runtime the adapter persists OAuth access and
107
+ refresh tokens as plaintext JSON in `localStorage` — see the
108
+ [security architecture](architecture.md#security-architecture).
109
+ - Package or artifact access: N/A — all internal dependencies are `workspace:*`.
110
+ - Required neighboring repositories or workspace layout: none. `@webex/webex-core` must build first,
111
+ since `NotFoundError` is imported from it; Yarn workspaces handles the ordering.
112
+ - Platform, simulator, device, or SDK setup: a browser is required for `test:browser` only.
113
+ - Never commit credentials or copy production secrets into a local config.
114
+
115
+ ## First-run verification
116
+
117
+ 1. Run `yarn workspace @webex/storage-adapter-local-storage test:style`.
118
+ 2. Run `yarn workspace @webex/storage-adapter-local-storage build:src`.
119
+ 3. Confirm `packages/@webex/storage-adapter-local-storage/dist/index.js` exists.
120
+
121
+ Expected result: lint exits 0 with one warning naming `src/docs/README.md`, and the build prints
122
+ `Built storage-adapter-local-storage: 1 files → ./dist`.
123
+
124
+ That warning appeared when SDD onboarding placed the canonical module spec at `src/docs/README.md`,
125
+ inside the `./src/**/*.*` lint glob. It is cosmetic — ESLint lints no Markdown either way — but it
126
+ is new. The one-line fix is to narrow the `test:style` script to `eslint ./src/**/*.js`, which is a
127
+ `package.json` change and therefore an owner decision rather than part of this spec-only change.
128
+
129
+ Do not use a passing `test:unit` as a first-run signal; it passes without executing anything.
130
+
131
+ ## Next steps
132
+
133
+ - [Repository architecture](architecture.md)
134
+ - [Specification registry](specs/README.md)
135
+ - [Module specification](../src/docs/README.md)
136
+ - [Documentation index](index.md)
package/docs/index.md ADDED
@@ -0,0 +1,54 @@
1
+ ---
2
+ okf_version: '0.1'
3
+ ---
4
+ <!-- sdd-generated-metadata
5
+ doc_kind: standing-doc
6
+ generated_from: docs-index@0.3.0
7
+ generated_by: claude-code
8
+ approved_by: rsarika@cisco.com
9
+ updated_at: 2026-11-09T10:36:32Z
10
+ validation_status: pass-with-warnings
11
+ -->
12
+
13
+ # @webex/storage-adapter-local-storage documentation
14
+
15
+ Doc map for developers and agents working on the browser localStorage bounded storage adapter.
16
+
17
+ ## Start here
18
+
19
+ - [Getting started](getting-started.md)
20
+ - [Repository architecture](architecture.md)
21
+
22
+ There is no service specification — this package is a published library, not a deployable service.
23
+ There is no API specification — the package exposes no HTTP surface; its published contract is the
24
+ npm ES module export declared in `package.json`.
25
+
26
+ ## Decisions
27
+
28
+ No architectural decision records exist for this package yet. When one is needed, add it as a
29
+ concrete file under `docs/adr/`, instantiated from the ADR template in the monorepo root snapshot
30
+ (`.sdd/templates/repo-standards/` at the repository root). This package holds no templates of its own.
31
+
32
+ ## Specifications and contracts
33
+
34
+ - [architecture.md](architecture.md) — canonical package-wide architecture, including the contract
35
+ index and the security posture
36
+ - [specs/README.md](specs/README.md) — manifest-backed module and contract registry
37
+ - [`../src/docs/README.md`](../src/docs/README.md) — the owning specification beside the module's
38
+ code; authoritative for adapter behavior
39
+
40
+ Use the manifest-linked native source for exact contract details. For this package that is
41
+ `package.json`, the ecosystem-native declaration of the published SDK surface; the package ships no
42
+ `.d.ts` and no API report. Register and link those sources from the architecture index and the
43
+ owning module spec instead of copying them into Markdown.
44
+
45
+ ## Related repository resources
46
+
47
+ - `../README.md` — the npm-facing package reference. Registered as **reference-only** context and
48
+ **not authoritative**; it describes `clear()` as
49
+ namespace-scoped, which the code contradicts. Use the module spec for behavior.
50
+ - `../AGENTS.md` — agent instructions for this package.
51
+ - `../.sdd/manifest.json` — the SDD manifest: modules, contracts, layout, and coverage state.
52
+ - The repository root carries its own `AGENTS.md`, `CONTRIBUTING.md`, and CI workflows that govern
53
+ this package alongside the rest of the monorepo; the root
54
+ [package routing table](../../../../docs/index.md#sdd-package-routing) lists every onboarded package.
@@ -0,0 +1,86 @@
1
+ ---
2
+ type: Reference
3
+ title: Specification registry
4
+ description: Canonical specification registry and change-routing guide.
5
+ tags: [specifications, registry]
6
+ ---
7
+ <!-- sdd-generated-metadata
8
+ doc_kind: standing-doc
9
+ generated_from: spec-index@0.3.0
10
+ generated_by: claude-code
11
+ approved_by: rsarika@cisco.com
12
+ updated_at: 2026-11-09T10:36:32Z
13
+ validation_status: pass-with-warnings
14
+ -->
15
+
16
+ # Specification registry
17
+
18
+ Use this page to find the canonical package architecture and every instantiated module
19
+ specification plus native contract. Technical facts stay in one owning document; this page carries
20
+ navigation, ownership, status, and change/test routing only.
21
+
22
+ Start with the [repository architecture](../architecture.md). There is no service specification —
23
+ this package is a published library, not a deployable service.
24
+
25
+ ## Document roles
26
+
27
+ | Document | Canonical ownership |
28
+ | --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
29
+ | [Repository architecture](../architecture.md) | Package boundaries, resource inventory, interactions, dependency topology, and cross-cutting architecture |
30
+ | Service specification | Not applicable — no deployable service in this package |
31
+ | Module specifications | Stable behavior and design at each manifest-routed `<module-path>/docs/README.md` |
32
+ | ADR | A durable decision, its deciders, rationale, consequences, and supersession lineage. None exist yet. |
33
+
34
+ ## Instantiated specification registry
35
+
36
+ | Resource | Role | Canonical path | Owner | Status | Last verified |
37
+ | ---------- | -------------------------- | ---------------------- | -------------- | --------------------------------------- | ------------- |
38
+ | Repository | Architecture | `docs/architecture.md` | `@webex/web-client` | Active | 2026-11-09 |
39
+ | `src` | Module | `src/docs/README.md` | `@webex/web-client` | Active | 2026-11-09 |
40
+ | `storage-adapter-local-storage-sdk` | Contract (SDK, published) | `package.json` | `@webex/web-client` | Active | 2026-11-09 |
41
+ | `local-storage-bounded-document` | Contract (file, internal; cross-release readability committed) | `src/index.js` | `@webex/web-client` | Active | 2026-11-09 |
42
+ | `webex-core-store-adapter-interface` | Contract (SDK, internal, consumed) | Sibling package webex-core, spec src/lib/storage/docs/README.md | `@webex/web-client`, `@webex/web-sdk` | Active | 2026-11-09 |
43
+
44
+ ### Module registry
45
+
46
+ One row per module in `.sdd/manifest.json`, which stays authoritative; this table is its
47
+ human-readable mirror and the reconciliation surface for `scripts/check_spec_index.py`.
48
+
49
+ | Module | Responsibility | Manifest coverage state | Start here |
50
+ | --- | --- | --- | --- |
51
+ | `src/` | Browser localStorage-backed bounded storage adapter for the webex-core storage layer | Partial | `src/docs/README.md` |
52
+
53
+ Generator-side field measurement is complete for `src`: 96% of mandatory fields are PRESENT, assessed
54
+ 2026-11-09. The state stays `Partial` until independent validation passes and the PRs that next touch
55
+ the module leave a clean drift record; the one weak field is executing test coverage.
56
+
57
+ ## Change and verification routing
58
+
59
+ | Change affects | Load and update | Verification route |
60
+ | ------------------------------------------------------- | --------------------------------------------------------------------------------- | ------------------------------------------------ |
61
+ | Package boundaries or cross-cutting architecture | `docs/architecture.md` | No executing suite covers this package; verify manually in a browser and state so in the PR |
62
+ | A deployable service surface or operating posture | Not applicable — no service in this package | — |
63
+ | A stable code, package, or component boundary | `src/docs/README.md` | `test:style`, `build:src`; note that `test:unit` and `test:browser` execute nothing |
64
+ | A public API, event, command, package, or file contract | The owning architecture/module section plus `package.json` | Compatibility review against `@webex/webex`, `@webex/recipe-private-web-client`, and the authorization-browser fixtures |
65
+ | The at-rest `localStorage` document layout | `src/docs/README.md` "Data, schema, and migration discipline" and `docs/architecture.md` "Repository data and schema" | Manual browser verification that a document written by the previous release still reads |
66
+
67
+ ## Module and contract registration
68
+
69
+ Each module specification is generated directly at the exact `modules[].canonical_spec` path
70
+ recorded in `.sdd/manifest.json` — here, `src/docs/README.md`. Never copy a module starter or
71
+ reconstruct a path from an example.
72
+
73
+ Contracts registered for this package:
74
+
75
+ - `storage-adapter-local-storage-sdk` — **published** SDK surface, owned by `src`. Canonical native
76
+ source `package.json`; the package ships no `.d.ts` and no API report, so that manifest is the
77
+ only machine-readable declaration. Published SDK surfaces retain their ecosystem-native artifact
78
+ and do not require OpenAPI.
79
+ - `local-storage-bounded-document` — **internal** file contract, owned by `src`. The at-rest JSON
80
+ document under `localStorage[basekey]`, canonical source `src/index.js`.
81
+ - `webex-core-store-adapter-interface` — **internal** SDK contract **consumed**, not owned. Defined
82
+ outside this SDD root by `@webex/webex-core`.
83
+
84
+ No HTTP surface exists, so `api-specs/openapi.yaml` is recorded as `omit` in
85
+ `layout.artifact_decisions`. This page provides navigation and ownership rather than a copied
86
+ contract.