@fedify/fedify 1.5.0-dev.715 → 1.5.0-dev.717
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/CHANGES.md +24 -0
- package/esm/deno.js +1 -1
- package/esm/federation/handler.js +60 -6
- package/esm/federation/middleware.js +7 -5
- package/esm/vocab/vocab.js +1913 -326
- package/package.json +1 -1
- package/types/federation/callback.d.ts +12 -4
- package/types/federation/callback.d.ts.map +1 -1
- package/types/federation/context.d.ts +38 -0
- package/types/federation/context.d.ts.map +1 -1
- package/types/federation/handler.d.ts.map +1 -1
- package/types/federation/middleware.d.ts.map +1 -1
- package/types/vocab/vocab.d.ts +111 -66
- package/types/vocab/vocab.d.ts.map +1 -1
package/CHANGES.md
CHANGED
@@ -27,9 +27,28 @@ To be released.
|
|
27
27
|
- The `fetchKey()` function became to choose the public key of the actor
|
28
28
|
if `keyId` has no fragment and the actor has only one public key. [[#211]]
|
29
29
|
|
30
|
+
- Added an optional parameter with `GetSignedKeyOptions` type to
|
31
|
+
the `RequestContext.getSignedKey()` method.
|
32
|
+
|
33
|
+
- Added `GetSignedKeyOptions` interface.
|
34
|
+
|
30
35
|
- Added an optional parameter with `GetKeyOwnerOptions` type to
|
31
36
|
the `RequestContext.getSignedKeyOwner()` method.
|
32
37
|
|
38
|
+
- Deprecated the parameters of the `AuthorizePredicate` and
|
39
|
+
`ObjectAuthorizePredicate` types to get the signed key and its owner
|
40
|
+
in favor of the `RequestContext.getSignedKey()` and
|
41
|
+
`RequestContext.getSignedKeyOwner()` methods.
|
42
|
+
|
43
|
+
- Deprecated the third parameter of the `AuthorizePredicate` type in favor
|
44
|
+
of the `RequestContext.getSignedKey()` method.
|
45
|
+
- Deprecated the fourth parameter of the `AuthorizePredicate` type in
|
46
|
+
favor of the `RequestContext.getSignedKeyOwner()` method.
|
47
|
+
- Deprecated the third parameter of the `ObjectAuthorizePredicate` type in
|
48
|
+
favor of the `RequestContext.getSignedKey()` method.
|
49
|
+
- Deprecated the fourth parameter of the `ObjectAuthorizePredicate` type
|
50
|
+
in favor of the `RequestContext.getSignedKeyOwner()` method.
|
51
|
+
|
33
52
|
- Fixed a bug of the `fedify inbox` command where it had failed to render
|
34
53
|
the web interface when the `fedify` command was installed using
|
35
54
|
`deno install` command from JSR.
|
@@ -43,6 +62,11 @@ To be released.
|
|
43
62
|
- Internalized the [multibase] package, which is obsolete and no longer
|
44
63
|
maintained. [[#127], [#215] by Fróði Karlsson]
|
45
64
|
|
65
|
+
- Added more log messages using the [LogTape] library. Currently the below
|
66
|
+
logger categories are used:
|
67
|
+
|
68
|
+
- `["fedify", "federation", "object"]`
|
69
|
+
|
46
70
|
[#127]: https://github.com/fedify-dev/fedify/issues/127
|
47
71
|
[#209]: https://github.com/fedify-dev/fedify/issues/209
|
48
72
|
[#211]: https://github.com/fedify-dev/fedify/issues/211
|
package/esm/deno.js
CHANGED
@@ -35,8 +35,26 @@ export async function handleActor(request, { identifier, context, actorDispatche
|
|
35
35
|
if (!acceptsJsonLd(request))
|
36
36
|
return await onNotAcceptable(request);
|
37
37
|
if (authorizePredicate != null) {
|
38
|
-
|
39
|
-
|
38
|
+
let key = await context.getSignedKey();
|
39
|
+
key = key?.clone({}, {
|
40
|
+
// @ts-expect-error: $warning is not part of the type definition
|
41
|
+
$warning: {
|
42
|
+
category: ["fedify", "federation", "actor"],
|
43
|
+
message: "The third parameter of AuthorizePredicate is deprecated " +
|
44
|
+
"in favor of RequestContext.getSignedKey() method. The third " +
|
45
|
+
"parameter will be removed in a future release.",
|
46
|
+
},
|
47
|
+
}) ?? null;
|
48
|
+
let keyOwner = await context.getSignedKeyOwner();
|
49
|
+
keyOwner = keyOwner?.clone({}, {
|
50
|
+
// @ts-expect-error: $warning is not part of the type definition
|
51
|
+
$warning: {
|
52
|
+
category: ["fedify", "federation", "actor"],
|
53
|
+
message: "The fourth parameter of AuthorizePredicate is deprecated " +
|
54
|
+
"in favor of RequestContext.getSignedKeyOwner() method. The " +
|
55
|
+
"fourth parameter will be removed in a future release.",
|
56
|
+
},
|
57
|
+
}) ?? null;
|
40
58
|
if (!await authorizePredicate(context, identifier, key, keyOwner)) {
|
41
59
|
return await onUnauthorized(request);
|
42
60
|
}
|
@@ -58,8 +76,26 @@ export async function handleObject(request, { values, context, objectDispatcher,
|
|
58
76
|
if (!acceptsJsonLd(request))
|
59
77
|
return await onNotAcceptable(request);
|
60
78
|
if (authorizePredicate != null) {
|
61
|
-
|
62
|
-
|
79
|
+
let key = await context.getSignedKey();
|
80
|
+
key = key?.clone({}, {
|
81
|
+
// @ts-expect-error: $warning is not part of the type definition
|
82
|
+
$warning: {
|
83
|
+
category: ["fedify", "federation", "object"],
|
84
|
+
message: "The third parameter of ObjectAuthorizePredicate is " +
|
85
|
+
"deprecated in favor of RequestContext.getSignedKey() method. " +
|
86
|
+
"The third parameter will be removed in a future release.",
|
87
|
+
},
|
88
|
+
}) ?? null;
|
89
|
+
let keyOwner = await context.getSignedKeyOwner();
|
90
|
+
keyOwner = keyOwner?.clone({}, {
|
91
|
+
// @ts-expect-error: $warning is not part of the type definition
|
92
|
+
$warning: {
|
93
|
+
category: ["fedify", "federation", "object"],
|
94
|
+
message: "The fourth parameter of ObjectAuthorizePredicate is " +
|
95
|
+
"deprecated in favor of RequestContext.getSignedKeyOwner() method. " +
|
96
|
+
"The fourth parameter will be removed in a future release.",
|
97
|
+
},
|
98
|
+
}) ?? null;
|
63
99
|
if (!await authorizePredicate(context, values, key, keyOwner)) {
|
64
100
|
return await onUnauthorized(request);
|
65
101
|
}
|
@@ -193,8 +229,26 @@ export async function handleCollection(request, { name, identifier, uriGetter, f
|
|
193
229
|
if (!acceptsJsonLd(request))
|
194
230
|
return await onNotAcceptable(request);
|
195
231
|
if (collectionCallbacks.authorizePredicate != null) {
|
196
|
-
|
197
|
-
|
232
|
+
let key = await context.getSignedKey();
|
233
|
+
key = key?.clone({}, {
|
234
|
+
// @ts-expect-error: $warning is not part of the type definition
|
235
|
+
$warning: {
|
236
|
+
category: ["fedify", "federation", "collection"],
|
237
|
+
message: "The third parameter of AuthorizePredicate is deprecated in " +
|
238
|
+
"favor of RequestContext.getSignedKey() method. The third " +
|
239
|
+
"parameter will be removed in a future release.",
|
240
|
+
},
|
241
|
+
}) ?? null;
|
242
|
+
let keyOwner = await context.getSignedKeyOwner();
|
243
|
+
keyOwner = keyOwner?.clone({}, {
|
244
|
+
// @ts-expect-error: $warning is not part of the type definition
|
245
|
+
$warning: {
|
246
|
+
category: ["fedify", "federation", "collection"],
|
247
|
+
message: "The fourth parameter of AuthorizePredicate is deprecated in " +
|
248
|
+
"favor of RequestContext.getSignedKeyOwner() method. The fourth " +
|
249
|
+
"parameter will be removed in a future release.",
|
250
|
+
},
|
251
|
+
}) ?? null;
|
198
252
|
if (!await collectionCallbacks.authorizePredicate(context, identifier, key, keyOwner)) {
|
199
253
|
return await onUnauthorized(request);
|
200
254
|
}
|
@@ -2234,20 +2234,22 @@ class RequestContextImpl extends ContextImpl {
|
|
2234
2234
|
}), values);
|
2235
2235
|
}
|
2236
2236
|
#signedKey = undefined;
|
2237
|
-
async getSignedKey() {
|
2238
|
-
if (this.#signedKey
|
2237
|
+
async getSignedKey(options = {}) {
|
2238
|
+
if (this.#signedKey != null)
|
2239
2239
|
return this.#signedKey;
|
2240
2240
|
return this.#signedKey = await verifyRequest(this.request, {
|
2241
2241
|
...this,
|
2242
|
+
contextLoader: options.contextLoader ?? this.contextLoader,
|
2243
|
+
documentLoader: options.documentLoader ?? this.documentLoader,
|
2242
2244
|
timeWindow: this.federation.signatureTimeWindow,
|
2243
|
-
tracerProvider: this.tracerProvider,
|
2245
|
+
tracerProvider: options.tracerProvider ?? this.tracerProvider,
|
2244
2246
|
});
|
2245
2247
|
}
|
2246
2248
|
#signedKeyOwner = undefined;
|
2247
2249
|
async getSignedKeyOwner(options = {}) {
|
2248
|
-
if (this.#signedKeyOwner
|
2250
|
+
if (this.#signedKeyOwner != null)
|
2249
2251
|
return this.#signedKeyOwner;
|
2250
|
-
const key = await this.getSignedKey();
|
2252
|
+
const key = await this.getSignedKey(options);
|
2251
2253
|
if (key == null)
|
2252
2254
|
return this.#signedKeyOwner = null;
|
2253
2255
|
return this.#signedKeyOwner = await getKeyOwner(key, {
|