@fedify/fedify 1.3.0-dev.487 → 1.3.0-dev.492
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGES.md +59 -0
- package/esm/deno.js +1 -1
- package/esm/runtime/docloader.js +6 -5
- package/esm/sig/ld.js +16 -2
- package/package.json +1 -1
- package/types/sig/ld.d.ts.map +1 -1
package/CHANGES.md
CHANGED
@@ -33,6 +33,22 @@ To be released.
|
|
33
33
|
[#162]: https://github.com/dahlia/fedify/issues/162
|
34
34
|
|
35
35
|
|
36
|
+
Version 1.2.4
|
37
|
+
-------------
|
38
|
+
|
39
|
+
Released on November 12, 2024.
|
40
|
+
|
41
|
+
- Fixed a bug where default document loaders had thrown a `TypeError`
|
42
|
+
with a message <q>Body is unusable: Body has already been read</q> or
|
43
|
+
<q>Body already consumed</q> when the content type of the response was
|
44
|
+
an HTML document and there's no link to a JSON-LD document.
|
45
|
+
|
46
|
+
- Fixed a bug where `verifySignature()` and `verifyJsonLd()` functions
|
47
|
+
sometimes had thrown a `jsonld.ValidationError` error. Now such errors
|
48
|
+
are caught and logged as warnings, and the signature to verify is considered
|
49
|
+
as invalid.
|
50
|
+
|
51
|
+
|
36
52
|
Version 1.2.3
|
37
53
|
-------------
|
38
54
|
|
@@ -122,6 +138,22 @@ Released on October 31, 2024.
|
|
122
138
|
[#118]: https://github.com/dahlia/fedify/issues/118
|
123
139
|
|
124
140
|
|
141
|
+
Version 1.1.4
|
142
|
+
-------------
|
143
|
+
|
144
|
+
Released on November 12, 2024.
|
145
|
+
|
146
|
+
- Fixed a bug where default document loaders had thrown a `TypeError`
|
147
|
+
with a message <q>Body is unusable: Body has already been read</q> or
|
148
|
+
<q>Body already consumed</q> when the content type of the response was
|
149
|
+
an HTML document and there's no link to a JSON-LD document.
|
150
|
+
|
151
|
+
- Fixed a bug where `verifySignature()` and `verifyJsonLd()` functions
|
152
|
+
sometimes had thrown a `jsonld.ValidationError` error. Now such errors
|
153
|
+
are caught and logged as warnings, and the signature to verify is considered
|
154
|
+
as invalid.
|
155
|
+
|
156
|
+
|
125
157
|
Version 1.1.3
|
126
158
|
-------------
|
127
159
|
|
@@ -252,6 +284,22 @@ Released on October 20, 2024.
|
|
252
284
|
[#150]: https://github.com/dahlia/fedify/issues/150
|
253
285
|
|
254
286
|
|
287
|
+
Version 1.0.8
|
288
|
+
-------------
|
289
|
+
|
290
|
+
Released on November 12, 2024.
|
291
|
+
|
292
|
+
- Fixed a bug where default document loaders had thrown a `TypeError`
|
293
|
+
with a message <q>Body is unusable: Body has already been read</q> or
|
294
|
+
<q>Body already consumed</q> when the content type of the response was
|
295
|
+
an HTML document and there's no link to a JSON-LD document.
|
296
|
+
|
297
|
+
- Fixed a bug where `verifySignature()` and `verifyJsonLd()` functions
|
298
|
+
sometimes had thrown a `jsonld.ValidationError` error. Now such errors
|
299
|
+
are caught and logged as warnings, and the signature to verify is considered
|
300
|
+
as invalid.
|
301
|
+
|
302
|
+
|
255
303
|
Version 1.0.7
|
256
304
|
-------------
|
257
305
|
|
@@ -501,6 +549,17 @@ Released on September 26, 2024.
|
|
501
549
|
[#137]: https://github.com/dahlia/fedify/issues/137
|
502
550
|
|
503
551
|
|
552
|
+
Version 0.15.6
|
553
|
+
--------------
|
554
|
+
|
555
|
+
Released on November 12, 2024.
|
556
|
+
|
557
|
+
- Fixed a bug where default document loaders had thrown a `TypeError`
|
558
|
+
with a message <q>Body is unusable: Body has already been read</q> or
|
559
|
+
<q>Body already consumed</q> when the content type of the response was
|
560
|
+
an HTML document and there's no link to a JSON-LD document.
|
561
|
+
|
562
|
+
|
504
563
|
Version 0.15.5
|
505
564
|
--------------
|
506
565
|
|
package/esm/deno.js
CHANGED
package/esm/runtime/docloader.js
CHANGED
@@ -91,6 +91,7 @@ async function getRemoteDocument(url, response, fetch) {
|
|
91
91
|
}
|
92
92
|
}
|
93
93
|
}
|
94
|
+
let document;
|
94
95
|
if (!jsonLd &&
|
95
96
|
(contentType === "text/html" || contentType?.startsWith("text/html;") ||
|
96
97
|
contentType === "application/xhtml+xml" ||
|
@@ -118,17 +119,17 @@ async function getRemoteDocument(url, response, fetch) {
|
|
118
119
|
return await fetch(new URL(attribs.href, docUrl).href);
|
119
120
|
}
|
120
121
|
}
|
122
|
+
document = JSON.parse(html);
|
123
|
+
}
|
124
|
+
else {
|
125
|
+
document = await response.json();
|
121
126
|
}
|
122
127
|
logger.debug("Fetched document: {status} {url} {headers}", {
|
123
128
|
status: response.status,
|
124
129
|
url: documentUrl,
|
125
130
|
headers: Object.fromEntries(response.headers.entries()),
|
126
131
|
});
|
127
|
-
return {
|
128
|
-
contextUrl,
|
129
|
-
document: await response.json(),
|
130
|
-
documentUrl,
|
131
|
-
};
|
132
|
+
return { contextUrl, document, documentUrl };
|
132
133
|
}
|
133
134
|
/**
|
134
135
|
* Creates a JSON-LD document loader that utilizes the browser's `fetch` API.
|
package/esm/sig/ld.js
CHANGED
@@ -139,10 +139,24 @@ export async function verifySignature(jsonLd, options = {}) {
|
|
139
139
|
delete sigOpts.type;
|
140
140
|
delete sigOpts.id;
|
141
141
|
delete sigOpts.signatureValue;
|
142
|
-
|
142
|
+
let sigOptsHash;
|
143
|
+
try {
|
144
|
+
sigOptsHash = await hashJsonLd(sigOpts, options.contextLoader);
|
145
|
+
}
|
146
|
+
catch (error) {
|
147
|
+
logger.warn("Failed to verify; failed to hash the signature options: {signatureOptions}\n{error}", { signatureOptions: sigOpts, error });
|
148
|
+
return null;
|
149
|
+
}
|
143
150
|
const document = { ...jsonLd };
|
144
151
|
delete document.signature;
|
145
|
-
|
152
|
+
let docHash;
|
153
|
+
try {
|
154
|
+
docHash = await hashJsonLd(document, options.contextLoader);
|
155
|
+
}
|
156
|
+
catch (error) {
|
157
|
+
logger.warn("Failed to verify; failed to hash the document: {document}\n{error}", { document, error });
|
158
|
+
return null;
|
159
|
+
}
|
146
160
|
const encoder = new TextEncoder();
|
147
161
|
const message = sigOptsHash + docHash;
|
148
162
|
const messageBytes = encoder.encode(message);
|
package/package.json
CHANGED
package/types/sig/ld.d.ts.map
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