Skip to content

Bring lwsd to the Oct 2026 LWS drafts — Touchstone-conformant - #10

Merged
melvincarvalho merged 7 commits into
gh-pagesfrom
oct-drafts/storage-discovery
Oct 14, 2026
Merged

melvincarvalho merged 7 commits into
gh-pagesfrom
oct-drafts/storage-discovery

Conversation

@melvincarvalho

@melvincarvalho melvincarvalho commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Brings lwsd from the July 2026 draft (7832003) to the current editor's drafts (core WD 5 Oct 2026, CID WD 21 Sep, the RFC 9728 change of 14 Oct), with Touchstone as the acceptance test. Tracked in JavaScriptSolidServer/JavaScriptSolidServer#621.

Result: Touchstone 5c49679, scripts/touchstone.sh --auth — 196 passed, 0 failed, 0 cantTell, 7 inapplicable (3 SAML, 4 optional-behaviour preconditions): conformant. As an open target: 64 passed, 0 failed — conformant. Own suite: 131/131 across six batteries.

Four commits, in order:

  1. Storage discovery — Link rel="lws#storage" on every GET/HEAD/401; the storage URI serves a CID-shaped description as application/lws+cid (root container via lws+json); StorageRoot service; absolute Location. scripts/touchstone.sh.
  2. JSON Patch baseline (lws/jsonpatch.js, RFC 6902, atomic), stored Content-Type served back and reported as format, linkset ETag / 412 / 405, Last-Modified, Allow on 405s.
  3. Authorization server (lws/as.js) — RFC 8414 metadata at /.well-known/lws-configuration/lws (root path via jss api.reservePath), RFC 8693 token exchange, ES256 at+jwt, storage-side validation, RFC 9728 resource_metadata; scripts/mint-token.js; --auth mode for the runner.
  4. HTTP QUERY search (lws10-index; opaque page tokens; Cache-Control: private; content-derived types), OpenID Connect subject tokens (lws/oidc.js), stricter CID (authentication relationship only, controller, revocation), grant validation, webhooks end to end against the harness inbox (any reader may subscribe, permission re-checked at delivery, retry/deactivation, inbox announcements), exactly-one-audience tokens, LWS_AS_KEY_JWK.

CONFORMANCE.md has the drift list with each item ticked, and a new host finding C15: Fastify 4 cannot route QUERY, so the plugin relabels the raw request (JavaScriptSolidServer/JavaScriptSolidServer#628). Pinned to Touchstone 5c49679 until ebremer/touchstone#3 lands.

- Link rel="https://www.w3.org/ns/lws#storage" on every GET/HEAD (401s
  too), pointing at the storage URI, replacing rel="storageDescription"
  (w3c/lws-protocol#183, #234).
- The storage URI (the root container) answers the storage description as
  application/lws+cid when there is no Accept, */*, or lws+cid; lws+json
  still gets the root container. /-/description stays as an alias.
- Description is a CID-1.0 document: @context [cid/v1, lws/v1], id = the
  storage URI, a StorageRoot service. The old StorageDescription service
  entry is gone.
- Absolute Location on create.
- scripts/touchstone.sh (npm run touchstone): run ebremer/touchstone
  against lwsd at /lws/ with Docker or a JDK 21 jar build; reports in
  .touchstone/runs/. Pinned to 5c49679 until ebremer/touchstone#3 lands.
- CONFORMANCE.md: drift list July -> Oct 2026 with what's absorbed.

Suite: 76/76 (55 core + 6 did:key + 3 CID + 12 grants) on jss 0.0.220.
…hstone core: conformant

- lws/jsonpatch.js: RFC 6902 over RFC 6901, applied to a copy so a failing
  op leaves nothing behind. Content PATCH and linkset PATCH take
  application/json-patch+json (the 5 Oct baseline) and still take
  merge-patch; Accept-Patch lists both.
- Linkset PATCH applies to the RFC 9264 document and reads the
  user-managed relations back out of the first link context, so a patch
  that forges up/type is ignored, not stored. Linksets carry an ETag,
  412 on a stale If-Match, 405 + Allow for PUT, 409 when the patch would
  not leave a linkset behind.
- Data resources remember the Content-Type they were created or updated
  with and serve it; container items report it as `format`
  (container-representation.md), not a guess from the extension.
- Last-Modified with If-Modified-Since / If-Unmodified-Since; Allow on
  POST-to-non-container 405; access request/grant endpoints carry the
  Container type link and the storage link.
- scripts/touchstone.sh picks a free port by default: jss falls back to
  another port when the requested one is busy, and the harness would then
  test whatever else lives there.

Own suite: 88/88. Touchstone 5c49679, open target: 64 passed, 0 failed,
139 inapplicable (auth suites, grants, webhooks need Authentication) —
conformant.
@melvincarvalho

Copy link
Copy Markdown
Contributor Author

Second commit: JSON Patch baseline, stored Content-Type, linkset ETag/412/405, Last-Modified, Allow on 405s, container-type link on the grant/request endpoints. Own suite 88/88.

Touchstone (5c49679, open target, 203 tests):

before this PR after commit 1 (discovery) after commit 2
passed — 50 64
failed — 14 (10 MUST) 0
cantTell — 0 0
inapplicable — 139 139
verdict — not conformant conformant

The 139 inapplicable are the three auth suites, access grants and webhooks, which need the Authentication capability (alice/bob tokens) — that's the token-exchange / RFC 9728 work further down the drift list. Run with the bundled JDK recipe: JSS_BIN=.../bin/jss.js scripts/touchstone.sh.

…tion, RFC 9728 discovery

lws/as.js is the OAuth 2.0 authorization server Authorization.html
expects a storage to send clients to: RFC 8414 metadata at
/.well-known/lws-configuration<prefix> (a root path, claimed through jss
api.reservePath), JWKS at /-/jwks, and a token endpoint at /-/token that
exchanges a self-issued did:key or CID credential (audienced to the
issuer) for an ES256 at+jwt (RFC 9068: sub, iss, client_id, aud =
storage, exp, iat, jti; kid = RFC 7638 thumbprint; 300 s by default,
LWS_AS_TOKEN_LIFETIME to change).

The storage validates at+jwt tokens against its own key — signature,
iss, aud, exp/nbf/iat with skew — and never falls through from one. A
credential presented directly as the Bearer is still accepted
(LWS_ACCEPT_CREDENTIALS=0 to require exchange), so C12 is resolved
rather than removed.

The 401 challenge carries resource_metadata (RFC 9728, the 14 Oct
draft) next to as_uri / realm; the protected resource metadata document
is served at /.well-known/oauth-protected-resource<prefix><path>.

scripts/mint-token.js gets a token the way a client does (challenge →
metadata → credential → exchange); scripts/touchstone.sh --auth uses it
to give the harness alice/bob tokens and declare Authentication.

Own suite: 107/107 (new as.js battery, 19 checks). Touchstone 5c49679
with --auth: 109 passed, 18 failed, 76 inapplicable — auth/cid 11/11,
authorization_server 9/9, storage_authorization 11/11; the failures are
the type-search QUERY method (15, next on the drift list) and three
access-grant details.
@melvincarvalho

Copy link
Copy Markdown
Contributor Author

Third commit: the authorization server (lws/as.js) — RFC 8414 metadata at /.well-known/lws-configuration/lws (root path via jss api.reservePath), RFC 8693 token exchange at /lws/-/token, JWKS, ES256 at+jwt (RFC 9068), storage-side validation, RFC 9728 resource_metadata in the 401. scripts/mint-token.js gets a token the way a client does; scripts/touchstone.sh --auth feeds alice/bob tokens to the harness and declares Authentication. Own suite 107/107.

Touchstone 5c49679, --auth (public read off, alice the writer):

open target --auth
passed 64 109 (83 MUST, 21 SHOULD, 5 MAY)
failed 0 18 (14 MUST)
inapplicable 139 76

Per manifest: auth/cid 11/11, authorization_server 9/9, storage_authorization 11/11, access_grants 13/16, everything in core unchanged at 100%. The 18 failures are two things: 15 are the type search — the harness uses HTTP QUERY with application/lws-query+json (w3c/lws-protocol#179), we still serve GET/POST — and 3 access-grant details (requesters must be able to POST a request, a grant without type must be refused, a format constraint). Both next.

Remaining inapplicable: 37 need ReachableFixtures (CID HTTPS-subject and OIDC — the server must reach the harness's fixture host), 5 HarnessIssuedTokens, 3 SamlTrust, ~15 are index preconditions that fail for the same QUERY reason.

…cation, grant validation

- lws10-index: the Type Search Service takes application/lws-query+json
  in an HTTP QUERY body; OPTIONS advertises Accept-Query; 400/415/406 per
  the draft; Cache-Control: private on both services; types also derived
  shallowly from content (Turtle <> a …, JSON @type). Fastify 4 has no
  QUERY, so the raw request is relabelled and remembered (CONFORMANCE.md
  C15); Fastify 5 would route it natively.
- lws/oidc.js: an ID Token as subject token — sub dereferenced, the OP
  found as an lws#OpenIdProvider service equal to iss, key via OpenID
  Connect Discovery, azp required, aud must include the AS.
- CID: only a method the document lists for authentication (embedded or
  referenced) authenticates; controller must be the subject; revoked /
  expired methods refused.
- Access documents validated (type, storage, inbox as URIs, policies with
  action and assignee); requests may be posted by any authenticated
  agent; the format constraint is honoured; search filtering honours
  the writer allowlist.
- scripts/touchstone.sh --auth declares ReachableFixtures and hosts the
  harness fixtures on a loopback port.

Own suite: 131/131 (six batteries). Touchstone 5c49679 --auth: 172
passed, 7 failed, 24 inapplicable — auth/cid 22/22, auth/oidc 6/6,
index 32/33; the three MUST failures are webhook subscription
authorization and RFC 9421 signature resolution, next.
…ed AS key — Touchstone: conformant

- Subscriptions: any authenticated agent, to topics it can read; read
  access re-checked at delivery time so a revoked grant silences a
  subscription; 5xx/network retried with backoff, 410 or five failures
  deactivate (active: false); grants/requests with an inbox are announced
  there. The storage description is public so receivers resolve keyid.
- Access tokens must name exactly this storage as audience.
- Search pages carry the QUERY filter in an opaque ?q= token; results
  negotiate ld+json/json like a listing.
- LWS_AS_KEY_JWK: an operator-supplied AS signing key. The Touchstone
  runner generates one per run and declares HarnessIssuedTokens, hosts
  the fixtures (ReachableFixtures), targets a container inside the
  storage (the storage URI answers its public description, the harness
  needs a 401 to find the AS), page size 4.

Own suite 131/131. Touchstone 5c49679 --auth: 196 passed, 0 failed,
0 cantTell, 7 inapplicable (3 SAML, 4 optional preconditions):
conformant.
@melvincarvalho

Copy link
Copy Markdown
Contributor Author

Fourth commit, and the scoreboard is done for everything but SAML:

Touchstone 5c49679, --auth (Authentication + ReachableFixtures + HarnessIssuedTokens): 196 passed, 0 failed, 0 cantTell, 7 inapplicable — conformant.

manifest passed
auth/cid 22/22
auth/oidc 6/6
core/authorization_server 9/9
core/storage_authorization 17/17
core/access_grants 17/17
core/notifications + notifications/webhook 14/14 + 10/10
index 36/36
discovery, containers, data_resources, conditional, linksets, pagination all

The seven inapplicable: three need SamlTrust, four are preconditions for optional behaviour (Content-Location on search results, a one-page listing that still paginates, a first-page link on a one-page search, container access that does not reach members).

This commit: webhook subscriptions for any authenticated reader with permission re-checked at delivery (a revoked grant silences a subscription), retry/deactivation, inbox announcements for grants, exactly-one-audience access tokens, QUERY filters carried in opaque page tokens, and LWS_AS_KEY_JWK so the harness can hold the AS key. Own suite 131/131 across six batteries (new: oidc.js).

@melvincarvalho melvincarvalho changed the title Storage discovery per the 5 Oct 2026 draft; Touchstone runner Bring lwsd to the Oct 2026 LWS drafts — Touchstone-conformant Oct 14, 2026
@melvincarvalho
melvincarvalho merged commit e58693d into gh-pages Oct 14, 2026
@melvincarvalho
melvincarvalho deleted the oct-drafts/storage-discovery branch October 14, 2026 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant