javascript-solid-server 0.0.183 → 0.0.184
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/settings.local.json +3 -1
- package/package.json +1 -1
- package/src/webid/profile.js +13 -1
- package/test/webid.test.js +77 -0
|
@@ -411,7 +411,9 @@
|
|
|
411
411
|
"Bash(cp /tmp/consent-preview.html ~/consent-preview.html)",
|
|
412
412
|
"Read(//home/melvin/**)",
|
|
413
413
|
"Bash(/usr/bin/chromium-browser --headless --no-sandbox --disable-gpu --hide-scrollbars --window-size=520,900 --screenshot=consent.png file:///home/melvin/consent-preview.html)",
|
|
414
|
-
"Bash(sed -i '0,/\"version\": \"0.0.181\"/{s/\"version\": \"0.0.181\"/\"version\": \"0.0.182\"/}' package-lock.json)"
|
|
414
|
+
"Bash(sed -i '0,/\"version\": \"0.0.181\"/{s/\"version\": \"0.0.181\"/\"version\": \"0.0.182\"/}' package-lock.json)",
|
|
415
|
+
"WebFetch(domain:losos.org)",
|
|
416
|
+
"Bash(sed -i '0,/\"version\": \"0.0.183\"/{s/\"version\": \"0.0.183\"/\"version\": \"0.0.184\"/}' package-lock.json)"
|
|
415
417
|
]
|
|
416
418
|
}
|
|
417
419
|
}
|
package/package.json
CHANGED
package/src/webid/profile.js
CHANGED
|
@@ -75,7 +75,19 @@ export function generateProfileJsonLd({ webId, name, podUri, issuer }) {
|
|
|
75
75
|
'authentication': { '@id': 'cid:authentication', '@type': '@id', '@container': '@set' },
|
|
76
76
|
'assertionMethod': { '@id': 'cid:assertionMethod', '@type': '@id', '@container': '@set' },
|
|
77
77
|
'publicKeyJwk': { '@id': 'cid:publicKeyJwk', '@type': '@json' },
|
|
78
|
-
'publicKeyMultibase': { '@id': 'cid:publicKeyMultibase' }
|
|
78
|
+
'publicKeyMultibase': { '@id': 'cid:publicKeyMultibase' },
|
|
79
|
+
// CID v1 verificationMethod *class* names (#417). Without these
|
|
80
|
+
// term mappings, an app PATCHing in a VM with `type: "Multikey"`
|
|
81
|
+
// (the spec-example shape) emits a bare relative-IRI `<Multikey>`
|
|
82
|
+
// when JSS conneg-converts the profile to Turtle — which then
|
|
83
|
+
// resolves against the document's base URL to a fictional class
|
|
84
|
+
// like `<pod>/profile/Multikey`. Mapping the class names here
|
|
85
|
+
// means the bare term `"Multikey"` in JSON-LD expands correctly
|
|
86
|
+
// (cid:Multikey → https://www.w3.org/ns/cid/v1#Multikey) for both
|
|
87
|
+
// JSON-LD processors AND our Turtle conneg layer. Naive JSON
|
|
88
|
+
// readers comparing `type === "Multikey"` continue to work.
|
|
89
|
+
'Multikey': 'cid:Multikey',
|
|
90
|
+
'JsonWebKey': 'cid:JsonWebKey'
|
|
79
91
|
},
|
|
80
92
|
'@id': webId,
|
|
81
93
|
'@type': ['foaf:Person', 'schema:Person'],
|
package/test/webid.test.js
CHANGED
|
@@ -87,6 +87,30 @@ describe('WebID Profile', () => {
|
|
|
87
87
|
assert.strictEqual(ctx.publicKeyJwk['@type'], '@json');
|
|
88
88
|
});
|
|
89
89
|
|
|
90
|
+
it('declares CID v1 class names (Multikey, JsonWebKey) as flat aliases (#417)', async () => {
|
|
91
|
+
// Without these mappings, an app PATCHing in a VM with the
|
|
92
|
+
// spec-example shape `{type: "Multikey", ...}` produces a bare
|
|
93
|
+
// relative-IRI `<Multikey>` in the Turtle conneg output, which
|
|
94
|
+
// resolves to a fictional class on the pod's own host (e.g.
|
|
95
|
+
// `<pod>/profile/Multikey` instead of `cid:Multikey`).
|
|
96
|
+
//
|
|
97
|
+
// The flat-alias shape (`"Multikey": "cid:Multikey"`) makes
|
|
98
|
+
// bare-term emission work correctly through both JSON-LD
|
|
99
|
+
// expansion AND our Turtle conneg layer — and matches the
|
|
100
|
+
// "JSON-LD with flat context aliases" pattern consumers like
|
|
101
|
+
// LOSOS / LION rely on.
|
|
102
|
+
const res = await request(profilePath);
|
|
103
|
+
const jsonLd = await res.json();
|
|
104
|
+
const ctx = jsonLd['@context'];
|
|
105
|
+
for (const cls of ['Multikey', 'JsonWebKey']) {
|
|
106
|
+
const mapping = ctx[cls];
|
|
107
|
+
assert.ok(mapping, `@context must define class alias \`${cls}\``);
|
|
108
|
+
const id = typeof mapping === 'string' ? mapping : mapping['@id'];
|
|
109
|
+
assert.match(id, new RegExp(`^(cid:${cls}|https://www\\.w3\\.org/ns/cid/v1#${cls})$`),
|
|
110
|
+
`${cls} must map to the CID v1 namespace`);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
|
|
90
114
|
it('declares self-control via controller === @id (#386 Phase A)', async () => {
|
|
91
115
|
const res = await request(profilePath);
|
|
92
116
|
const jsonLd = await res.json();
|
|
@@ -216,6 +240,59 @@ describe('WebID Profile — Turtle conneg (#320)', () => {
|
|
|
216
240
|
await stopTestServer();
|
|
217
241
|
});
|
|
218
242
|
|
|
243
|
+
it('Turtle conneg: generated profile @context expands bare Multikey/JsonWebKey terms (#417)', async () => {
|
|
244
|
+
// Combine the production profile generator's @context with a
|
|
245
|
+
// synthetic VM (the spec-example shape `{type: "Multikey", ...}`)
|
|
246
|
+
// and run it through the same conneg path the live profile
|
|
247
|
+
// would. Asserts: the bare-term type expands to the CID v1
|
|
248
|
+
// namespace, not to a relative IRI that resolves to a fake
|
|
249
|
+
// class on the pod's host.
|
|
250
|
+
const { generateProfile } = await import('../src/webid/profile.js');
|
|
251
|
+
const { fromJsonLd } = await import('../src/rdf/conneg.js');
|
|
252
|
+
const webId = 'https://example.test/profile/card.jsonld#me';
|
|
253
|
+
const profile = generateProfile({
|
|
254
|
+
webId,
|
|
255
|
+
name: 'mk-test',
|
|
256
|
+
podUri: 'https://example.test/',
|
|
257
|
+
issuer: 'https://example.test/',
|
|
258
|
+
});
|
|
259
|
+
// Inject a Multikey VM authored with the spec-example bare-term
|
|
260
|
+
// type — this is the shape the bug surfaces on.
|
|
261
|
+
const vmId = webId.replace('#me', '#nostr-key-1');
|
|
262
|
+
profile.verificationMethod = [{
|
|
263
|
+
id: vmId,
|
|
264
|
+
type: 'Multikey',
|
|
265
|
+
controller: webId,
|
|
266
|
+
publicKeyMultibase: 'fe70102de7ec0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab',
|
|
267
|
+
}];
|
|
268
|
+
profile.authentication = [vmId];
|
|
269
|
+
|
|
270
|
+
const { content: ttl } = await fromJsonLd(profile, 'text/turtle', 'https://example.test/', true);
|
|
271
|
+
|
|
272
|
+
// Pre-#417: would emit `a <Multikey>` (relative — resolves to
|
|
273
|
+
// `https://example.test/profile/Multikey`).
|
|
274
|
+
// After #417: the @context maps `Multikey -> cid:Multikey`, so
|
|
275
|
+
// the converter expands the bare term to the CID v1 IRI.
|
|
276
|
+
assert.ok(
|
|
277
|
+
ttl.includes('cid:Multikey') || ttl.includes('cid/v1#Multikey'),
|
|
278
|
+
`Turtle must emit a CID-namespaced Multikey class, got:\n${ttl}`,
|
|
279
|
+
);
|
|
280
|
+
assert.ok(
|
|
281
|
+
!/\ba\s+<Multikey>\s*[;.]/.test(ttl),
|
|
282
|
+
`Turtle must NOT emit bare <Multikey> (resolves to fictional class), got:\n${ttl}`,
|
|
283
|
+
);
|
|
284
|
+
// Don't regress #416: the VM block + publicKeyMultibase must
|
|
285
|
+
// still survive the conversion.
|
|
286
|
+
assert.ok(
|
|
287
|
+
ttl.includes('publicKeyMultibase') || ttl.includes('cid/v1#publicKeyMultibase'),
|
|
288
|
+
`Turtle must include cid:publicKeyMultibase, got:\n${ttl}`,
|
|
289
|
+
);
|
|
290
|
+
assert.ok(
|
|
291
|
+
ttl.includes('fe70102de7ec'),
|
|
292
|
+
`Turtle must include the publicKeyMultibase value, got:\n${ttl}`,
|
|
293
|
+
);
|
|
294
|
+
});
|
|
295
|
+
|
|
219
296
|
it('Turtle variant includes cid:service with lws:OpenIdProvider and serviceEndpoint', async () => {
|
|
220
297
|
const res = await request('/webidturtletest/profile/card.jsonld', {
|
|
221
298
|
headers: { Accept: 'text/turtle' }
|