javascript-solid-server 0.0.178 → 0.0.180
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/lws.md +35 -24
- package/package.json +1 -1
- package/src/auth/did-nostr.js +417 -73
- package/src/auth/nostr-keys.js +112 -0
- package/src/auth/nostr.js +100 -29
- package/src/idp/interactions.js +69 -7
- package/src/idp/views.js +11 -2
- package/src/idp/well-known-did-nostr.js +458 -0
- package/src/server.js +66 -0
- package/test/did-nostr.test.js +331 -1
- package/test/nostr-cid-vm.test.js +54 -1
- package/test/well-known-did-nostr.test.js +631 -0
package/docs/lws.md
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
# LWS / Controlled Identifiers (CID v1)
|
|
2
2
|
|
|
3
|
-
JSS
|
|
3
|
+
JSS is aligned end-to-end with the W3C [Linked Web Storage 1.0 Authentication Suite](https://www.w3.org/news/2026/first-public-working-drafts-for-the-linked-web-storage-lws-1-0-authentication-suite/) (FPWDs published 2026-04-23) and its substrate, [W3C Controlled Identifiers v1.0](https://www.w3.org/TR/cid-1.0/) — pod profiles are CID-shaped, users add keys via the [doctor](https://jss.live/doctor/), and the server accepts strict LWS10-CID JWTs as an HTTP auth method alongside the existing Solid-OIDC and NIP-98 paths.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Convergence tracker: [#386](https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/386). FPWD-alignment audit: [#319](https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/319).
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Compatibility, by level
|
|
8
8
|
|
|
9
9
|
| | What it means | Status |
|
|
10
10
|
|---|---|---|
|
|
11
11
|
| **1. Profile shape** | A WebID profile that's structurally a W3C Controlled Identifier document — right `@context`, right vocabulary, parseable as a CID document by any LWS-aware tool | ✅ **Yes** (since v0.0.174, [#388](https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/388)) |
|
|
12
|
-
| **2. Profile carries keys** | The CID document actually declares `verificationMethod` entries an LWS verifier can look up by `kid` |
|
|
13
|
-
| **3. Server accepts LWS-CID JWTs** | An incoming request with an LWS-CID self-signed JWT (`sub`/`iss`/`client_id` triple-equality, `kid` lookup against the WebID's `verificationMethod`, signature check) |
|
|
12
|
+
| **2. Profile carries keys** | The CID document actually declares `verificationMethod` entries an LWS verifier can look up by `kid` | ✅ Browser-side via the [doctor](https://jss.live/doctor/) — [B.2](https://github.com/JavaScriptSolidServer/doctor/pull/2) for Nostr/Multikey, [B.3](https://github.com/JavaScriptSolidServer/doctor/pull/4) for ES256K/JsonWebKey. The doctor authenticates as the WebID owner via Solid-OIDC and PATCHes the VM into the profile. |
|
|
13
|
+
| **3. Server accepts LWS-CID JWTs** | An incoming request with an LWS-CID self-signed JWT (`sub`/`iss`/`client_id` triple-equality, `kid` lookup against the WebID's `verificationMethod`, signature check) | ✅ Shipped in v0.0.177 ([#398](https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/398)). Strict FPWD §4 — ES256K is the focus algorithm; ES256, ES384, EdDSA, RS256 also accepted. |
|
|
14
|
+
| **Bonus: NIP-98 → WebID** | A Schnorr-signed NIP-98 request authenticates as the WebID (not `did:nostr:`) when the pubkey is declared as a CID `verificationMethod` referenced from `authentication` | ✅ Shipped in v0.0.178 ([#400](https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/400)). No client-side change — the doctor's B.2 output is enough to light it up. |
|
|
14
15
|
|
|
15
16
|
## What Phase A actually does
|
|
16
17
|
|
|
@@ -37,35 +38,42 @@ A freshly-created pod's `profile/card.jsonld` looks like this (excerpt — the e
|
|
|
37
38
|
}
|
|
38
39
|
```
|
|
39
40
|
|
|
40
|
-
##
|
|
41
|
+
## Adding keys (Phase B — via the doctor)
|
|
41
42
|
|
|
42
|
-
|
|
43
|
+
The [doctor](https://jss.live/doctor/) is a separate browser-side tool that signs in to your pod via Solid-OIDC and writes verificationMethod entries to your profile. After the round-trip your profile has:
|
|
43
44
|
|
|
44
45
|
```jsonld
|
|
45
46
|
"verificationMethod": [
|
|
46
|
-
{ "id": "...#nostr-1", "type": "Multikey", "controller": "...#me",
|
|
47
|
-
"publicKeyMultibase": "fe70102
|
|
48
|
-
{ "id": "...#
|
|
49
|
-
"
|
|
50
|
-
{ "id": "...#passkey-1", "type": "JsonWebKey", "controller": "...#me",
|
|
51
|
-
"publicKeyJwk": { "kty": "EC", "crv": "P-256", "x": "...", "y": "..." } }
|
|
47
|
+
{ "id": "...#nostr-key-1", "type": "Multikey", "controller": "...#me",
|
|
48
|
+
"publicKeyMultibase": "fe70102…" },
|
|
49
|
+
{ "id": "...#lws-key-1", "type": "JsonWebKey", "controller": "...#me",
|
|
50
|
+
"publicKeyJwk": { "kty": "EC", "crv": "secp256k1", "alg": "ES256K", "x": "…", "y": "…" } }
|
|
52
51
|
],
|
|
53
|
-
"authentication": ["...#nostr-1", "...#
|
|
52
|
+
"authentication": ["...#nostr-key-1", "...#lws-key-1"]
|
|
54
53
|
```
|
|
55
54
|
|
|
55
|
+
The Multikey entry handles did:nostr binding + NIP-98 lookup; the JsonWebKey entry handles strict LWS10-CID JWT auth. Both can be the same secp256k1 key — different signature schemes (Schnorr vs ECDSA), same private key.
|
|
56
|
+
|
|
56
57
|
Because Phase A already declared the context terms, this is a pure data-layer PATCH — no `@context` rewrite needed.
|
|
57
58
|
|
|
58
|
-
##
|
|
59
|
+
## Server-side verifier (Phase 3 — `src/auth/lws-cid.js`)
|
|
60
|
+
|
|
61
|
+
When an incoming request carries an LWS-CID JWT (detected by an `Authorization: Bearer <jwt>` whose JWT-header `kid` is an http(s) URL with a fragment), JSS:
|
|
62
|
+
|
|
63
|
+
1. Confirms `sub === iss === client_id` (canonicalized via URL parsing) — that URI is the WebID being claimed
|
|
64
|
+
2. Validates `aud` includes the server origin, `exp` not past, `iat` recent, lifetime ≤ 1 hour
|
|
65
|
+
3. Fetches the WebID profile through the shared SSRF guard — manual redirects with same-origin enforcement, 256 KB body cap, bounded LRU cache
|
|
66
|
+
4. Confirms the profile's `@id` equals the JWT's `sub` (closes a profile-substitution attack)
|
|
67
|
+
5. Looks up `kid` in `verificationMethod`; the entry must be referenced from `authentication` and its `controller` must match the profile's outer `controller`
|
|
68
|
+
6. Verifies the JWT signature per RFC7515 §5.2. ES256K via `@noble/curves` (already in tree from NIP-98); ES256, ES384, EdDSA, RS256 via `jose`
|
|
69
|
+
|
|
70
|
+
The verifier joins the existing auth methods (Solid-OIDC, NIP-98, Bearer-JWT-from-IDP, WebID-TLS) — preference order is OIDC → LWS-CID → NIP-98 → Bearer fallback (per [#306](https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/306)).
|
|
59
71
|
|
|
60
|
-
|
|
72
|
+
## NIP-98 → WebID upgrade (`src/auth/nostr.js`)
|
|
61
73
|
|
|
62
|
-
|
|
63
|
-
2. Dereference the WebID, parse it as a CID document
|
|
64
|
-
3. Look up `kid` in the document's `verificationMethod` array
|
|
65
|
-
4. Confirm the method is in `authentication`
|
|
66
|
-
5. Verify the JWT signature with that public key
|
|
74
|
+
Built on top of the LWS-CID infrastructure ([#400](https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/400)): when a NIP-98 request's signing pubkey is declared as a CID `verificationMethod` (and the VM is in `authentication`) on the resource owner's WebID profile, the request authenticates as the WebID instead of `did:nostr:<pubkey>`. Match is by f-form Multikey or by JsonWebKey full-point (x AND y, BIP-340 even-y). Profile fetch uses the same SSRF guard / cache as the LWS-CID verifier. No client-side change — Nostr clients sign as today.
|
|
67
75
|
|
|
68
|
-
|
|
76
|
+
So: anyone who's used the doctor's B.2 to add a Nostr Multikey VM gets WebID-based NIP-98 sign-in for free.
|
|
69
77
|
|
|
70
78
|
## Spec references
|
|
71
79
|
|
|
@@ -76,9 +84,12 @@ The verifier joins the existing auth methods (OIDC, NIP-98, etc.) — preference
|
|
|
76
84
|
|
|
77
85
|
## Related
|
|
78
86
|
|
|
79
|
-
- [`docs/authentication.md`](authentication.md) —
|
|
87
|
+
- [`docs/authentication.md`](authentication.md) — full JSS auth surface (OIDC, NIP-98, LWS-CID, passkey, etc.)
|
|
80
88
|
- [`docs/nostr.md`](nostr.md) — Nostr relay + did:nostr resolution
|
|
89
|
+
- [doctor](https://github.com/JavaScriptSolidServer/doctor) — the browser-side diagnostic + add-keys app
|
|
81
90
|
- [#386](https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/386) — convergence tracker
|
|
82
|
-
- [#388](https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/388) — Phase A
|
|
91
|
+
- [#388](https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/388) — Phase A (profile shape)
|
|
92
|
+
- [#398](https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/398) — Phase 3 (LWS-CID JWT verifier)
|
|
93
|
+
- [#400](https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/400) — NIP-98 → WebID via VM lookup
|
|
83
94
|
- [#389](https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/389) — `@context` array form support (turtle conneg)
|
|
84
95
|
- [#390](https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/390) — `@type:'@json'` literal handling (turtle conneg)
|