@webex/internal-plugin-board 3.13.0-next.8 → 3.13.0-next.9

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,554 @@
1
+ ---
2
+ type: Module Spec
3
+ title: 'Board plugin specification'
4
+ description: Responsibilities, boundaries, design, invariants, and verification for the internal board (whiteboard) plugin module.
5
+ tags: [module, specification]
6
+ ---
7
+ <!-- sdd-generated-metadata
8
+ doc_kind: module-spec
9
+ generated_from: module-spec@0.3.0
10
+ generated_by: claude-code
11
+ approved_by: rarajes2@cisco.com
12
+ updated_at: 2026-11-12T07:38:37Z
13
+ validation_status: pass
14
+ -->
15
+
16
+ # Board plugin
17
+
18
+ This source-local document at `src/docs/README.md` owns the stable specification for **the board
19
+ plugin**: the internal `webex.internal.board` plugin that creates and manages whiteboard channels on
20
+ the Webex board service, encrypts and decrypts board content with KMS keys, uploads board images to
21
+ Webex Files, and carries live board activity over Mercury web sockets through its `realtime` child.
22
+ Ground every claim in package evidence and link to the [package architecture](../../docs/architecture.md)
23
+ instead of repeating broader facts. No service specification exists because this package is a library.
24
+
25
+ Related context: [documentation index](../../docs/index.md) ·
26
+ [package agent instructions](../../AGENTS.md)
27
+
28
+ ## Metadata
29
+
30
+ | Field | Value |
31
+ | ----------------- | ----- |
32
+ | Owner | @webex/web-sdk |
33
+ | Source path | `src` |
34
+ | Resource kind | package |
35
+ | Status | Draft |
36
+ | Last verified | 2026-11-12 at `ecd5af12a1` |
37
+ | Module id | `internal-plugin-board` |
38
+ | Parent spec | — |
39
+ | Doc kind | Module spec |
40
+ | Coverage score | 93.3% assessed 2026-11-12 — 14 of 15 mandatory fields PRESENT, critical 8 of 8; test strategy is WEAK because the payload transformer, the media-injector methods, `processActivityEvent`, and the shared-socket refresh have no test, and the realtime integration suites are `describe.skip` |
41
+ | Validation status | Pass — zero Blocking findings; validator 01a1cea3-02b3-7c72-ac41-7a08f195b1f3, assessed 2026-11-12 |
42
+
43
+ ## Applicability
44
+
45
+ | Condition ID | Status | Evidence or reason | Owned section |
46
+ | ------------------------------------ | ---------- | ------------------ | ------------- |
47
+ | `module.has_tiers` | N/A | No tier policy exists in this package or its `package.json` | Tier |
48
+ | `module.has_ui` | N/A | `src/board.js` and `src/realtime.js` make requests and send socket frames; nothing is rendered | UI use-case flow |
49
+ | `module.crosses_service_boundaries` | Applicable | `src/board.js` calls the board service, the ACL service, Webex Files, and KMS; `src/realtime.js` publishes over Mercury sockets | Cross-boundary use-case flow |
50
+ | `module.holds_client_state` | Applicable | The realtimeChannels collection in `src/realtime.js` and the per-channel session properties in `src/realtime-channel.js` | Client state model |
51
+ | `module.enforces_domain_rules` | Applicable | Cluster-local board URL selection, serial content chunks, the binding format, and the transformer predicates in `src/board.js`, `src/realtime.js`, and `src/index.js` | Business rules and invariants |
52
+ | `module.is_concurrent_async` | Applicable | Serial chunk posting, parallel encryption, socket events, and Mercury reconnect handling in `src/board.js` and `src/realtime.js` | Concurrency and reactive flow |
53
+ | `module.owns_persistence` | N/A | `src/board.js` stores nothing locally; channels and contents live in the board service | Data, schema, and migration discipline |
54
+ | `module.stateful_transitions` | N/A | Socket state belongs to the Mercury base class; this module only toggles isSharingMercury in `src/realtime.js`, covered under Client state model | State machine |
55
+ | `module.exposes_wire_protocol` | Applicable | The board REST bodies in `src/board.js` and the publishRequest frame in `src/realtime.js` | Protocol and wire format |
56
+ | `module.ui_multi_screen` | N/A | No UI | UI flow |
57
+ | `module.large_data_model` | N/A | Channel and content objects are server-owned shapes passed through `src/board.js`; the module defines no entity types | Data model |
58
+ | `module.returns_caller_errors` | Applicable | Rejections and synchronous throws from `src/board.js` and `src/realtime.js` | Caller-visible failure modes |
59
+ | `module.module_specific_conventions` | Applicable | The Board config namespace, the board. binding prefix, and the decorator-free promise style in `src/config.js` and `src/realtime.js` | Module-specific rules |
60
+ | `module.published_package` | Applicable | `package.json` names the package @webex/internal-plugin-board and defines deploy:npm | Export stability |
61
+ | `module.embedded_in_host` | N/A | No host theme or embed API | Host integration and theming |
62
+ | `module.has_design_tradeoff` | Applicable | Errors swallowed by the media-injector methods and the shared-versus-own socket choice in `src/board.js` and `src/realtime.js` | Key design trade-off |
63
+ | `module.has_submodules` | N/A | The src directory has no child module | Sub-modules |
64
+
65
+ ## Evidence register
66
+
67
+ | Evidence | What it establishes |
68
+ | -------- | ------------------- |
69
+ | `src/index.js` | Side-effect imports of the mercury, encryption, conversation, and feature plugins; `registerInternalPlugin('board', Board, {config, payloadTransformer})` with the `decryptContents` and `encryptChannel` predicates and transforms; exports default `Board`, named `config`, named `RealtimeChannel` |
70
+ | `src/board.js` | The `Board` plugin (namespace `Board`, child `realtime`): channel, content, image, lock, keep-alive, registration, shared-Mercury, and media-injector methods. Its JSDoc and inline comments are the only recorded rationale |
71
+ | `src/realtime.js` | `RealtimeService` (namespace `Board`, collection `realtimeChannels`): publish, channel creation, own-socket and shared-socket connect and disconnect, activity routing |
72
+ | `src/realtime-channel.js` | `RealtimeChannel`, a `Mercury.extend` subclass in namespace `Board` with props `channelId`, `socketUrl`, `binding` and session `isSharingMercury`, `socket`; `send(data)` forwards to `socket.send` |
73
+ | `src/realtime-channel-collection.js` | Ampersand collection of `RealtimeChannel` keyed by `channelId` |
74
+ | `src/config.js` | `webex.config.board` defaults: content page sizes, socket timers read from `MERCURY_*` environment variables, and the `board.` binding prefix |
75
+ | `package.json` | Name, `main` (`dist/index.js`), `devMain` (`src/index.js`), `engines` (`node >=16`), dependencies, and scripts; the aggregate `test` script calls an undefined `test:integration` |
76
+ | `process` | Package-root module exporting `{browser: true}`; nothing in `src/` imports it and no package script names it |
77
+ | `test/unit/spec/board.js` | Unit cases for content, snapshot, channel creation and cluster routing, delete, lock, keep-alive, upload, get, register, and shared-Mercury registration. It imports the package by name, so it loads `dist/` |
78
+ | `test/unit/spec/encryption.js` | Unit cases for `decryptContents` and `encryptContents`, including FILE metadata and the device type |
79
+ | `test/unit/spec/realtime.js` | Unit cases for publish, own-socket connect and disconnect, shared-socket connect and disconnect, binding format, activity routing, and socket message emission |
80
+ | `test/integration/spec/board.js` | Live-service cases for the REST and image methods; the "#deletePartialContent()" block is `describe.skip` |
81
+ | `test/integration/spec/realtime.js` | Live-service realtime cases, including the board config check; the whole file is `describe.skip` |
82
+ | `test/integration/spec/sharing-mercury.js` | Live-service shared-socket cases; the whole file is `describe.skip` |
83
+ | `README.md` | Retained npm page; context only. Its usage block is the placeholder `webex.internal.board.WHATEVER`; see `docs/adr/0001-retain-product-readme.md` |
84
+ | Sibling package webex-core, file src/docs/README.md | Module spec consulted. `registerInternalPlugin` merges `config` and concatenates `payloadTransformer` predicates and transforms into the default config (MOD-008); `transform(direction, object)` runs predicates whose direction matches (MOD-037); `WebexPlugin.config` is the lowercased namespace key of `webex.config` (MOD-044); `Page` wraps one list response and follows Link headers (MOD-054); `webex.upload` runs the three-phase upload |
85
+ | Sibling package webex-core, file src/lib/services/docs/README.md | Module spec consulted. `getServiceFromUrl` matches a URL by origin and path (SVC-014); `getClusterId` and `getServiceFromClusterId` map between URLs, cluster ids, and services (SVC-018) |
86
+ | Sibling package webex-core, file src/webex-core.js | Source consulted for the transform lookup: a predicate or transform without a `direction` matches every direction |
87
+ | Sibling package internal-plugin-mercury, file src/docs/README.md | Module spec consulted. `connect(webSocketUrl)` registers the device when needed and resolves when online (MOD-002); socket timers come from the plugin's own config (MOD-004); envelopes are emitted as `event:<eventType>` (MOD-009); `localClusterServiceUrls` is stored from `mercury.registration_status` (MOD-010); `disconnect()` closes the socket (MOD-011); it lists this package's `RealtimeChannel` as a `Mercury.extend` subclass |
88
+ | Sibling package internal-plugin-feature, file src/docs/README.md | Module spec consulted. `getFeature(keyType, key)` resolves the toggle value, or `null` when the key is unknown (MOD-003, MOD-004) |
89
+ | Sibling package internal-plugin-device, file src/docs/README.md | Module spec consulted. `webex.internal.device` exposes `webSocketUrl` and the registration `deviceType`; it is reached through the mercury plugin, which imports it |
90
+ | Sibling package common, file src/docs/README.md | Module spec consulted. `tap` passes the original value through and never rejects, even when its callback throws (MOD-003) |
91
+ | Sibling package internal-plugin-encryption, files src/encryption.js, src/kms.js, src/index.js | Source consulted (no spec). `encryptText`, `decryptText`, `encryptScr` (rejects when `scr.loc` is unset), `decryptScr`, `encryptBinary` resolving `{scr, cdata}`; `kms.createUnboundKeys`, `prepareRequest`, `decryptKmsMessage`, `listAuthorizations`, `removeAuthorization`; the `encryptKmsMessage` predicate skips a `kmsMessage` whose `keyUris` is empty, and the transform wraps the message |
92
+ | Sibling package internal-plugin-conversation, file src/index.js | Source consulted (no spec). Imported only for its side effect of registering internal plugin `conversation`; this module reads `aclUrl` and `kmsResourceObjectUrl` from conversation objects the caller passes in |
93
+ | Sibling package eslint-config-legacy, file static/ignore-patterns.js | Source consulted. `docs/**` and `*.md` are ignored, so this specification is not linted; no source file of this package is on the decorator list |
94
+ | npm package es6-promise-series | Source consulted. Called with an array of functions, it runs them one at a time and resolves the concatenation of their results |
95
+ | Observation, no stated WHY | The `encryptChannel` transform declares `direciton` instead of `direction`; `authorizeMediaInjector` and `unauthorizeMediaInjector` create a rejected promise for a missing board but do not return it; `keepActive` resolves the whole response while sibling methods resolve the body; `getContents` and `getChannels` call `this.request` while the others call `this.webex.request` |
96
+
97
+ ## Purpose and boundary
98
+
99
+ - Responsibility: give first-party clients a whiteboard API on `webex.internal.board`. That means
100
+ creating, listing, reading, locking, keeping alive, and deleting board channels tied to a
101
+ conversation; adding, reading, and clearing encrypted board contents; uploading board images and
102
+ snapshots to Webex Files; authorizing a transcoder for whiteboard sharing to mobile; and exchanging
103
+ live board activity over Mercury, either on a socket of the board's own or on the shared Mercury
104
+ socket.
105
+ - In scope: every method of `Board` and `RealtimeService`; the board REST request shapes; content
106
+ encryption and decryption; the board `payloadTransformer` predicates and transforms; the
107
+ `publishRequest` frame and the `board.activity` routing; the `webex.config.board` defaults.
108
+ - Out of scope: KMS key creation, wrapping, and JWE cryptography (the encryption plugin); socket
109
+ lifecycle, backoff, and ping/pong (the Mercury base class); service catalog lookups and cluster maps
110
+ (webex-core services); feature toggles (the feature plugin); device registration (the device plugin);
111
+ conversation objects and their ACL (the conversation plugin and its services); drawing and rendering
112
+ of curves, text, and images (the host client; the board service stores opaque encrypted payloads).
113
+ - Consumers: `@webex/webex-server` and `@webex/recipe-private-web-client`, which import this package
114
+ for its side effect, and first-party clients that call `webex.internal.board`.
115
+
116
+ ## Structure and key files
117
+
118
+ | Path | Responsibility |
119
+ | ---- | -------------- |
120
+ | `src/index.js` | Imports four sibling plugins, registers internal plugin `board` with `config` and the payload transformer, and re-exports `Board` (default), `config`, and `RealtimeChannel` |
121
+ | `src/board.js` | The `Board` plugin, built with `WebexPlugin.extend` in namespace `Board`, with child `realtime` |
122
+ | `src/realtime.js` | The `RealtimeService` child plugin and its `realtimeChannels` collection |
123
+ | `src/realtime-channel.js` | `RealtimeChannel`, one board's Mercury connection or shared-socket handle |
124
+ | `src/realtime-channel-collection.js` | Collection of `RealtimeChannel` keyed by `channelId` |
125
+ | `src/config.js` | `webex.config.board` defaults |
126
+ | `process` | Package-root file exporting `{browser: true}`; not imported by `src/` |
127
+ | `package.json` | Package name, entry points, scripts, and dependencies |
128
+ | `babel.config.js`, `jest.config.js` | Re-exports of the legacy Babel and Jest configurations |
129
+ | `.eslintrc.js` | Sets `root: true` and extends `@webex/eslint-config-legacy` |
130
+ | `src/docs/README.md` | This module specification; ignored by the build and by lint |
131
+ | `test/unit/spec/board.js`, `test/unit/spec/encryption.js`, `test/unit/spec/realtime.js` | Unit specs run by Jest through `webex-legacy-tools` |
132
+ | `test/integration/spec/board.js`, `test/integration/spec/realtime.js`, `test/integration/spec/sharing-mercury.js` | Live-service specs run only by `test:browser` (karma); the last two are skipped |
133
+ | dist/ (generated) | Build output of `build:src`; ignored by Git and never edited by hand |
134
+
135
+ ## Public surface
136
+
137
+ | Surface | Consumer | Compatibility commitment | Source |
138
+ | ------- | -------- | ------------------------ | ------ |
139
+ | Import side effect: internal plugins `mercury`, `encryption`, `conversation`, `feature`, and `board`, plus the board payload transformer | `@webex/webex-server`, `@webex/recipe-private-web-client`, first-party clients | First registration of a name wins | `src/index.js` |
140
+ | Default export `Board`, named exports `config` and `RealtimeChannel` | Unit specs and packages that build on the class | No versioning rule is declared; the README states the plugin does not strictly follow semver | `src/index.js` |
141
+ | Channel methods `createChannel`, `getChannel`, `getChannels`, `deleteChannel`, `lockChannelForDeletion`, `keepActive`, `getClusterBoardServiceUrl` | First-party clients | Resolve the response body (`keepActive` resolves the whole response; list methods resolve a `Page`) | `src/board.js` |
142
+ | Content methods `addContent`, `addImage`, `setSnapshotImage`, `getContents`, `deleteAllContent`, `deletePartialContent`, `encryptContents`, `decryptContents`, `encryptSingleContent`, `encryptSingleFileContent`, `decryptSingleContent`, `decryptSingleFileContent`, `processActivityEvent` | First-party clients and the realtime child | Content objects are opaque client shapes encrypted as JSON | `src/board.js` |
143
+ | Registration methods `ping`, `register`, `registerToShareMercury`, `unregisterFromSharedMercury` | The realtime child and first-party clients | Resolve the response body | `src/board.js` |
144
+ | Transcoder methods `authorizeMediaInjector`, `unauthorizeMediaInjector` | First-party clients sharing a whiteboard to mobile | Never reject once started; errors resolve as values | `src/board.js` |
145
+ | `webex.internal.board.realtime` methods `publish`, `publishEncrypted`, `createRealtimeChannel`, `connectByOpenNewMercuryConnection`, `disconnectMercuryConnection`, `connectToSharedMercury`, `disconnectFromSharedMercury`, `handleBoardActivityMessages`, `refreshMercurySocketReference`, and the `realtimeChannels` collection | First-party clients | Each `RealtimeChannel` emits `event:board.activity` | `src/realtime.js` |
146
+ | `webex.config.board` keys `numberContentsPerPageForAdd`, `numberContentsPerPageForGet`, `pingInterval`, `pongTimeout`, `forceCloseDelay`, `mercuryBindingPrefix` | Integrators through `Webex.init` config | Defaults below under Requirements `MOD-002` | `src/config.js` |
147
+
148
+ Methods prefixed with `_` (`_prepareChannel`, `_addContentChunk`, `_uploadImage`, `_getSpaceUrl`,
149
+ `_uploadImageToWebexFiles`, `_boardChannelIdToMercuryBinding`) are internal; only `_uploadImage` is
150
+ marked `@private` in its JSDoc. Contract ID `board-internal-sdk` is indexed in the
151
+ [package architecture](../../docs/architecture.md#public-and-consumer-surfaces) and registered in
152
+ `.sdd/manifest.json`. Export stability is under [Export stability](#export-stability).
153
+
154
+ ## Dependencies
155
+
156
+ | Dependency | Why it is required | Failure behavior |
157
+ | ---------- | ------------------ | ---------------- |
158
+ | `@webex/webex-core` plugin host (module spec consulted) | `WebexPlugin`, `registerInternalPlugin`, `Page`, `this.webex.request`, `this.webex.upload`, namespaced `config`, `logger`, and the payload transformer | Request and upload rejections propagate, except inside the media-injector methods |
159
+ | `@webex/webex-core` services (module spec consulted) | `getClusterId` and `getServiceFromClusterId` for the cluster-local board URL; `getServiceFromUrl` in the `encryptChannel` predicate | An unresolved cluster falls back to the catalog `board` service |
160
+ | `@webex/internal-plugin-encryption` (code consulted; no spec) | Text, SCR, and binary encryption; KMS unbound keys, request wrapping, authorization listing and removal | Rejections propagate, except inside the media-injector methods |
161
+ | `@webex/internal-plugin-mercury` (module spec consulted) | `Mercury` base class for `RealtimeChannel`; the shared socket, its `online` event, `event:board.activity`, and `localClusterServiceUrls` | `connect()` rejections propagate to the caller |
162
+ | `@webex/internal-plugin-feature` (module spec consulted) | Developer toggle `web-shared-mercury` | A disabled toggle rejects `registerToShareMercury` |
163
+ | `@webex/internal-plugin-conversation` (code consulted; no spec) | Imported for its side effect; callers pass conversation objects carrying `aclUrl` and `kmsResourceObjectUrl` | Not applicable |
164
+ | `@webex/internal-plugin-device` (module spec consulted; not declared in `package.json`) | `deviceType` stamped on encrypted contents; `webSocketUrl` sent when sharing Mercury | Undefined values are sent as-is |
165
+ | `@webex/common` (module spec consulted) | `tap` around collection removal after disconnect | Never rejects |
166
+ | Board service (external) | Channels, contents, locks, spaces, registrations, share policies | HTTP errors propagate |
167
+ | ACL service (external) | Removing the conversation-to-board ACL link on delete | HTTP errors propagate |
168
+ | Webex Files (external) | Encrypted image upload through the board space URL | Upload errors propagate |
169
+ | `ampersand-collection` | `RealtimeChannelCollection` | Not applicable |
170
+ | `es6-promise-series` | Serial chunk posting in `addContent` | The first rejected chunk rejects the call; later chunks are not sent |
171
+ | `lodash` | `assign`, `defaults`, `chunk`, `pick`, `has`, `get` | Not applicable |
172
+ | `uuid` | Version 4 frame ids in `publishEncrypted` | Not applicable |
173
+ | Node `querystring` | The `authId` query on the delete KMS message | Not applicable |
174
+
175
+ ## Requirements
176
+
177
+ | ID | WHAT | WHY | Source evidence | Test or example evidence | Assumptions or gaps | Confidence |
178
+ | -- | ---- | --- | --------------- | ------------------------ | ------------------- | ---------- |
179
+ | `MOD-001` | Importing the package imports the mercury, encryption, conversation, and feature plugins, then registers internal plugin `board` (with child `realtime`) with the package config and the payload transformer. It exports `Board` (default), `config`, and `RealtimeChannel`. | The board needs sockets, encryption, conversations, and toggles on every instance, so it pulls those plugins in rather than relying on the host's import order. | `src/index.js`, `src/board.js` | `test/unit/spec/board.js` "has a child of realtime"; every unit spec imports the package by name | The unit specs mount `Board` through MockWebex children, so `registerInternalPlugin` and the transformer registration are not exercised | Present |
180
+ | `MOD-002` | `webex.config.board` defaults to `numberContentsPerPageForAdd` 150, `numberContentsPerPageForGet` 1000, `pingInterval` `MERCURY_PING_INTERVAL` or 15000, `pongTimeout` `MERCURY_PONG_TIMEOUT` or 14000, `forceCloseDelay` `MERCURY_FORCE_CLOSE_DELAY` or 2000, and `mercuryBindingPrefix` `board.`. | The JSDoc: page sizes bound each add and get request; the timers govern board sockets; the prefix forms the board binding. `RealtimeChannel` shares namespace `Board`, so its Mercury config is this block. | `src/config.js`, `src/realtime-channel.js` | `test/unit/spec/board.js` page-size cases; `test/integration/spec/realtime.js` "shares board values" (skipped) | An environment value arrives as a string, not a number; Mercury keys such as `backoffTimeMax` are undefined for board sockets | Present |
181
+ | `MOD-003` | The inbound `decryptContents` predicate fires only when the response body has a non-empty `items`, `items[0].contentId`, `items[0].encryptionKeyUrl`, and `items[0].payload` or `items[0].file`; its transform replaces `body.items` with `decryptContents(body)`. | Board content responses arrive encrypted, and the transformer lets every request path (including `Page.next`) return decrypted items. | `src/index.js` | `test/integration/spec/board.js` "#getContents()" cases read plaintext back | No unit case; only the first item is inspected | Weak |
182
+ | `MOD-004` | The outbound `encryptChannel` predicate fires when the request URI resolves to service `board` and the body has `aclUrlLink`; its transform creates one KMS unbound key, sets `defaultEncryptionKeyUrl` to the key URI, pushes it onto `kmsMessage.keyUris`, and then applies `encryptKmsMessage`. | A new channel needs its own content key bound to a KMS resource; the encryption plugin skips a `kmsMessage` with empty `keyUris`, so this transform fills the key before wrapping. | `src/index.js` | `test/integration/spec/board.js` creates channels in its setup | No unit case. The transform spells `direciton`, so it has no direction and matches either direction by name; only the outbound predicate triggers it | Weak |
183
+ | `MOD-005` | `getClusterBoardServiceUrl(conversation)` returns `undefined` without `conversation.aclUrl` or a cluster id, else the `url` of the service whose cluster id is the ACL cluster id with its last segment replaced by `board`. `createChannel` and `getChannels` send to `<that url>/channels` when it resolves, else to catalog service `board`, resource `/channels`. | In-code comment: board data lives in the cluster encoded by the ACL URL, and the home board cluster answers with a cross-cluster 307 the browser cannot follow. | `src/board.js` | `test/unit/spec/board.js` "#createChannel()" and "#getChannels()" cluster and fallback cases | No direct unit case for the helper | Present |
184
+ | `MOD-006` | `createChannel(conversation, channel)` POSTs `{aclUrlLink: conversation.aclUrl, kmsMessage: {method: 'create', uri: '/resources', userIds: [conversation.kmsResourceObjectUrl when set], keyUris: []}, ...channel}` and resolves the body. | The board must be bound to the conversation ACL and authorized to the conversation's KMS resource; spreading `channel` lets callers create ambiguous (PMR) or annotated channels. | `src/board.js` | `test/unit/spec/board.js` "supports creating ambiguous channels for PMR support" | Caller fields override the defaults, including `kmsMessage` | Present |
185
+ | `MOD-007` | `getChannels(conversation, options)` rejects `` `conversation` is required `` without a conversation, else GETs with `qs.aclUrlLink` plus `channelsLimit` and `type` from options and resolves a `Page`. `getChannel(channel)` GETs `channelUrl` and resolves the body. | Channels are listed per conversation ACL; paging keeps large lists bounded. | `src/board.js` | `test/unit/spec/board.js` "#getChannels()" cases, "requires conversationId", "#getChannel()"; `test/integration/spec/board.js` "#getChannels()" multi-page case | None | Present |
186
+ | `MOD-008` | `getContents(channel, options)` GETs `<channelUrl>/contents` with `contentsLimit` from `options.contentsLimit`, else `numberContentsPerPageForGet`, and resolves a `Page`. | The JSDoc: retrieve contents of a channel page by page. | `src/board.js` | `test/unit/spec/board.js` default and client page-size cases; `test/integration/spec/board.js` large data sets | Decryption is left to `MOD-003` | Present |
187
+ | `MOD-009` | `addContent(channel, contents)` splits contents into chunks of `numberContentsPerPageForAdd`, and for each chunk in turn encrypts it and POSTs it to `<channelUrl>/contents`; it resolves the concatenation of the response bodies, `[]` for no contents. | In-code comment: each chunk waits for the previous one, or there would be race conditions among patches. | `src/board.js` | `test/unit/spec/board.js` "requests POST all contents to contents", "sends large data using multiple requests" | A failed chunk stops the series; earlier chunks stay stored | Present |
188
+ | `MOD-010` | `encryptContents(keyUrl, contents)` encrypts each item in parallel and returns `{device: webex.internal.device.deviceType, type, encryptionKeyUrl}` plus `file` and `payload`. An item with `file` is `FILE`: its `file.scr` is encrypted in place and its `metadata`, merged with `displayName`, becomes the encrypted `payload`. Any other item is `STRING`: the whole item, as JSON, becomes the encrypted `payload`. | The JSDoc: the existence of an SCR determines a FILE; the board service stores only ciphertext and needs the key URL and type to hand content back. | `src/board.js` | `test/unit/spec/encryption.js` "#encryptContents" cases including "sets the device to config deviceType" | The FILE path mutates the caller's object | Present |
189
+ | `MOD-011` | `decryptContents(contents)` decrypts each of `contents.items` in parallel: a `FILE` item decrypts `file.scr` and, when present, its `payload` as metadata (unparsable metadata becomes `{}`, `displayName` is copied up); any other item decrypts `payload` and parses it as JSON. `payload` and `encryptionKeyUrl` are removed and the decrypted fields take precedence over the remaining item fields. | Reverse of `MOD-010`, returning client-shaped content. | `src/board.js` | `test/unit/spec/encryption.js` "#decryptContents" cases including "does not require payload when type is FILE" and "decrypts FILE metadata displayName" | A non-JSON STRING payload rejects | Present |
190
+ | `MOD-012` | `_uploadImage(channel, file, options)` encrypts the binary, PUTs `<channelUrl>/spaces/open` (or `/spaces/hidden` with `hiddenSpace`) to get `spaceUrl`, uploads to `<spaceUrl>/upload_sessions` with `transcode: true` and `fileSize` from `length`, else `size`, else `byteLength`, and resolves the SCR with `loc` set to the `downloadUrl`. `addImage` adds that as one `FILE` content with `mimeType`, `scr`, `size`, `url`, and caller `metadata`. | The JSDoc: upload the image to Webex Files and add SCR plus download URL to the persistence service. | `src/board.js` | `test/unit/spec/board.js` "#_uploadImage()", "#_uploadImageToWebexFiles()" cases; `test/integration/spec/board.js` "#addImage()" cases | `addImage` has no unit case | Present |
191
+ | `MOD-013` | `setSnapshotImage(channel, image)` uploads to the hidden space, encrypts the SCR with `channel.defaultEncryptionKeyUrl`, PATCHes `channelUrl` with `image: {url, height (default 900), width (default 1600), mimeType (default image/png), scr, encryptionKeyUrl, fileSize}`, and resolves the body. | The JSDoc: set a snapshot image for a board; the hidden space keeps snapshots out of the open content space. | `src/board.js` | `test/unit/spec/board.js` "requests PATCH to board service"; `test/integration/spec/board.js` "#setSnapshotImage()" | None | Present |
192
+ | `MOD-014` | `deleteChannel(conversation, channel, options)` PUTs `<channel.aclUrl>/links` with `{aclLinkType: 'INCOMING', linkedAcl: conversation.aclUrl, kmsMessage: {method: 'delete', uri: '<kmsResourceUrl>/authorizations?authId=<conversation.kmsResourceObjectUrl>'}, aclLinkOperation: 'DELETE'}` and resolves the body; with `preventDeleteActiveChannel` it first calls `lockChannelForDeletion`. | In-code comments: remove the ACL link between conversation and board and remove the conversation's authorization from the board KRO. | `src/board.js` | `test/unit/spec/board.js` "#deleteChannel()" cases; `test/integration/spec/board.js` "#deleteChannel()" cases | None | Present |
193
+ | `MOD-015` | `lockChannelForDeletion(channel)` POSTs `<channelUrl>/lock?intent=delete` and resolves the body; `keepActive(channel)` POSTs `<channelUrl>/keepAlive` and resolves the whole response. | The JSDoc: a channel in use answers 409 Conflict to the lock, and keep-alive keeps a channel active so others cannot delete it. | `src/board.js` | `test/unit/spec/board.js` "#lockChannelForDeletion()", "#keepActive()"; `test/integration/spec/board.js` "does not delete when a channel is being used" | None | Present |
194
+ | `MOD-016` | `deleteAllContent(channel)` DELETEs `<channelUrl>/contents`; `deletePartialContent(channel, keep)` POSTs `[{contentId}]` for each kept item to `<channelUrl>/contents?clearBoard=true`. Both resolve the body. | The JSDoc: clear a board, or clear all but the listed contents. | `src/board.js` | `test/unit/spec/board.js` "#deleteAllContent()", "#deletePartialContent()"; `test/integration/spec/board.js` "#deleteAllContent()" | In-code note: the partial-delete API has changed and the method needs updating; its integration block is `describe.skip` | Weak |
195
+ | `MOD-017` | `ping()` GETs board service `/ping`; `register(data)` POSTs `data` to board service `/registrations`. Both resolve the body. | `register` obtains the Mercury `webSocketUrl` and bindings for a board socket (`MOD-021`). | `src/board.js` | `test/unit/spec/board.js` "#register()"; `test/integration/spec/board.js` "#ping()" | `ping` has no unit case | Present |
196
+ | `MOD-018` | `registerToShareMercury(channel)` reads developer toggle `web-shared-mercury`, rejects `` `localClusterServiceUrls` is not defined, make sure mercury is connected `` when Mercury has no `localClusterServiceUrls`, rejects `` `web-shared-mercury` is not enabled `` when the toggle is off, and otherwise POSTs `{mercuryConnectionServiceClusterUrl, webSocketUrl: device.webSocketUrl, action: 'ADD'}` to `<channelUrl>/register`. `unregisterFromSharedMercury(channel, binding)` POSTs `{binding, webSocketUrl, action: 'REMOVE'}` to the same URL. Both resolve the body. | Sharing lets a board ride the existing Mercury connection; the server needs the client's Mercury cluster and socket to add or remove the board binding. | `src/board.js` | `test/unit/spec/board.js` "#registerToShareMercury()" cases | `unregisterFromSharedMercury` is only stubbed in unit specs | Present |
197
+ | `MOD-019` | `authorizeMediaInjector(board)` prepares a KMS `create /authorizations` request for `board.kmsResourceUrl` with `anonymous: 1`, PUTs its wrapped form to `<channelUrl>/sharePolicies/transcoder`, decrypts `kmsResponse`, and resolves the first authorization's `bearer`, else `undefined`. Any error resolves as the error object. `unauthorizeMediaInjector(board)` lists the KRO's authorizations and removes each, resolving the removed `authId`s and error objects, or `[]`; a listing failure rejects. | In-code comments: errors resolve so whiteboard sharing still works except for mobile receivers, and removal also clears earlier authorizations that were not cleared. | `src/board.js` | None found | No test. A missing `board` throws a `TypeError` instead of the intended rejection | Weak |
198
+ | `MOD-020` | `processActivityEvent(message)` decrypts `message.payload` with `message.envelope.encryptionKeyUrl` as FILE or STRING by `message.contentType`, replaces `payload`, and resolves the message. | Activity frames carry the same encrypted shapes as stored contents (`MOD-021`). | `src/board.js` | None found | No caller in this package and no test | Weak |
199
+ | `MOD-021` | `createRealtimeChannel(channel)` registers binding `mercuryBindingPrefix` + `channelId` with every `-` replaced by `.` and every `_` by `#`, adds `RealtimeChannel {channelId, socketUrl: webSocketUrl, binding: bindings[0]}`, and resolves it. `connectByOpenNewMercuryConnection(channel)` creates the channel when missing and calls its `connect(socketUrl)`. `disconnectMercuryConnection(channel)` rejects `Realtime Channel not found!` when missing, else disconnects and removes it. | The JSDoc: make the channel id compatible with Mercury bindings. | `src/realtime.js` | `test/unit/spec/realtime.js` "#_boardChannelIdToMercuryBinding", "#connectByOpenNewMercuryConnection()", "#disconnectMercuryConnection" cases | None | Present |
200
+ | `MOD-022` | `publish(channel, message)` encrypts `message.payload` as FILE (when it has `file`) or STRING with `channel.defaultEncryptionKeyUrl` and calls `publishEncrypted`. `publishEncrypted` rejects `Realtime Channel not found` when no channel is held, else sends the `publishRequest` frame under Protocol and wire format and resolves the socket `send` result. | The JSDoc: send a message on the board socket, with `contentType` as a decryption hint. | `src/realtime.js`, `src/realtime-channel.js` | `test/unit/spec/realtime.js` "#publish()", "#publishEncrypted()" cases | None | Present |
201
+ | `MOD-023` | `connectToSharedMercury(channel)` calls `registerToShareMercury`, adds the channel with the returned `binding` and `webSocketUrl`, and, when `sharedWebSocket` is false, connects the channel's own socket. When it is true, it sets `isSharingMercury`, points `socket` at `webex.internal.mercury.socket`, and subscribes once each to Mercury `online` (to refresh every channel's socket) and `event:board.activity` (to route activity). It resolves the registration body. | In-code comments: refresh the socket reference when Mercury reconnects, and keep only one handler. | `src/realtime.js` | `test/unit/spec/realtime.js` "#connectToSharedMercury" cases | `refreshMercurySocketReference` has no test | Present |
202
+ | `MOD-024` | `handleBoardActivityMessages(event)` emits `event:board.activity` with the event on the channel whose `channelId` equals `event.data.envelope.channelId` and ignores unknown channels. A channel on its own socket emits the same event from Mercury's envelope routing. | One shared socket carries every board's activity, so each channel must receive only its own. | `src/realtime.js`, `src/realtime-channel.js` | `test/unit/spec/realtime.js` "finds the realtimeChannel from the envelope", "emits message" | None | Present |
203
+ | `MOD-025` | `disconnectFromSharedMercury(channel)` disconnects the channel's own socket when it is not sharing and its socket is connected; otherwise it calls `unregisterFromSharedMercury` with the channel binding. Either way the channel is removed from the collection. | The two connect paths need the matching teardown. | `src/realtime.js` | `test/unit/spec/realtime.js` "#disconnectFromSharedMercury()" cases | An unknown channel throws a `TypeError` synchronously | Present |
204
+
205
+ ## Design overview
206
+
207
+ `Board` extends `WebexPlugin` in namespace `Board`, so `this.config` is `webex.config.board`. It is a
208
+ stateless request builder: every channel, content, and image lives in the board service, and the
209
+ caller passes channel and conversation objects back in. Encryption keys come from the conversation and
210
+ the channel: a channel's `defaultEncryptionKeyUrl` is created by the `encryptChannel` transform at
211
+ creation time, and every content item is encrypted with it before it leaves the client.
212
+
213
+ The payload transformer registered in `src/index.js` makes encryption transparent on two paths:
214
+ channel creation (outbound, fills and wraps the KMS message) and content reads (inbound, decrypts
215
+ items). Writes call `encryptContents` explicitly.
216
+
217
+ The `realtime` child keeps one `RealtimeChannel` per connected board. A channel either opens its own
218
+ Mercury socket, registered through the board service, or rides the SDK's main Mercury socket when the
219
+ `web-shared-mercury` toggle is on and the server answers `sharedWebSocket: true`. `RealtimeChannel`
220
+ reuses the whole Mercury implementation under namespace `Board`, so socket timers come from the board
221
+ config.
222
+
223
+ ## Data flow and sequence coverage
224
+
225
+ Call style: in-process calls on `webex.internal.board`; outbound HTTPS through `webex.request` and
226
+ `webex.upload`; frames over Mercury web sockets. Four operation groups differ in actors, ordering, or
227
+ outcome, and each has a diagram. Single-request methods (`getChannel`, locks, keep-alive, content
228
+ deletes, `ping`) follow the same request-and-resolve-body shape and are covered by Requirements.
229
+
230
+ | Operation group | Entry and outcome | Diagram or evidence | Failure and recovery coverage |
231
+ | --------------- | ----------------- | ------------------- | ----------------------------- |
232
+ | Create a channel | `createChannel` resolves the channel with its content key | Create diagram; `src/board.js`, `src/index.js` | Request or KMS rejection propagates |
233
+ | Add and read contents | `addContent` posts encrypted chunks; `getContents` returns decrypted pages | Content diagram; `src/board.js` | First failed chunk rejects |
234
+ | Upload an image | `addImage` and `setSnapshotImage` store encrypted image references | Image diagram; `src/board.js` | Upload rejection propagates |
235
+ | Live activity | `connectToSharedMercury` or `connectByOpenNewMercuryConnection`, then `publish` and `event:board.activity` | Realtime diagram; `src/realtime.js` | Missing channel rejects; shared registration rejects when the toggle or cluster URLs are missing |
236
+
237
+ ### Create a channel
238
+
239
+ ```mermaid
240
+ sequenceDiagram
241
+ participant Client as First-party client
242
+ participant Board as Board
243
+ participant Svc as webex.internal.services
244
+ participant PT as payload transformer
245
+ participant KMS as encryption.kms
246
+ participant BS as board service
247
+ Client->>Board: createChannel(conversation, channel)
248
+ Board->>Board: body aclUrlLink, kmsMessage create with keyUris empty
249
+ Board->>Svc: getClusterId(aclUrl), getServiceFromClusterId(board cluster)
250
+ alt cluster board URL resolves
251
+ Svc-->>Board: url
252
+ else no cluster URL
253
+ Svc-->>Board: undefined, use catalog service board
254
+ end
255
+ Board->>PT: outbound request
256
+ PT->>KMS: createUnboundKeys count 1
257
+ KMS-->>PT: key
258
+ PT->>PT: defaultEncryptionKeyUrl and keyUris set, then encryptKmsMessage wraps
259
+ PT->>BS: POST /channels
260
+ BS-->>Board: channel
261
+ Board-->>Client: channel body
262
+ ```
263
+
264
+ ### Add and read contents
265
+
266
+ ```mermaid
267
+ sequenceDiagram
268
+ participant Client as First-party client
269
+ participant Board as Board
270
+ participant Enc as encryption
271
+ participant BS as board service
272
+ Client->>Board: addContent(channel, contents)
273
+ loop each chunk of numberContentsPerPageForAdd, one at a time
274
+ Board->>Enc: encrypt each item with defaultEncryptionKeyUrl
275
+ Board->>BS: POST channelUrl/contents
276
+ BS-->>Board: body
277
+ end
278
+ Board-->>Client: concatenated bodies
279
+ Client->>Board: getContents(channel, {contentsLimit})
280
+ Board->>BS: GET channelUrl/contents
281
+ BS-->>Board: encrypted items
282
+ Board->>Enc: inbound decryptContents transform
283
+ Board-->>Client: Page of decrypted items
284
+ ```
285
+
286
+ ### Upload an image
287
+
288
+ ```mermaid
289
+ sequenceDiagram
290
+ participant Client as First-party client
291
+ participant Board as Board
292
+ participant Enc as encryption
293
+ participant BS as board service
294
+ participant Files as Webex Files
295
+ Client->>Board: addImage(channel, image, metadata) or setSnapshotImage(channel, image)
296
+ Board->>Enc: encryptBinary(image)
297
+ Enc-->>Board: scr and cipher data
298
+ Board->>BS: PUT channelUrl/spaces/open or hidden
299
+ BS-->>Board: spaceUrl
300
+ Board->>Files: upload spaceUrl/upload_sessions, transcode true
301
+ Files-->>Board: downloadUrl, set as scr.loc
302
+ alt addImage
303
+ Board->>Board: addContent with one FILE item
304
+ else setSnapshotImage
305
+ Board->>Enc: encryptScr
306
+ Board->>BS: PATCH channelUrl with image
307
+ end
308
+ Board-->>Client: body
309
+ ```
310
+
311
+ ### Live activity
312
+
313
+ ```mermaid
314
+ sequenceDiagram
315
+ participant Client as First-party client
316
+ participant RT as realtime
317
+ participant Board as Board
318
+ participant BS as board service
319
+ participant Merc as webex.internal.mercury
320
+ participant RC as RealtimeChannel
321
+ Client->>RT: connectToSharedMercury(channel)
322
+ RT->>Board: registerToShareMercury(channel)
323
+ Board->>BS: POST channelUrl/register action ADD
324
+ BS-->>RT: binding, webSocketUrl, sharedWebSocket
325
+ alt sharedWebSocket true
326
+ RT->>RC: isSharingMercury true, socket is Mercury socket
327
+ RT->>Merc: on online and event:board.activity
328
+ else sharedWebSocket false
329
+ RT->>RC: connect(webSocketUrl)
330
+ end
331
+ Client->>RT: publish(channel, message)
332
+ RT->>Board: encrypt payload
333
+ RT->>RC: send publishRequest frame
334
+ Merc-->>RT: event:board.activity
335
+ RT->>RC: emit event:board.activity when channelId matches
336
+ RC-->>Client: event:board.activity
337
+ ```
338
+
339
+ ## Class and component relationships
340
+
341
+ ```mermaid
342
+ classDiagram
343
+ class WebexPlugin
344
+ class Mercury
345
+ class Board {
346
+ namespace Board
347
+ realtime
348
+ createChannel()
349
+ addContent()
350
+ getContents()
351
+ encryptContents()
352
+ decryptContents()
353
+ registerToShareMercury()
354
+ authorizeMediaInjector()
355
+ }
356
+ class RealtimeService {
357
+ namespace Board
358
+ realtimeChannels
359
+ publish()
360
+ connectToSharedMercury()
361
+ connectByOpenNewMercuryConnection()
362
+ handleBoardActivityMessages()
363
+ }
364
+ class RealtimeChannelCollection {
365
+ mainIndex channelId
366
+ }
367
+ class RealtimeChannel {
368
+ channelId
369
+ socketUrl
370
+ binding
371
+ isSharingMercury
372
+ send()
373
+ }
374
+ WebexPlugin <|-- Board
375
+ WebexPlugin <|-- RealtimeService
376
+ Mercury <|-- RealtimeChannel
377
+ Board *-- RealtimeService : child realtime
378
+ RealtimeService *-- RealtimeChannelCollection
379
+ RealtimeChannelCollection o-- RealtimeChannel
380
+ RealtimeService ..> Board : register, encrypt, shared registration
381
+ ```
382
+
383
+ `Board` and `RealtimeService` reach encryption, services, mercury, feature, and device through
384
+ `this.webex.internal` at call time, so they hold no references of their own.
385
+
386
+ ## Use cases and flows
387
+
388
+ | Use case | Actor or caller | Primary steps and outcome | Failure or boundary behavior | Evidence |
389
+ | -------- | --------------- | ------------------------- | ---------------------------- | -------- |
390
+ | `UC-001` | Client opening a whiteboard in a space | `createChannel`, then `getContents` page by page | Cluster URL falls back to the catalog board service | `src/board.js`, `test/unit/spec/board.js` |
391
+ | `UC-002` | Client drawing | `addContent` for persistence, and `realtime.publish` for live peers | A failed chunk stops later chunks | `src/board.js`, `src/realtime.js` |
392
+ | `UC-003` | Client receiving live strokes | `connectToSharedMercury` (or an own socket), then listen for `event:board.activity` on the channel | Toggle off or Mercury not registered rejects | `src/realtime.js`, `test/unit/spec/realtime.js` |
393
+ | `UC-004` | Client sharing a whiteboard to mobile | `authorizeMediaInjector`, then `unauthorizeMediaInjector` when sharing stops | Errors resolve so sharing continues without mobile | `src/board.js` |
394
+ | `UC-005` | Client deleting a board | `deleteChannel` with `preventDeleteActiveChannel` locks first | A board in use answers 409 to the lock | `src/board.js`, `test/integration/spec/board.js` |
395
+
396
+ ### Cross-boundary use-case flow
397
+
398
+ | Boundary | Transport and ordering | Compatibility | Timeout, retry, and recovery |
399
+ | -------- | ---------------------- | ------------- | ---------------------------- |
400
+ | Board service (`UC-001` to `UC-005`) | HTTPS through `webex.request`; cluster-local URL for create and list | Request shapes under Protocol and wire format | No plugin-local retry; webex-core interceptors apply |
401
+ | ACL service (`UC-005`) | HTTPS PUT to the channel's `aclUrl` | `aclLinkType`, `aclLinkOperation`, KMS delete message | None |
402
+ | KMS through the encryption plugin (`UC-001`, `UC-002`, `UC-004`) | In-process calls that send KMS requests | Key URIs and KRO URLs from conversation and channel | Rejections propagate, except in the media-injector methods |
403
+ | Webex Files (`UC-002`) | Three-phase `webex.upload` | `fileSize` in initialize and finalize | webex-core upload retries the upload phase |
404
+ | Mercury (`UC-002`, `UC-003`) | Web socket frames; activity is unordered across boards | `publishRequest` frame and `board.activity` envelope | Reconnect is Mercury's; shared channels refresh their socket on `online` |
405
+
406
+ ## Client state model
407
+
408
+ | State or slice | Owner | Initial state | Transition triggers | Reset or persistence boundary |
409
+ | -------------- | ----- | ------------- | ------------------- | ----------------------------- |
410
+ | `realtimeChannels` collection | RealtimeService | empty | Added by `createRealtimeChannel` and `connectToSharedMercury`; removed by the disconnect methods | In memory for the instance |
411
+ | `RealtimeChannel` props `channelId`, `socketUrl`, `binding` | RealtimeChannel | set on add | None after add | In memory |
412
+ | `isSharingMercury` (session) | RealtimeChannel | `false` | Set `true` by a shared registration | In memory |
413
+ | `socket` (session) | RealtimeChannel | unset | The Mercury socket for shared channels, refreshed on Mercury `online`; the own socket after `connect` | In memory |
414
+ | Mercury connection state of a channel | Mercury base class | per Mercury | `connect`, `disconnect`, reconnects | Owned by the Mercury implementation |
415
+
416
+ ## Business rules and invariants
417
+
418
+ | ID | Invariant | WHY | Enforcement source | Test evidence |
419
+ | -- | --------- | --- | ------------------ | ------------- |
420
+ | `INV-001` | Board content leaves the client only as ciphertext keyed by `channel.defaultEncryptionKeyUrl`. | The board service stores opaque encrypted payloads. | `src/board.js`, `src/realtime.js` | `test/unit/spec/encryption.js`, `test/unit/spec/realtime.js` |
421
+ | `INV-002` | Create and list target the board cluster that matches the conversation ACL cluster when one resolves. | In-code comment: the home cluster answers with a cross-cluster 307 the browser cannot follow. | `src/board.js` | `test/unit/spec/board.js` |
422
+ | `INV-003` | Content chunks are posted one at a time, in order. | In-code comment: avoid race conditions among patches. | `src/board.js` | `test/unit/spec/board.js` |
423
+ | `INV-004` | A board binding is `mercuryBindingPrefix` + the channel id with `-` mapped to `.` and `_` to `#`. | The JSDoc: Mercury bindings do not accept the raw channel id. | `src/realtime.js` | `test/unit/spec/realtime.js` |
424
+ | `INV-005` | At most one `online` and one `event:board.activity` handler from this module is attached to the shared Mercury plugin. | In-code comment: make sure there is only one handler. | `src/realtime.js` | None found |
425
+
426
+ ## Concurrency and reactive flow
427
+
428
+ - Execution model: single event loop; every method returns a promise except
429
+ `handleBoardActivityMessages`, `refreshMercurySocketReference`, and `getClusterBoardServiceUrl`.
430
+ - Ordering guarantees: `addContent` chunks are serial (`INV-003`), while items inside a chunk are
431
+ encrypted in parallel. `decryptContents` decrypts items in parallel and keeps their order.
432
+ - Idempotency and retry: no method deduplicates concurrent calls. A second `createRealtimeChannel`
433
+ for the same `channelId` re-registers and adds again; the collection keeps one entry per id. No
434
+ plugin-local retry exists; webex-core interceptors and Mercury own retries.
435
+ - Shared-state protection: `connectToSharedMercury` removes its handlers before adding them, so
436
+ repeated calls keep one handler each (`INV-005`). Shared channels' `socket` references are replaced
437
+ on every Mercury `online`.
438
+ - Blocking restrictions: none in this module.
439
+
440
+ ## Protocol and wire format
441
+
442
+ | Message or frame | Version | Producer or serializer | Consumer or parser | Compatibility and ordering rule |
443
+ | ---------------- | ------- | ---------------------- | ------------------ | ------------------------------- |
444
+ | `POST /channels` body `{aclUrlLink, kmsMessage: {method: create, uri: /resources, userIds, keyUris}, defaultEncryptionKeyUrl, ...channel}` | Unversioned | `createChannel` and the `encryptChannel` transform | Board service | `kmsMessage` is wrapped by `encryptKmsMessage` after the key is added |
445
+ | `GET /channels?aclUrlLink=&channelsLimit=&type=` | Unversioned | `getChannels` | Board service | Paged through Link headers |
446
+ | `POST <channelUrl>/contents` body: array of `{device, type: STRING or FILE, encryptionKeyUrl, payload, file}` | Unversioned | `addContent` | Board service | Serial chunks |
447
+ | `GET <channelUrl>/contents?contentsLimit=` response `items[]` with `contentId`, `encryptionKeyUrl`, `payload` or `file` | Unversioned | Board service | `decryptContents` transform | Paged through Link headers |
448
+ | `PATCH <channelUrl>` body `{image: {url, height, width, mimeType, scr, encryptionKeyUrl, fileSize}}` | Unversioned | `setSnapshotImage` | Board service | `scr` is encrypted |
449
+ | `PUT <aclUrl>/links` body `{aclLinkType: INCOMING, linkedAcl, kmsMessage: {method: delete, uri}, aclLinkOperation: DELETE}` | Unversioned | `deleteChannel` | ACL service | Optional lock first |
450
+ | `POST <channelUrl>/register` body `{mercuryConnectionServiceClusterUrl, webSocketUrl, action: ADD}` or `{binding, webSocketUrl, action: REMOVE}`; response `{binding, webSocketUrl, sharedWebSocket}` | Unversioned | `registerToShareMercury`, `unregisterFromSharedMercury` | Board service | ADD before publish |
451
+ | `PUT <channelUrl>/sharePolicies/transcoder` body `{kmsMessage}`; response `{kmsResponse}` | Unversioned | `authorizeMediaInjector` | Board service | Bearer read from the first authorization |
452
+ | Mercury frame `{id: uuid v4, type: publishRequest, recipients: [{alertType: none, route: binding, headers: {}}], data: {eventType: board.activity, contentType, payload, envelope: {encryptionKeyUrl, channelId}}}`; for `FILE`, `data.payload` is `{file, payload}` | Unversioned | `publishEncrypted` | Mercury service, then peers' `board.activity` events | Routed by `envelope.channelId` on a shared socket |
453
+
454
+ ## Caller-visible failure modes
455
+
456
+ | Condition | Signal or result | Caller behavior | Retry or recovery | Evidence |
457
+ | --------- | ---------------- | --------------- | ----------------- | -------- |
458
+ | `getChannels` without a conversation | Rejected `Error` `` `conversation` is required `` | Pass the conversation | None | `src/board.js`, `test/unit/spec/board.js` |
459
+ | `publishEncrypted` for a channel not in the collection | Rejected `Error` `Realtime Channel not found` | Connect first | None | `src/realtime.js`, `test/unit/spec/realtime.js` |
460
+ | `disconnectMercuryConnection` for an unknown channel | Rejected `Error` `Realtime Channel not found!` | None needed | None | `src/realtime.js`, `test/unit/spec/realtime.js` |
461
+ | `disconnectFromSharedMercury` for an unknown channel | Synchronous `TypeError` | Track connected channels | None | `src/realtime.js` |
462
+ | Shared Mercury requested before Mercury registration | Rejected `Error` naming `localClusterServiceUrls` | Connect Mercury first | Retry after `online` | `src/board.js`, `test/unit/spec/board.js` |
463
+ | `web-shared-mercury` toggle off | Rejected `Error` `` `web-shared-mercury` is not enabled `` | Use `connectByOpenNewMercuryConnection` | None | `src/board.js`, `test/unit/spec/board.js` |
464
+ | Board, ACL, or Files request fails | The `webex.request` or `webex.upload` rejection, unchanged | Handle the HTTP error; 409 on lock means the board is in use | Caller may retry | `src/board.js` |
465
+ | A content chunk fails in `addContent` | Rejection; later chunks are not sent | Re-add the remaining contents | Caller may retry | `src/board.js` |
466
+ | Encryption or KMS fails | The encryption plugin's rejection | Handle as an encryption error | Caller may retry | `src/board.js` |
467
+ | `authorizeMediaInjector` fails at any step | Resolves with the error object instead of a bearer | Check the type of the result | Share continues without mobile | `src/board.js` |
468
+ | `unauthorizeMediaInjector` cannot remove one authorization | That entry resolves as the error object | Inspect the array | None | `src/board.js` |
469
+ | A media-injector method called without a board | Synchronous `TypeError`, plus an unhandled rejected promise | Pass the board | None | `src/board.js` |
470
+
471
+ ## Pitfalls and constraints
472
+
473
+ - The `encryptChannel` transform in `src/index.js` declares `direciton: 'outbound'`. webex-core
474
+ matches a transform without `direction` in every direction, so behavior is the same today because
475
+ only the outbound predicate names it.
476
+ - `authorizeMediaInjector` and `unauthorizeMediaInjector` build `Promise.reject(...)` for a missing
477
+ board but never return it; the next line reads `board.kmsResourceUrl` and throws.
478
+ - `authorizeMediaInjector` resolves with the error object on failure, so a caller cannot tell a
479
+ bearer string from an error without checking its type.
480
+ - `deletePartialContent` carries an in-code note that its server API has changed and the method needs
481
+ updating; its integration block is skipped. Treat it as unverified.
482
+ - `keepActive` resolves the whole response, unlike the sibling methods that resolve `res.body`.
483
+ - `RealtimeChannel` uses namespace `Board`, so its Mercury config is `webex.config.board`: the board
484
+ socket timers apply, and Mercury keys the board config does not declare (for example
485
+ `backoffTimeMax`) are undefined for board sockets.
486
+ - `pingInterval`, `pongTimeout`, and `forceCloseDelay` are strings when their environment variables
487
+ are set.
488
+ - `encryptSingleFileContent` and `decryptSingleFileContent` mutate the content object they receive.
489
+ - `webex.internal.device` is used but `@webex/internal-plugin-device` is not a dependency in
490
+ `package.json`; it is registered because the mercury plugin imports it.
491
+ - `processActivityEvent` has no caller in this package; it is kept for clients.
492
+ - `package.json` `test` runs `yarn test:integration`, which is not defined, so the aggregate `test`
493
+ script fails at that step. The integration specs run only through `test:browser` (karma).
494
+ - The unit specs import `@webex/internal-plugin-board` by name, which loads `dist/`. Run `build:src`
495
+ before `test:unit`, or the tests run against stale output.
496
+
497
+ ## Module-specific rules
498
+
499
+ - Do: encrypt every content item with `channel.defaultEncryptionKeyUrl` before it leaves the client
500
+ (`INV-001`).
501
+ - Do: keep create and list on the cluster-local board URL with the catalog fallback (`INV-002`).
502
+ - Do: keep `addContent` serial (`INV-003`) and keep the binding format (`INV-004`).
503
+ - Do: remove a Mercury handler before adding it in shared mode (`INV-005`).
504
+ - Do: log through `this.logger` with the `board realtime:` prefix and never log decrypted content,
505
+ keys, or bearer tokens (`src/realtime.js`).
506
+ - Do not: return a rejection from the media-injector methods for a service error without a design
507
+ change; whiteboard sharing relies on them resolving (`MOD-019`).
508
+
509
+ ## Export stability
510
+
511
+ | Export or entry point | Consumer | Stability | Versioning and deprecation rule | Declaration or API report |
512
+ | --------------------- | -------- | --------- | ------------------------------- | ------------------------- |
513
+ | Default export `Board`, named `config` and `RealtimeChannel` | Packages building on the class; unit specs | Internal | The README says internal plugins do not strictly follow semver; no deprecation rule is declared | `src/index.js` |
514
+ | Import side effect: internal plugin `board` and its payload transformer | `@webex/webex-server`, `@webex/recipe-private-web-client` | Internal | Same | `src/index.js`, `package.json` |
515
+ | Plugin API `webex.internal.board.*` and `webex.internal.board.realtime.*` | First-party clients | Internal | Same | `src/board.js`, `src/realtime.js` |
516
+
517
+ No TypeScript declaration or API report is shipped; `package.json` has no `types` field and the
518
+ source is JavaScript.
519
+
520
+ ## Key design trade-off
521
+
522
+ | Chosen trade-off | Preserved invariant or benefit | Cost or limitation | Decision evidence |
523
+ | ---------------- | ------------------------------ | ------------------ | ----------------- |
524
+ | Media-injector failures resolve instead of rejecting | Whiteboard sharing continues when the transcoder cannot be authorized | Callers receive an error object as a success value | `src/board.js` |
525
+ | Share the main Mercury socket when the server allows it, else open a board socket | One connection serves many boards when possible | Two code paths for connect and disconnect, and socket references that must be refreshed on reconnect | `src/realtime.js` |
526
+ | Serial content chunks | Server-side patch order matches client order | Large adds take one round trip per chunk | `src/board.js` |
527
+ | Transformer-based decryption of reads | Every read path, including `Page.next`, returns plaintext | Decryption runs only when the first item matches the predicate | `src/index.js` |
528
+
529
+ ## Verification
530
+
531
+ | Requirement or invariant | Test level | Positive evidence | Negative or boundary evidence | Gap |
532
+ | ------------------------ | ---------- | ----------------- | ----------------------------- | --- |
533
+ | `MOD-001` | Unit | `test/unit/spec/board.js` "has a child of realtime" | None found | Registration and transformer options not exercised |
534
+ | `MOD-002` | Unit, integration | `test/unit/spec/board.js` page-size cases; `test/integration/spec/realtime.js` config case (skipped) | None found | Environment overrides untested |
535
+ | `MOD-003`, `MOD-004` | Integration | `test/integration/spec/board.js` content and channel setup | None found | No unit case for either predicate or transform |
536
+ | `MOD-005`, `MOD-006`, `INV-002` | Unit | `test/unit/spec/board.js` "#createChannel()", "#getChannels()" | `test/unit/spec/board.js` fallback cases | None |
537
+ | `MOD-007`, `MOD-008` | Unit, integration | `test/unit/spec/board.js` "#getChannel()", "#getChannels()", "#getContents()" | `test/unit/spec/board.js` "requires conversationId" | None |
538
+ | `MOD-009`, `INV-003` | Unit | `test/unit/spec/board.js` "#addContent()" | None found | Chunk failure untested |
539
+ | `MOD-010`, `MOD-011`, `INV-001` | Unit | `test/unit/spec/encryption.js` | `test/unit/spec/encryption.js` "does not require payload when type is FILE" | Unparsable STRING payload untested |
540
+ | `MOD-012`, `MOD-013` | Unit, integration | `test/unit/spec/board.js` upload and snapshot cases; `test/integration/spec/board.js` "#addImage()" | None found | `addImage` unit case missing |
541
+ | `MOD-014`, `MOD-015` | Unit, integration | `test/unit/spec/board.js` delete, lock, keep-alive | `test/integration/spec/board.js` "does not delete when a channel is being used" | None |
542
+ | `MOD-016` | Unit | `test/unit/spec/board.js` "#deleteAllContent()", "#deletePartialContent()" | None found | Partial-delete integration block skipped; server API changed per in-code note |
543
+ | `MOD-017` | Unit, integration | `test/unit/spec/board.js` "#register()"; `test/integration/spec/board.js` "#ping()" | None found | `ping` unit case missing |
544
+ | `MOD-018` | Unit | `test/unit/spec/board.js` "#registerToShareMercury()" | `test/unit/spec/board.js` rejection cases | `unregisterFromSharedMercury` request untested |
545
+ | `MOD-019`, `MOD-020` | None | None found | None found | No test |
546
+ | `MOD-021`, `INV-004` | Unit | `test/unit/spec/realtime.js` binding and own-socket cases | `test/unit/spec/realtime.js` "rejects if channel not found" | None |
547
+ | `MOD-022` | Unit | `test/unit/spec/realtime.js` "#publish()", "#publishEncrypted()" | `test/unit/spec/realtime.js` "rejects when socket not found" | None |
548
+ | `MOD-023`, `MOD-025`, `INV-005` | Unit | `test/unit/spec/realtime.js` shared-socket cases | None found | Socket refresh on `online` and single-handler rule untested; `test/integration/spec/sharing-mercury.js` skipped |
549
+ | `MOD-024` | Unit | `test/unit/spec/realtime.js` "finds the realtimeChannel from the envelope", "emits message" | Unknown channel ignored in the same case | None |
550
+
551
+ Coverage gaps are recorded above. The 58 unit cases pass under Node 22.14 after `build:src`. The
552
+ integration suites need live Webex services and test users, and two of the three are skipped, so they
553
+ are not routine coverage evidence. Generator-side field measurement is complete (93.3%, assessed
554
+ 2026-11-12). Independent semantic validation passed on 2026-11-12 with zero Blocking findings. A characterization baseline and promotion past Partial remain pending.