javascript-solid-server 0.0.31 → 0.0.32
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/README.md +13 -5
- package/clock-updater.mjs +58 -0
- package/package.json +2 -2
- package/src/idp/index.js +2 -0
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ A minimal, fast, JSON-LD native Solid server.
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
### Implemented (v0.0.
|
|
7
|
+
### Implemented (v0.0.31)
|
|
8
8
|
|
|
9
9
|
- **LDP CRUD Operations** - GET, PUT, POST, DELETE, HEAD
|
|
10
10
|
- **N3 Patch** - Solid's native patch format for RDF updates
|
|
@@ -17,14 +17,14 @@ A minimal, fast, JSON-LD native Solid server.
|
|
|
17
17
|
- **Multi-user Pods** - Path-based (`/alice/`) or subdomain-based (`alice.example.com`)
|
|
18
18
|
- **Subdomain Mode** - XSS protection via origin isolation
|
|
19
19
|
- **Mashlib Data Browser** - Optional SolidOS UI (CDN or local hosting)
|
|
20
|
-
- **WebID Profiles** - JSON-LD
|
|
20
|
+
- **WebID Profiles** - HTML with JSON-LD data islands, rendered with mashlib-jss + solidos-lite
|
|
21
21
|
- **Web Access Control (WAC)** - `.acl` file-based authorization
|
|
22
22
|
- **Solid-OIDC Identity Provider** - Built-in IdP with DPoP, dynamic registration
|
|
23
23
|
- **Solid-OIDC Resource Server** - Accept DPoP-bound access tokens from external IdPs
|
|
24
24
|
- **NSS-style Registration** - Username/password auth compatible with Solid apps
|
|
25
25
|
- **Nostr Authentication** - NIP-98 HTTP Auth with Schnorr signatures
|
|
26
26
|
- **Simple Auth Tokens** - Built-in token authentication for development
|
|
27
|
-
- **Content Negotiation** -
|
|
27
|
+
- **Content Negotiation** - Turtle <-> JSON-LD conversion, including HTML data islands
|
|
28
28
|
- **CORS Support** - Full cross-origin resource sharing
|
|
29
29
|
|
|
30
30
|
### HTTP Methods
|
|
@@ -36,7 +36,7 @@ A minimal, fast, JSON-LD native Solid server.
|
|
|
36
36
|
| PUT | Full - Create/update resources |
|
|
37
37
|
| POST | Full - Create in containers |
|
|
38
38
|
| DELETE | Full |
|
|
39
|
-
| PATCH | N3 Patch
|
|
39
|
+
| PATCH | N3 Patch + SPARQL Update |
|
|
40
40
|
| OPTIONS | Full with CORS |
|
|
41
41
|
|
|
42
42
|
## Getting Started
|
|
@@ -285,7 +285,15 @@ npm install && npm run build
|
|
|
285
285
|
3. Mashlib fetches the actual data via content negotiation
|
|
286
286
|
4. Mashlib renders an interactive, editable view
|
|
287
287
|
|
|
288
|
-
**Note:** Mashlib works best with `--conneg` enabled for Turtle support.
|
|
288
|
+
**Note:** Mashlib works best with `--conneg` enabled for Turtle support.
|
|
289
|
+
|
|
290
|
+
### Profile Pages
|
|
291
|
+
|
|
292
|
+
Pod profiles (`/alice/`) use HTML with embedded JSON-LD data islands and are rendered using:
|
|
293
|
+
- [mashlib-jss](https://github.com/JavaScriptSolidServer/mashlib-jss) - A fork of mashlib with `getPod()` fix for path-based pods
|
|
294
|
+
- [solidos-lite](https://github.com/SolidOS/solidos-lite) - Parses JSON-LD data islands into the RDF store
|
|
295
|
+
|
|
296
|
+
This allows profiles to work without server-side content negotiation while still providing full SolidOS editing capabilities.
|
|
289
297
|
|
|
290
298
|
### WebSocket Notifications
|
|
291
299
|
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clock Updater - Updates the Solid clock every second using Nostr auth
|
|
3
|
+
* Usage: node clock-updater.mjs
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { getPublicKey, finalizeEvent } from 'nostr-tools';
|
|
7
|
+
import { getToken } from 'nostr-tools/nip98';
|
|
8
|
+
|
|
9
|
+
// Nostr keypair (in production, load from env/file)
|
|
10
|
+
const SK_HEX = '3f188544fb81bd324ead7be9697fd9503d18345e233a7b0182915b0b582ddd70';
|
|
11
|
+
const sk = Uint8Array.from(Buffer.from(SK_HEX, 'hex'));
|
|
12
|
+
const pk = getPublicKey(sk);
|
|
13
|
+
|
|
14
|
+
const CLOCK_URL = 'https://solid.social/melvin/public/clock.json';
|
|
15
|
+
|
|
16
|
+
async function updateClock() {
|
|
17
|
+
const now = Math.floor(Date.now() / 1000);
|
|
18
|
+
const isoDate = new Date(now * 1000).toISOString();
|
|
19
|
+
|
|
20
|
+
const clockData = {
|
|
21
|
+
'@context': { 'schema': 'http://schema.org/' },
|
|
22
|
+
'@id': '#clock',
|
|
23
|
+
'@type': 'schema:Clock',
|
|
24
|
+
'schema:dateModified': isoDate,
|
|
25
|
+
'schema:value': now
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
const token = await getToken(CLOCK_URL, 'PUT', (e) => finalizeEvent(e, sk));
|
|
30
|
+
|
|
31
|
+
const res = await fetch(CLOCK_URL, {
|
|
32
|
+
method: 'PUT',
|
|
33
|
+
headers: {
|
|
34
|
+
'Content-Type': 'application/ld+json',
|
|
35
|
+
'Authorization': 'Nostr ' + token
|
|
36
|
+
},
|
|
37
|
+
body: JSON.stringify(clockData)
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const time = isoDate.split('T')[1].replace('Z', '');
|
|
41
|
+
if (res.ok) {
|
|
42
|
+
process.stdout.write(`\r${time} - Updated`);
|
|
43
|
+
} else {
|
|
44
|
+
console.log(`\n${time} - Error: ${res.status} ${res.statusText}`);
|
|
45
|
+
}
|
|
46
|
+
} catch (err) {
|
|
47
|
+
console.log(`\nError: ${err.message}`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
console.log('Clock Updater started');
|
|
52
|
+
console.log('did:nostr:', 'did:nostr:' + pk);
|
|
53
|
+
console.log('Target:', CLOCK_URL);
|
|
54
|
+
console.log('Press Ctrl+C to stop\n');
|
|
55
|
+
|
|
56
|
+
// Run immediately, then every second
|
|
57
|
+
updateClock();
|
|
58
|
+
setInterval(updateClock, 1000);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "javascript-solid-server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.32",
|
|
4
4
|
"description": "A minimal, fast Solid server",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@fastify/websocket": "^8.3.1",
|
|
28
28
|
"bcrypt": "^6.0.0",
|
|
29
29
|
"commander": "^14.0.2",
|
|
30
|
-
"fastify": "^4.
|
|
30
|
+
"fastify": "^4.29.1",
|
|
31
31
|
"fs-extra": "^11.2.0",
|
|
32
32
|
"jose": "^6.1.3",
|
|
33
33
|
"n3": "^1.26.0",
|
package/src/idp/index.js
CHANGED
|
@@ -184,6 +184,8 @@ export async function idpPlugin(fastify, options) {
|
|
|
184
184
|
claims_supported: ['sub', 'webid', 'name', 'email', 'email_verified'],
|
|
185
185
|
code_challenge_methods_supported: ['S256'],
|
|
186
186
|
dpop_signing_alg_values_supported: ['ES256', 'RS256'],
|
|
187
|
+
// RFC 9207 - OAuth 2.0 Authorization Server Issuer Identification
|
|
188
|
+
authorization_response_iss_parameter_supported: true,
|
|
187
189
|
// Solid-OIDC specific
|
|
188
190
|
solid_oidc_supported: 'https://solidproject.org/TR/solid-oidc',
|
|
189
191
|
};
|