pkg:clod/com.clodhub/private-views 0.11.0 Sends each viewer only what they may see, by a policy of hidden fields and reveal conditions. `private-views` makes the one thing every shared activity with secrets needs: a function `viewFor(state, viewer, policy)` that returns what one viewer may see. The policy lists hidden fields (`players[].cards`, `deck`, `table.secret`), who may see each one (its owner, listed roles, listed array positions, a flag on the item, or a named condition of the policy) and how it is concealed (set to null, removed or masked; per element for arrays). Viewers are participants, spectators and displays; a display never has an id, so it can never count as an owner. The state is never changed. The same component carries the small client side: the envelope every view has (version, room, who it is for, whether it is a display) and the rule for which arriving view to keep. Records grouped by owner (a game's per-player hidden facts) are redacted by `redact(viewerId, records)`, the form the turn engine uses. Examples A card table sends Ann her own cards and face-down placeholders for Bob's, except the card Bob has shown. A spectator and a table display see the same public view, and a display whose connection carries a participant id still sees nothing private. At the end of a round a condition reveals every score to everyone. A late reply to an action arrives after a newer pushed view and is ignored. Package URL: pkg:clod/com.clodhub/private-views@0.11.0 Class: Private views (pkg:clod/com.clodhub/private-views-class@1.1.0): Each person sees only what they may see of shared state. Any component of this class can fill a recipe slot that asks for it. Category people-and-accounts/permissions; https://clodhub.com/classes/private-views-class.txt; 0 other components of this class: https://clodhub.com/components.txt?class=pkg%3Aclod%2Fcom.clodhub%2Fprivate-views-class Provides (1) - private-views (com.clodhub/private-views 1.0.0): Send each viewer only what they may see. Server (server/private-views.ts): viewFor conceals a copy of the state by a policy; redact does the same for facts grouped by owner. Clients (web/views.ts; Swift enum PrivateViews and protocol ViewEnvelope; Kotlin package com.clodhub.views): which arriving view to keep. Methods are tagged with the languages that provide them. S is the application's state and V its view; both are JSON values. components that use it: https://clodhub.com/components.txt?requires=com.clodhub%2Fprivate-views Requires (0) - none Settings (0) No installer settings. The policy is supplied by the application or by the component that owns the state (for example the game rules component). Depends on components: none How to use in a recipe A recipe uses it through a slot of class Private views (pkg:clod/com.clodhub/private-views-class 1.1.0), naming pkg:clod/com.clodhub/private-views as the slot's preferred component or substituting it for another component of the class. The recipe connects what it provides (private-views) to the slots that use it. It has no settings. - as a slot in recipe.json components: {"id":"private-views","class":{"name":"pkg:clod/com.clodhub/private-views-class","version":"1.1.0","digest":"7bfbb5d4b642a7c0fc79134c42bd760f2fd2d30191f66fdab10334f9f8c24ba8"},"preferred":{"name":"pkg:clod/com.clodhub/private-views","version":"0.11.0"}} - in place of another component of the class: clod fetch private-views@0.11.0 --store store --from https://clodhub.com, then clod design RECIPE@VERSION --store store --answers answers.json --substitute SLOT=private-views@0.11.0 --out definition.json Used by recipes: pkg:clod/com.clodhub/ourpoker-recipe 0.13.0 (slot private-views) For developers: how an application uses it Server: define one `Policy` for the state type and call `viewFor(state, viewerOf(role, id), policy)` once per connection when the state changes; send each connection its own result. Use `project` to build the view shape from the state, `decorate` to add what only this viewer gets (legal actions, a prompt), and `youField` and `displayField` to tell the client who it is. Clients: `accept(incoming, current, mode)` (web) or `PrivateViews.isNewer` and `matchesMode` (Apple) and `isNewer` and `matchesMode` (Android) keep the newest view and refuse a player view on a display connection and the reverse. `examples/consumer.ts` shows a card table. The turn-engine uses this component through its `private-views` requirement. `redact(viewerId, records)` (server) is the record form: each `HiddenRecord` has an owner, open facts everyone sees, hidden facts only the owner sees, and a `revealed` map naming hidden keys now public (`true`, or the indexes of an array); a null viewer is a display and sees only revealed facts. Accounts and services No service. Pure functions. How it is checked Required-local: `node --test tests/web.test.ts` checks owners, spectators and displays, removal, nulling, masking and filtering of hidden fields, reveal by listed positions, flags and conditions, roles, projection, decoration, that the state is unchanged, a scan that no viewer's serialised view contains another participant's secrets, `redact` (owner, other viewer, display, revealed index lists, copies, a no-leak scan over every viewer), the client's newest-view and mode rules and the example. Platform: `python3 tests/native.py apple` compiles and runs the Swift envelope checks against `tests/fixtures/views.json`; `python3 tests/native.py android` compiles the Kotlin checks (needs kotlinc, not installed on the authoring machine, so not run there). - `node --test tests/web.test.ts` (web, required-local; tools: node 26.5) - `python3 tests/native.py apple` (apple, platform; tools: python3 3.12, swiftc 6.4) - `python3 tests/native.py android` (android, platform; tools: python3 3.12, kotlinc 2.2, java 26.0) Updates Patch updates replace files; no persisted-state migration. A policy change is a change to what leaves the server, so applications should re-run their no-leak test (the scan in this component's tests is a model) after changing one. Tags: people-and-accounts, permissions, private, views Targets: client android, ios, macos, tvos, web, windows; server none Publisher: George McIntyre (george-mcintyre) Guardians: Level N Ltd (guardian key 08775f20) Source: clodhub/private-views release v0.11.0; digest sha256:219fdb729d5844c00aad7d3a2b350584471d65847101508a5eec08b6611c7965 Release: features Line 0.11: no security releases Quality: Integration-tested, certified Known vulnerabilities: none known (checked 2026-11-26 at OSV); https://clodhub.com/api/components/private-views/0.11.0/vulnerabilities Downloads: 1 in 30 days; 1 of this version Classes: https://clodhub.com/classes.txt; this component as JSON: https://clodhub.com/api/components/private-views/0.11.0 Bundle download: GET https://clodhub.com/api/components/private-views/0.11.0/bundle returns a link valid for one hour Implements: pkg:clod/com.clodhub/private-views-class@1.1.0 7bfbb5d4b642a7c0fc79134c42bd760f2fd2d30191f66fdab10334f9f8c24ba8 com.clodhub/private-views 1.0.0 entry modules: android android/src/main/java, ios apple/Sources, macos apple/Sources, server server/index.ts, tvos apple/Sources, web web/index.ts, windows web/index.ts shared behaviour suites: shared Platforms: android, ios, macos, server, tvos, web, windows Toolchains: android >=8.0.0, ios >=17.0.0, java >=17.0.0 <27.0.0, kotlin =2.4.21, macos >=14.0.0, node >=26.5.0 <27.0.0, swift =6.4.2, tvos >=17.0.0 Frameworks: none Styles: scope none; 0 namespaces; 0 conflicts Licence: Apache-2.0; 0 upstream sources, 0 exact dependencies, 30 files (listed on the details page) Suitable for jobs: private-views profile any: cost none; load none; regions any; compliance none Notes: Pure functions. Cost grows with state size times viewers because each view is a deep copy. Data migration: this component keeps no data Maintainers: Level N Ltd; https://github.com/clodhub/private-views/issues; updates https://github.com/clodhub/private-views/releases (manual) What you download private-views-0.11.0.tar, from release v0.11.0 of clodhub/private-views: 30 files - Documents and manifests (8): CONTRACT.md, INSTRUCTIONS.md, LICENCE, NOTICE, PROVENANCE.md, SOURCE.md, ... - Source code (6): android/ (1), apple/ (1), server/ (2), web/ (2) - Tests (6): android/ (1), apple/ (1), fixtures/ (2), native.py, web.test.ts - Interface documents (1): private-views.json - Class files: the class's interfaces and shared checks (3): private-views-class/ (3) - Examples (1): consumer.ts - Diagrams (5): definition.json, examples/ (1), output/ (3) Installing copies 6 of them into the application under components/private-views/: android 1, apple 1, server 2, web 2 Not included: the values of its settings, which the recipe writes; any secret The archive is a release file on the publisher's public GitHub repository; ClodHub keeps this page and a pointer to the release, not the code. clod checks the archive's sha256 fingerprint before anything is copied, and installing runs none of the package's code. Versions - 0.11.0 features (2026-11-26T11:29:59.477Z) sha256:219fdb729d5844c00aad7d3a2b350584471d65847101508a5eec08b6611c7965 Links Details (package foundations, upstream sources, exact dependencies, styles, class inventories, files): https://clodhub.com/components/private-views/details.txt?version=0.11.0 Page: https://clodhub.com/components/private-views; JSON: https://clodhub.com/api/components/private-views/0.11.0; connections diagram: https://clodhub.com/api/components/private-views/0.11.0/connections.svg Copyright Level N Ltd 2026