sealed-surface
Paint tables and timeseries as a bitmap of glyphs so the numbers a human can see are not numbers a scraper can collect from the DOM, the clipboard, tooltip JSON, or View Source.
Not DRM. Not OCR-proof. A phone camera still wins. The crate signs DOM
scrape, copy/paste, and tooltip-JSON layers when the host obeys the
contract. Sealed grids do not put values in the accessibility tree; the
accessible egress is a licensed API the host already meters. Do not “fix
a11y” with a hidden <table> — that hidden table is the scrape.
Zero required crates.io dependencies. MSRV 1.80. Default type scale is
compact 5×7 (row 18). TypeScale::large() is 2× opt-in; xlarge() is 3×.
[]
= "0.4"
Look
crates.io and GitHub READMEs are static markdown. They can show PNGs; they
cannot run the hover host. These are the same bytes Surface::render /
render_series emit. Live tooltips: cargo run --example gallery.





More frames: examples/renders/. Gallery source:
examples/gallery.rs.
30-second example
use ;
let grid = try_new?;
let mut surface = new;
let frame = surface.render?;
assert!;
assert!;
assert!;
if let Some = &frame.tooltip_png
Serve frame.png as Content-Type: image/png. Hover: map mouse → pixmap
(x, y) → re-render with FrameRequest::pointer → serve tooltip_png as
PNG (or HTTP 204 on miss). Never response.json().
Timeseries: Surface::render_series. Scatter: Surface::render_scatter
(same Series, unconnected markers). Treemap: Surface::render_tree(&TreeLayout).
For agents and hosts
This crate is a painter, not a web framework. Do not add Axum, Leptos, or a JS chart crate to this graph.
| Do | Don't |
|---|---|
Surface::render / render_series → <img src> of PNG bytes |
Interpolate cell values into HTML / JSX / view! |
Tooltip route returns image/png or 204 |
Tooltip / hit JSON with scalars |
Hits are {row, col} / {series, point} ids |
Hits that include the value |
LicenseLens before paint (Redacted has no hidden scalar) |
CSS filter: blur() over live rows |
SurfaceMode::Sealed for customers |
Copyable on a customer analytics view |
Empty alt / no values in title / ARIA |
Hidden <table> “for a11y” or SEO |
Compact default (TypeScale::Compact, row 18) |
Assume 2× is default (that 0.3.0 experiment was reverted) |
Host DOM (the entire data surface):
Pointer JS computes pixmap x, y from naturalWidth / naturalHeight and
sets tip.src to /i/{id}/tip.png?x=&y= (see examples/gallery.rs). It
must not call response.text().
HTTP is part of the moat. If GET /tip.png?x=10&y=20 returns JSON, you
lost. Clipboard TSV, if offered at all, must 403 when the session is sealed.
Public API map: Surface, Frame, FrameRequest, Grid / SeriesLayout,
LicenseLens / AccessTier, SurfaceMode, Appearance / TypeScale /
Theme, Viewport / TableMetrics / Pointer / HitMap,
HostProjection. Docs: https://docs.rs/sealed-surface.
Contract tests (tests/seal_contract.rs) grep sealed HostProjection for
fixture values ("49.00", SKUs) and expect zero matches. If you change
the painter and a grep starts failing, you opened a leak.
Your page can still leak even when this crate’s tests pass (you shipped the same rows as JSON to a SPA store). Grep the HTML document in the host.
Appearance
| Handle | What |
|---|---|
Appearance::default() / compact() |
5×7, row 18 (same metrics as 0.2) |
Appearance::large() |
2× glyphs — opt-in; harder on the eyes |
Appearance::xlarge() |
3× |
Appearance::light() / high_contrast() |
palettes; compact glyphs |
ChartStyle |
2px AA stroke, area fill, 1–2–5 ticks, plot well |
Integer-scaled 5×7 bitmaps are blocky at every size. Bigger is not more comfortable. Optional outline fonts are future work, not a default switch.
# use ;
let mut surface = new;
surface.set_appearance; // opt-in 2×
1. The problem, in the language of a normal webpage
When you open a typical analytics UI, you see a table of prices or a chart of counts. Your eyes are looking at pixels. Your browser, however, is holding several other copies of the same facts:
| Place | What it is | Who can read it |
|---|---|---|
| DOM | <td>49.00</td>, a <div>, SVG <text>49.00</text> |
View Source, innerText, pandas.read_html, “Table to Excel” |
| JavaScript heap | [{x, y: 49.00}, …] |
DevTools, userscript, bookmarklet |
| Network tab | {"price": 49.00} |
DevTools → Network |
| Clipboard | What Ctrl+C copies | Anyone who can select |
| Accessibility tree | Often the same Unicode as the DOM | Assistive tech and ARIA scrapers |
| Pixels | The picture on screen | Humans, screenshots, cameras, OCR |
A data moat for a visual product is the decision that the pixels are the product and the other copies are leaks.
If you sell a licensed API for the real rows, the UI must not be a free back-door CSV. We are not hiding a password. We are making “save this table to Excel” fail for a typical customer, so buying the API is the rational next step.
We will not stop a determined person with a phone camera and a vision model. Bloomberg does not stop that either. We will stop copy, scrape, and casual DevTools harvest.
2. Why the usual “protections” are not a moat
user-select: none and “disable right click”
The text is still in the DOM. A scraper does not highlight. It reads
textContent.
Blur the remaining rows in CSS
If the blurred rows were sent as HTML and then styled with filter: blur(),
View Source still has them. A blur over live data is an invitation, not a
lock. The correct lure: locked rows were never sent. Paint a
placeholder (....) whose original scalar has already been dropped.
SVG of strings and numbers
SVG is XML. <text>49.00</text> is a DOM node. Even glyph <path>s (Kindle
Cloud Reader) sit in the document and get atlas-matched or OCR’d.
SVG-as-a-document is not a picture. This crate may use outlines
internally someday. It will never attach an SVG document to the page.
Canvas fillText from a JavaScript array
Better than a <table>. Useless if the page also holds const series = [49.00, …]. Wrapping lightweight-charts / ECharts / Plotly from Rust/WASM
has the same leak: the series still materialize in JS.
“It’s WASM, so it’s compiled”
WASM is a sandbox for code, not a vault for values. v0 paints on the server (or in a native test) and sends PNG bytes. Future WASM backends must keep scalars off the JS heap; they still will not be magically secret.
3. Threat model
| Layer | Attack | What this crate does | Residual |
|---|---|---|---|
| A. DOM scrape | innerText, <td>, SVG <text>, ARIA |
Sealed HostProjection contains no cell values |
Host must not also dump JSON into HTML |
| B. Copy / Excel | Ctrl+C, table-to-Excel | No TSV / no HTML table | Screenshot still works |
| C. Tooltip / hit JSON | GET /tooltip → {"value":"49.00"} |
Tooltip is a PNG. Hits are opaque ids | A sloppy host can still add a JSON route |
| D. JS / WASM memory | Dump the heap | Values never go to the browser as strings | A future WASM port can be dumped |
| E. OCR / vision | Screenshot, phone + a vision model | Out of scope | Honest floor |
| F. Licensed API | Customer key pulls JSON | Not this crate | Intended egress, metered elsewhere |
We sign A–C when the host obeys the contract. We do not sign E. If someone claims a web UI is “impossible to steal,” they are selling DRM cosplay. The product goal is friction.
4. How this crate actually does it
Grid ──LicenseLens.apply──► ViewGrid (unlicensed scalars are gone)
│
TableLayout (rectangles, not HTML)
│
embedded 5×7 bitmap font
│
Pixmap (RGB bytes)
│
in-crate PNG encoder (DEFLATE)
│
┌──────────────────┼──────────────────┐
▼ ▼ ▼
frame PNG tooltip PNG HostProjection
(always) (pointer hit) (empty if Sealed)
1 — Drop what they should not see (LicenseLens)
LicenseLens::apply clones the grid and overwrites unlicensed cells with
CellValue::Redacted. There is no hidden field to accidentally serialize.
AccessTier |
Clear data rows |
|---|---|
Public |
0 (headers still painted; every cell redacted) |
Trial |
2 |
Subscription / Pro / Enterprise / Open |
all rows you supplied |
Open is for admin tools. Column allow-lists can redact whole columns even
in sample rows.
2 — Paint glyphs, not Unicode
An HTML table stores '4', '9', '.'. A sealed surface stores which
pixels of a 5×7 font are on. The atlas lives in src/font.rs. Pixmap is
RGB bytes. There is no text layer.
3 — Encode a PNG, not a document
The encoder is in-crate (no png / image crate). The host serves
Content-Type: image/png. Empty alt.
4 — Mode changes the leak surface, not the painter
| Mode | Pixels | HostProjection |
|---|---|---|
Sealed (default) |
PNG | no text nodes, no clipboard |
Copyable |
same painter | TSV of the (already lensed) visible window |
HostProjection::audit_text() is everything the host may put in HTML or on
the clipboard. Contract tests grep it.
5 — Tooltips are pictures too
FrameRequest.pointer is (x, y) in PNG space. The crate looks up a Hit
(ids, never values), paints header: glyphs, returns tooltip_png.
6 — Hits are coordinates, not facts
HitMap::at(x, y) -> Option<Hit> gives row/col (or series/point) ids. You
cannot learn 49.00 from the hit type.
5. Code map
src/
lib.rs public API (small on purpose)
model.rs Grid, Column, Row, CellValue
lens.rs AccessTier, LicenseLens (drop scalars)
mode.rs Sealed | Copyable
layout.rs viewport clip + sticky header + HitMap (visible only)
appearance.rs TypeScale, ChartStyle, Appearance
chart.rs timeseries + scatter
tree.rs squarified treemap
deflate.rs in-crate zlib/DEFLATE
font.rs 5×7 bitmap
raster.rs Pixmap + PNG encoder
host.rs HostProjection (the leak surface)
surface.rs Surface::render / render_series
theme.rs RGB palettes
error.rs InvalidGrid | UnsupportedLayout | Raster
tests/
seal_contract.rs load-bearing greps
virtualize.rs window clip / sticky header / metrics / default scale
Surface::render end-to-end:
viewed = lens.apply(grid)— unlicensed scalars are gone.layout_visible— only the viewport gets boxes. Sticky header;origin_yscrolls the body.TableMetricssizes host scrollbars.- Window-sized
Pixmap(capped atMAX_PIXMAP_AXIS). to_png().- Optional
tooltip_png. HostProjectionfrom mode, not from pixels.
Enums, not stringly modes: CellValue is Empty | Text | Int | Float | Redacted. Redacted cannot carry a hidden number. Library code returns
Result; unwrap is tests-only.
6. What this is not
- Not DRM. Not watermark-as-proof-in-court (later, maybe, as attribution).
- Not OCR-proof, screenshot-proof, or camera-proof.
- Not a TradingView clone. Do not wrap lightweight-charts.
- Not an HTML table with extra CSS.
- Not a substitute for API metering, auth, or legal terms.
7. Roadmap
| Slice | Intent |
|---|---|
| 0.1 | Virtualized table, DEFLATE PNG, metrics, host examples |
| 0.2 | Timeseries on this painter (crosshair as glyphs, no JS series) |
| 0.3.1 | Appearance. Default compact; large is 2× opt-in; live gallery hover |
| 0.4 (now) | Scatter + squarified treemap on this painter |
| 0.5 | Optional web / wgpu blit; values stay off the JS heap |
| 0.6 | Optional glyph shuffle + tenant watermark (attribution, not OCR-proof) |
| 0.7 | Server tiles for 100k-row grids |
See ROADMAP.md and CHANGELOG.md.
License
MIT OR Apache-2.0. }