"Anyone with the link" share links (capability URLs)
sharingcapability-urltokensprivacypublic-pagesflutter-web
TLDR posts are mostly private. To show one to someone without an account, v1.57.0 added
capability links: https://tldrnerd.com/s/<token> shows a read-only view of a post and its
responses to anyone holding the URL, logged in or not. The token itself is the grant.
Rejected alternative: a shared "public" account
A shared login with a published password was considered and rejected: anyone could change its password and take it over, it would share preferences, push tokens and DM keys among strangers, every write route would need a new deny rule, and access could not be revoked per person.
Design
- Table
post_link:token CHAR(32)primary key withascii_bincollation (case-exact lookup),post_idUNIQUE (one link per post) withON DELETE CASCADE,created_by,created_date. - Token =
bin2hex(random_bytes(16)): 128 bits from a CSPRNG. Validate the shape (^[0-9a-f]{32}$) before querying. - Revoke = delete the row. The old URL dies instantly; turning sharing back on mints a new token. No expiry by default.
- Works regardless of the post's privacy setting. Unpublished (scheduled) posts still 404.
- Author or admin only for create/view/revoke (
GET/POST/DELETE /posts/{id}/link); a non-owner gets 404. Create is idempotent (returns the existing link). - Public
GET /s/{token}: no auth middleware,Cache-Control: no-store,X-Robots-Tag: noindex.
Project, do not pass through
The public endpoint reuses the normal post loader with a flag that skips only the visibility check,
then projects the result through an allowlist:
- Metadata limited to harmless keys (AI status, model, tracker status, priority); never session ids,
request ids, project names or timeouts.
- Share lists and counts cleared; fork relationships dropped (they could leak other posts' titles);
edit-history count zeroed; a via_link: true marker added.
Client
- The
/s/:tokenroute sits outside the logged-in shell and short-circuits the login redirect. - The public screen calls no authenticated endpoint, so it cannot reuse widgets that assume a session (avatars, mention links, response tiles). Logged-out users see "Sign in"; logged-in users see "Open in TLDR". A pending AI answer shows "still working, refresh".
- The author's post menu has a "Public link" sheet: create (auto-copies), copy, turn off (confirm).
Account-less apps built entirely on capability keys
The same idea scales to a whole app with no logins. The cal.jhampton.io calendar (2026-10-27)
gives each object several keys, each a separate permission:
- /c/<editKey>: the owner link. Anyone holding it can change the calendar; the browser that
created it keeps it in localStorage.
- /s/<viewKey>: read-only view, plus /s/<viewKey>.ics as a subscribe feed
(see Generating iCalendar (.ics) files and subscribe feeds).
- /e/<shareKey>: one event page with RSVP buttons, open to anyone with the link.
- A manage key returned only to the creator (the phone that shared the event) authorizes later
updates to that shared event; compare it with hash_equals, not ==.
Lessons:
- API responses must include a key only for callers who already proved they hold a stronger one
(the view response never contains the edit key).
- With no accounts, creation is open to anyone, so rate-limit writes per IP (a small table of
recent hits, e.g. 120 per hour) and cap request body size and field lengths.
- Keys drawn from a look-alike-free alphabet (no l, 0, O, 1, I) are easy to read aloud.
Mapping random bytes with byte % alphabetLength is slightly biased when 256 is not a multiple
of the alphabet size; with 10 to 22 characters (share 10, view 12, edit and manage 22) the key is still far beyond guessing, but use
rejection sampling if the margin is tight.
Follow-ups worth knowing
- Rich link previews need server-rendered Open Graph tags; a Flutter web app cannot emit per-page
meta by itself, so a rewrite injects them into
index.htmlper link. A token link may show the real title; an enumerable/posts/<id>link stays generic. See Open Graph link previews (SPAs, private posts, private-storage media). - Verified with headless Chrome screenshots of the logged-out page and the dead-link state; see Headless Chrome testing gotchas.
See also
- API authorization from the verified identity (and the holes it closes)
- go_router navigation patterns and opening your own links in-app
Linked from
- API authorization from the verified identity (and the holes it closes)
- Email sign-in links (one-time "magic links")
- Generating iCalendar (.ics) files and subscribe feeds
- go_router navigation patterns and opening your own links in-app
- Open Graph link previews (SPAs, private posts, private-storage media)
- Taking .php out of page addresses without breaking old links
- TLDR platform architecture (tldrnerd.com)
- Upload links for people without an account (getting a full-quality video from a friend)