docs(examples): redacted-form recipe — Preview-mode field redaction#48
Merged
Conversation
…ield redaction
A two-field form (redacted passport + normal note) showing the data-lvt-redact
round-trip: the passport value stays in browser localStorage and never reaches
the server (which sees only a {redacted:true} sentinel), while the [[passport]]
echo is hydrated back from localStorage for display.
Includes a chromedp e2e (redacted_form_test.go) that drives a real browser over
a real WebSocket against the locally-built client bundle and asserts the raw
value appears in no WebSocket frame, the server stores only the presence flag,
the non-redacted field round-trips, and the echo is hydrated.
Exercises livetemplate/livetemplate#445 (lvt.Redact) + livetemplate/client#127
(data-lvt-redact).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
lvt.Redact now emits <span data-lvt-redact="passport"> (filled client-side via textContent) instead of a [[passport]] text token. Update the template comment and the e2e assertion to check for the server-emitted data-lvt-redact span rather than the old token, plus the package-doc line. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Holding this PR open intentionally. The companion changes are merged:
But the Blocked on: tagged |
The redacted-form example needs lvt.Redact (livetemplate#445) and data-lvt-redact (@livetemplate/client@0.11.8), both now released. Bump the livetemplate pin from v0.9.2 to v0.11.2 so the example builds on main without the local go.work shim. Verified: GOWORK=off build + vet + chromedp e2e all green against published deps. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A runnable example demonstrating
data-lvt-redact(livetemplate/client#127) + thelvt.RedactGo helper (livetemplate/livetemplate#445).A two-field form:
<input data-lvt-redact="passport">. The value stays in browserlocalStorage; the server only ever receives a{redacted:true,field}sentinel.Two panels show the split: "What the browser shows" hydrates the
{{.lvt.Redact "passport"}}→[[passport]]token from localStorage; "What the server stores" shows the passport field asprovided (value never received).E2E
redacted_form_test.godrives a real browser (Dockerized headless Chrome) over a real WebSocket against a server serving the locally-built client bundle (not the CDN — the feature is unreleased). It asserts:[[passport]]echo is hydrated from localStorage.LiveHandleris exposed separately fromHandlerso the test can swap in the local bundle.🤖 Generated with Claude Code