javascript-solid-server 0.0.176 → 0.0.177
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/.claude/scheduled_tasks.lock +1 -0
- package/README.md +1 -0
- package/docs/lws.md +84 -0
- package/package.json +1 -1
- package/src/auth/lws-cid.js +679 -0
- package/src/auth/token.js +12 -1
- package/test/lws-cid.test.js +705 -0
package/src/auth/token.js
CHANGED
|
@@ -4,11 +4,14 @@
|
|
|
4
4
|
* Supports multiple modes:
|
|
5
5
|
* 1. Simple tokens (for local/dev use): base64(JSON({webId, iat, exp})) + HMAC signature
|
|
6
6
|
* 2. Solid-OIDC DPoP tokens (for federation): verified via external IdP JWKS
|
|
7
|
-
* 3.
|
|
7
|
+
* 3. LWS10-CID JWTs (FPWD 2026-04-23): kid points at a verificationMethod
|
|
8
|
+
* in the subject's WebID profile; signed with a JWS alg (ES256K, ES256, …)
|
|
9
|
+
* 4. Nostr NIP-98 tokens: Schnorr signatures, returns did:nostr identity
|
|
8
10
|
*/
|
|
9
11
|
|
|
10
12
|
import crypto from 'crypto';
|
|
11
13
|
import { verifySolidOidc, hasSolidOidcAuth } from './solid-oidc.js';
|
|
14
|
+
import { verifyLwsCidAuth, hasLwsCidAuth } from './lws-cid.js';
|
|
12
15
|
import { verifyNostrAuth, hasNostrAuth } from './nostr.js';
|
|
13
16
|
import { webIdTlsAuth, hasClientCertificate } from './webid-tls.js';
|
|
14
17
|
import { resolveTokenSecret } from './token-secret.js';
|
|
@@ -205,6 +208,14 @@ export async function getWebIdFromRequestAsync(request) {
|
|
|
205
208
|
return verifySolidOidc(request);
|
|
206
209
|
}
|
|
207
210
|
|
|
211
|
+
// Try LWS10-CID (Bearer JWT whose kid is a fragment URL into a CID
|
|
212
|
+
// document). Detected by header shape, so it doesn't conflict with
|
|
213
|
+
// the IDP-issued JWTs handled in the Bearer fallback below — those
|
|
214
|
+
// use opaque fingerprint kids, not URLs.
|
|
215
|
+
if (hasLwsCidAuth(request)) {
|
|
216
|
+
return verifyLwsCidAuth(request);
|
|
217
|
+
}
|
|
218
|
+
|
|
208
219
|
// Try Nostr NIP-98 (Schnorr signatures)
|
|
209
220
|
if (hasNostrAuth(request)) {
|
|
210
221
|
return verifyNostrAuth(request);
|