@fedify/fedify 0.10.0-dev.190 → 0.10.0-dev.194
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.
@@ -145,33 +145,12 @@ export class Federation {
|
|
145
145
|
}
|
146
146
|
logger.info("Successfully sent activity {activityId} to {inbox}.", { ...logData, activityId: activity?.id?.href });
|
147
147
|
}
|
148
|
-
async #getKeyPairsFromHandle(url, contextData, handle) {
|
149
|
-
const logger = getLogger(["fedify", "federation", "actor"]);
|
150
|
-
if (this.#actorCallbacks?.keyPairsDispatcher == null) {
|
151
|
-
throw new Error("No actor key pairs dispatcher registered.");
|
152
|
-
}
|
153
|
-
const path = this.#router.build("actor", { handle });
|
154
|
-
if (path == null) {
|
155
|
-
logger.warn("No actor dispatcher registered.");
|
156
|
-
return [];
|
157
|
-
}
|
158
|
-
const actorUri = new URL(path, url);
|
159
|
-
const keyPairs = await this.#actorCallbacks?.keyPairsDispatcher(contextData, handle);
|
160
|
-
if (keyPairs.length < 1) {
|
161
|
-
logger.warn("No key pairs found for actor {handle}.", { handle });
|
162
|
-
}
|
163
|
-
let i = 0;
|
164
|
-
const result = [];
|
165
|
-
for (const keyPair of keyPairs) {
|
166
|
-
result.push({
|
167
|
-
...keyPair,
|
168
|
-
keyId: new URL(i == 0 ? `#main-key` : `#key-${i + 1}`, actorUri),
|
169
|
-
});
|
170
|
-
i++;
|
171
|
-
}
|
172
|
-
return result;
|
173
|
-
}
|
174
148
|
createContext(urlOrRequest, contextData) {
|
149
|
+
return urlOrRequest instanceof Request
|
150
|
+
? this.#createContext(urlOrRequest, contextData)
|
151
|
+
: this.#createContext(urlOrRequest, contextData);
|
152
|
+
}
|
153
|
+
#createContext(urlOrRequest, contextData, opts = {}) {
|
175
154
|
const request = urlOrRequest instanceof Request ? urlOrRequest : null;
|
176
155
|
const url = urlOrRequest instanceof URL
|
177
156
|
? new URL(urlOrRequest)
|
@@ -183,304 +162,28 @@ export class Federation {
|
|
183
162
|
}
|
184
163
|
if (this.#treatHttps)
|
185
164
|
url.protocol = "https:";
|
186
|
-
const
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
"SHA-256") {
|
194
|
-
return keyPair;
|
195
|
-
}
|
196
|
-
}
|
197
|
-
getLogger(["fedify", "federation", "actor"]).warn("No RSA-PKCS#1-v1.5 SHA-256 key found for actor {handle}.", { handle });
|
198
|
-
return null;
|
199
|
-
};
|
200
|
-
const getAuthenticatedDocumentLoader = this.#authenticatedDocumentLoaderFactory;
|
201
|
-
const documentLoader = this.#documentLoader;
|
202
|
-
function getDocumentLoader(identity) {
|
203
|
-
if ("handle" in identity) {
|
204
|
-
const keyPair = getRsaKeyPairFromHandle(identity.handle);
|
205
|
-
if (keyPair == null)
|
206
|
-
return documentLoader;
|
207
|
-
return keyPair.then((pair) => pair == null ? documentLoader : getAuthenticatedDocumentLoader(pair));
|
208
|
-
}
|
209
|
-
return getAuthenticatedDocumentLoader(identity);
|
210
|
-
}
|
211
|
-
const context = {
|
165
|
+
const ctxOptions = {
|
166
|
+
url,
|
167
|
+
federation: this,
|
168
|
+
router: this.#router,
|
169
|
+
objectTypeIds: this.#objectTypeIds,
|
170
|
+
objectCallbacks: this.#objectCallbacks,
|
171
|
+
actorCallbacks: this.#actorCallbacks,
|
212
172
|
data: contextData,
|
213
|
-
documentLoader: this.#documentLoader,
|
173
|
+
documentLoader: opts.documentLoader ?? this.#documentLoader,
|
214
174
|
contextLoader: this.#contextLoader,
|
215
|
-
|
216
|
-
const path = this.#router.build("nodeInfo", {});
|
217
|
-
if (path == null) {
|
218
|
-
throw new RouterError("No NodeInfo dispatcher registered.");
|
219
|
-
}
|
220
|
-
return new URL(path, url);
|
221
|
-
},
|
222
|
-
getActorUri: (handle) => {
|
223
|
-
const path = this.#router.build("actor", { handle });
|
224
|
-
if (path == null) {
|
225
|
-
throw new RouterError("No actor dispatcher registered.");
|
226
|
-
}
|
227
|
-
return new URL(path, url);
|
228
|
-
},
|
229
|
-
getObjectUri: (
|
230
|
-
// deno-lint-ignore no-explicit-any
|
231
|
-
cls, values) => {
|
232
|
-
const callbacks = this.#objectCallbacks[cls.typeId.href];
|
233
|
-
if (callbacks == null) {
|
234
|
-
throw new RouterError("No object dispatcher registered.");
|
235
|
-
}
|
236
|
-
for (const param of callbacks.parameters) {
|
237
|
-
if (!(param in values)) {
|
238
|
-
throw new TypeError(`Missing parameter: ${param}`);
|
239
|
-
}
|
240
|
-
}
|
241
|
-
const path = this.#router.build(`object:${cls.typeId.href}`, values);
|
242
|
-
if (path == null) {
|
243
|
-
throw new RouterError("No object dispatcher registered.");
|
244
|
-
}
|
245
|
-
return new URL(path, url);
|
246
|
-
},
|
247
|
-
getOutboxUri: (handle) => {
|
248
|
-
const path = this.#router.build("outbox", { handle });
|
249
|
-
if (path == null) {
|
250
|
-
throw new RouterError("No outbox dispatcher registered.");
|
251
|
-
}
|
252
|
-
return new URL(path, url);
|
253
|
-
},
|
254
|
-
getInboxUri: (handle) => {
|
255
|
-
if (handle == null) {
|
256
|
-
const path = this.#router.build("sharedInbox", {});
|
257
|
-
if (path == null) {
|
258
|
-
throw new RouterError("No shared inbox path registered.");
|
259
|
-
}
|
260
|
-
return new URL(path, url);
|
261
|
-
}
|
262
|
-
const path = this.#router.build("inbox", { handle });
|
263
|
-
if (path == null) {
|
264
|
-
throw new RouterError("No inbox path registered.");
|
265
|
-
}
|
266
|
-
return new URL(path, url);
|
267
|
-
},
|
268
|
-
getFollowingUri: (handle) => {
|
269
|
-
const path = this.#router.build("following", { handle });
|
270
|
-
if (path == null) {
|
271
|
-
throw new RouterError("No following collection path registered.");
|
272
|
-
}
|
273
|
-
return new URL(path, url);
|
274
|
-
},
|
275
|
-
getFollowersUri: (handle) => {
|
276
|
-
const path = this.#router.build("followers", { handle });
|
277
|
-
if (path == null) {
|
278
|
-
throw new RouterError("No followers collection path registered.");
|
279
|
-
}
|
280
|
-
return new URL(path, url);
|
281
|
-
},
|
282
|
-
parseUri: (uri) => {
|
283
|
-
if (uri.origin !== url.origin)
|
284
|
-
return null;
|
285
|
-
const route = this.#router.route(uri.pathname);
|
286
|
-
if (route == null)
|
287
|
-
return null;
|
288
|
-
else if (route.name === "actor") {
|
289
|
-
return { type: "actor", handle: route.values.handle };
|
290
|
-
}
|
291
|
-
else if (route.name.startsWith("object:")) {
|
292
|
-
const typeId = route.name.replace(/^object:/, "");
|
293
|
-
return {
|
294
|
-
type: "object",
|
295
|
-
class: this.#objectTypeIds[typeId],
|
296
|
-
typeId: new URL(typeId),
|
297
|
-
values: route.values,
|
298
|
-
};
|
299
|
-
}
|
300
|
-
else if (route.name === "inbox") {
|
301
|
-
return { type: "inbox", handle: route.values.handle };
|
302
|
-
}
|
303
|
-
else if (route.name === "sharedInbox") {
|
304
|
-
return { type: "inbox" };
|
305
|
-
}
|
306
|
-
else if (route.name === "outbox") {
|
307
|
-
return { type: "outbox", handle: route.values.handle };
|
308
|
-
}
|
309
|
-
else if (route.name === "following") {
|
310
|
-
return { type: "following", handle: route.values.handle };
|
311
|
-
}
|
312
|
-
else if (route.name === "followers") {
|
313
|
-
return { type: "followers", handle: route.values.handle };
|
314
|
-
}
|
315
|
-
return null;
|
316
|
-
},
|
317
|
-
getHandleFromActorUri(actorUri) {
|
318
|
-
getLogger(["fedify", "federation"]).warn("Context.getHandleFromActorUri() is deprecated; " +
|
319
|
-
"use Context.parseUri() instead.");
|
320
|
-
const result = this.parseUri(actorUri);
|
321
|
-
if (result?.type === "actor")
|
322
|
-
return result.handle;
|
323
|
-
return null;
|
324
|
-
},
|
325
|
-
getActorKeyPairs: async (handle) => {
|
326
|
-
let keyPairs;
|
327
|
-
try {
|
328
|
-
keyPairs = await this.#getKeyPairsFromHandle(url, contextData, handle);
|
329
|
-
}
|
330
|
-
catch (_) {
|
331
|
-
getLogger(["fedify", "federation", "actor"])
|
332
|
-
.warn("No actor key pairs dispatcher registered.");
|
333
|
-
return [];
|
334
|
-
}
|
335
|
-
const owner = context.getActorUri(handle);
|
336
|
-
const result = [];
|
337
|
-
for (const keyPair of keyPairs) {
|
338
|
-
const newPair = {
|
339
|
-
...keyPair,
|
340
|
-
cryptographicKey: new CryptographicKey({
|
341
|
-
id: keyPair.keyId,
|
342
|
-
owner,
|
343
|
-
publicKey: keyPair.publicKey,
|
344
|
-
}),
|
345
|
-
};
|
346
|
-
result.push(newPair);
|
347
|
-
}
|
348
|
-
return result;
|
349
|
-
},
|
350
|
-
getActorKey: async (handle) => {
|
351
|
-
getLogger(["fedify", "federation", "actor"]).warn("Context.getActorKey() method is deprecated; " +
|
352
|
-
"use Context.getActorKeyPairs() method instead.");
|
353
|
-
let keyPair;
|
354
|
-
try {
|
355
|
-
keyPair = await getRsaKeyPairFromHandle(handle);
|
356
|
-
}
|
357
|
-
catch (_) {
|
358
|
-
return null;
|
359
|
-
}
|
360
|
-
if (keyPair == null)
|
361
|
-
return null;
|
362
|
-
return new CryptographicKey({
|
363
|
-
id: keyPair.keyId,
|
364
|
-
owner: context.getActorUri(handle),
|
365
|
-
publicKey: keyPair.publicKey,
|
366
|
-
});
|
367
|
-
},
|
368
|
-
getDocumentLoader,
|
369
|
-
sendActivity: async (sender, recipients, activity, options = {}) => {
|
370
|
-
let senderPair;
|
371
|
-
if ("handle" in sender) {
|
372
|
-
const keyPair = await getRsaKeyPairFromHandle(sender.handle);
|
373
|
-
if (keyPair == null) {
|
374
|
-
throw new Error(`No key pair found for actor ${sender.handle}`);
|
375
|
-
}
|
376
|
-
senderPair = keyPair;
|
377
|
-
}
|
378
|
-
else {
|
379
|
-
senderPair = sender;
|
380
|
-
}
|
381
|
-
const opts = { ...options };
|
382
|
-
let expandedRecipients;
|
383
|
-
if (Array.isArray(recipients)) {
|
384
|
-
expandedRecipients = recipients;
|
385
|
-
}
|
386
|
-
else if (recipients === "followers") {
|
387
|
-
if (!("handle" in sender)) {
|
388
|
-
throw new Error("If recipients is 'followers', sender must be an actor handle.");
|
389
|
-
}
|
390
|
-
expandedRecipients = [];
|
391
|
-
for await (const recipient of this.#getFollowers(reqCtx, sender.handle)) {
|
392
|
-
expandedRecipients.push(recipient);
|
393
|
-
}
|
394
|
-
const collectionId = this.#router.build("followers", sender);
|
395
|
-
opts.collectionSync = collectionId == null
|
396
|
-
? undefined
|
397
|
-
: new URL(collectionId, url).href;
|
398
|
-
}
|
399
|
-
else {
|
400
|
-
expandedRecipients = [recipients];
|
401
|
-
}
|
402
|
-
return await this.sendActivity(senderPair, expandedRecipients, activity, opts);
|
403
|
-
},
|
175
|
+
authenticatedDocumentLoaderFactory: this.#authenticatedDocumentLoaderFactory,
|
404
176
|
};
|
405
177
|
if (request == null)
|
406
|
-
return
|
407
|
-
|
408
|
-
|
409
|
-
const timeWindow = this.#signatureTimeWindow;
|
410
|
-
const reqCtx = {
|
411
|
-
...context,
|
178
|
+
return new ContextImpl(ctxOptions);
|
179
|
+
return new RequestContextImpl({
|
180
|
+
...ctxOptions,
|
412
181
|
request,
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
}
|
419
|
-
let rsaKey;
|
420
|
-
try {
|
421
|
-
rsaKey = await getRsaKeyPairFromHandle(handle);
|
422
|
-
}
|
423
|
-
catch (_) {
|
424
|
-
rsaKey = null;
|
425
|
-
}
|
426
|
-
return await this.#actorCallbacks.dispatcher({
|
427
|
-
...reqCtx,
|
428
|
-
getActor(handle2) {
|
429
|
-
getLogger(["fedify", "federation"]).warn("RequestContext.getActor({getActorHandle}) is invoked from " +
|
430
|
-
"the actor dispatcher ({actorDispatcherHandle}); " +
|
431
|
-
"this may cause an infinite loop.", { getActorHandle: handle2, actorDispatcherHandle: handle });
|
432
|
-
return reqCtx.getActor(handle2);
|
433
|
-
},
|
434
|
-
}, handle, rsaKey == null ? null : new CryptographicKey({
|
435
|
-
id: rsaKey.keyId,
|
436
|
-
owner: context.getActorUri(handle),
|
437
|
-
publicKey: rsaKey.publicKey,
|
438
|
-
}));
|
439
|
-
},
|
440
|
-
getObject: async (cls, values) => {
|
441
|
-
const callbacks = this.#objectCallbacks[cls.typeId.href];
|
442
|
-
if (callbacks == null) {
|
443
|
-
throw new Error("No object dispatcher registered.");
|
444
|
-
}
|
445
|
-
for (const param of callbacks.parameters) {
|
446
|
-
if (!(param in values)) {
|
447
|
-
throw new TypeError(`Missing parameter: ${param}`);
|
448
|
-
}
|
449
|
-
}
|
450
|
-
return await callbacks.dispatcher({
|
451
|
-
...reqCtx,
|
452
|
-
getObject(cls2, values2) {
|
453
|
-
getLogger(["fedify", "federation"]).warn("RequestContext.getObject({getObjectClass}, " +
|
454
|
-
"{getObjectValues}) is invoked from the object dispatcher " +
|
455
|
-
"({actorDispatcherClass}, {actorDispatcherValues}); " +
|
456
|
-
"this may cause an infinite loop.", {
|
457
|
-
getObjectClass: cls2.name,
|
458
|
-
getObjectValues: values2,
|
459
|
-
actorDispatcherClass: cls.name,
|
460
|
-
actorDispatcherValues: values,
|
461
|
-
});
|
462
|
-
return reqCtx.getObject(cls2, values2);
|
463
|
-
},
|
464
|
-
}, values);
|
465
|
-
},
|
466
|
-
async getSignedKey() {
|
467
|
-
if (signedKey !== undefined)
|
468
|
-
return signedKey;
|
469
|
-
return signedKey = await verifyRequest(request, {
|
470
|
-
...context,
|
471
|
-
timeWindow,
|
472
|
-
});
|
473
|
-
},
|
474
|
-
async getSignedKeyOwner() {
|
475
|
-
if (signedKeyOwner !== undefined)
|
476
|
-
return signedKeyOwner;
|
477
|
-
const key = await this.getSignedKey();
|
478
|
-
if (key == null)
|
479
|
-
return signedKeyOwner = null;
|
480
|
-
return signedKeyOwner = await getKeyOwner(key, context);
|
481
|
-
},
|
482
|
-
};
|
483
|
-
return reqCtx;
|
182
|
+
signatureTimeWindow: this.#signatureTimeWindow,
|
183
|
+
followersCallbacks: this.#followersCallbacks,
|
184
|
+
invokedFromActorDispatcher: opts.invokedFromActorDispatcher,
|
185
|
+
invokedFromObjectDispatcher: opts.invokedFromObjectDispatcher,
|
186
|
+
});
|
484
187
|
}
|
485
188
|
/**
|
486
189
|
* Registers a NodeInfo dispatcher.
|
@@ -798,29 +501,6 @@ export class Federation {
|
|
798
501
|
};
|
799
502
|
return setters;
|
800
503
|
}
|
801
|
-
async *#getFollowers(context, handle) {
|
802
|
-
if (this.#followersCallbacks == null) {
|
803
|
-
throw new Error("No followers collection dispatcher registered.");
|
804
|
-
}
|
805
|
-
const result = await this.#followersCallbacks.dispatcher(context, handle, null);
|
806
|
-
if (result != null) {
|
807
|
-
for (const recipient of result.items)
|
808
|
-
yield recipient;
|
809
|
-
return;
|
810
|
-
}
|
811
|
-
if (this.#followersCallbacks.firstCursor == null) {
|
812
|
-
throw new Error("No first cursor dispatcher registered for followers collection.");
|
813
|
-
}
|
814
|
-
let cursor = await this.#followersCallbacks.firstCursor(context, handle);
|
815
|
-
while (cursor != null) {
|
816
|
-
const result = await this.#followersCallbacks.dispatcher(context, handle, cursor);
|
817
|
-
if (result == null)
|
818
|
-
break;
|
819
|
-
for (const recipient of result.items)
|
820
|
-
yield recipient;
|
821
|
-
cursor = result.nextCursor ?? null;
|
822
|
-
}
|
823
|
-
}
|
824
504
|
/**
|
825
505
|
* Assigns the URL path for the inbox and starts setting inbox listeners.
|
826
506
|
*
|
@@ -1016,7 +696,7 @@ export class Federation {
|
|
1016
696
|
const response = onNotFound(request);
|
1017
697
|
return response instanceof Promise ? await response : response;
|
1018
698
|
}
|
1019
|
-
let context = this
|
699
|
+
let context = this.#createContext(request, contextData);
|
1020
700
|
switch (route.name.replace(/:.*$/, "")) {
|
1021
701
|
case "webfinger":
|
1022
702
|
return await handleWebFinger(request, {
|
@@ -1032,6 +712,9 @@ export class Federation {
|
|
1032
712
|
nodeInfoDispatcher: this.#nodeInfoDispatcher,
|
1033
713
|
});
|
1034
714
|
case "actor":
|
715
|
+
context = this.#createContext(request, contextData, {
|
716
|
+
invokedFromActorDispatcher: { handle: route.values.handle },
|
717
|
+
});
|
1035
718
|
return await handleActor(request, {
|
1036
719
|
handle: route.values.handle,
|
1037
720
|
context,
|
@@ -1044,6 +727,10 @@ export class Federation {
|
|
1044
727
|
case "object": {
|
1045
728
|
const typeId = route.name.replace(/^object:/, "");
|
1046
729
|
const callbacks = this.#objectCallbacks[typeId];
|
730
|
+
const cls = this.#objectTypeIds[typeId];
|
731
|
+
context = this.#createContext(request, contextData, {
|
732
|
+
invokedFromObjectDispatcher: { cls, values: route.values },
|
733
|
+
});
|
1047
734
|
return await handleObject(request, {
|
1048
735
|
values: route.values,
|
1049
736
|
context,
|
@@ -1065,12 +752,11 @@ export class Federation {
|
|
1065
752
|
onNotAcceptable,
|
1066
753
|
});
|
1067
754
|
case "inbox":
|
1068
|
-
context = {
|
1069
|
-
...context,
|
755
|
+
context = this.#createContext(request, contextData, {
|
1070
756
|
documentLoader: await context.getDocumentLoader({
|
1071
757
|
handle: route.values.handle,
|
1072
758
|
}),
|
1073
|
-
};
|
759
|
+
});
|
1074
760
|
// falls through
|
1075
761
|
case "sharedInbox":
|
1076
762
|
return await handleInbox(request, {
|
@@ -1121,6 +807,391 @@ export class Federation {
|
|
1121
807
|
}
|
1122
808
|
}
|
1123
809
|
}
|
810
|
+
class ContextImpl {
|
811
|
+
#url;
|
812
|
+
#federation;
|
813
|
+
#router;
|
814
|
+
#objectTypeIds;
|
815
|
+
objectCallbacks;
|
816
|
+
actorCallbacks;
|
817
|
+
data;
|
818
|
+
documentLoader;
|
819
|
+
contextLoader;
|
820
|
+
#authenticatedDocumentLoaderFactory;
|
821
|
+
constructor({ url, federation, router, objectTypeIds, objectCallbacks, actorCallbacks, data, documentLoader, contextLoader, authenticatedDocumentLoaderFactory, }) {
|
822
|
+
this.#url = url;
|
823
|
+
this.#federation = federation;
|
824
|
+
this.#router = router;
|
825
|
+
this.#objectTypeIds = objectTypeIds;
|
826
|
+
this.objectCallbacks = objectCallbacks;
|
827
|
+
this.actorCallbacks = actorCallbacks;
|
828
|
+
this.data = data;
|
829
|
+
this.documentLoader = documentLoader;
|
830
|
+
this.contextLoader = contextLoader;
|
831
|
+
this.#authenticatedDocumentLoaderFactory =
|
832
|
+
authenticatedDocumentLoaderFactory;
|
833
|
+
}
|
834
|
+
getNodeInfoUri() {
|
835
|
+
const path = this.#router.build("nodeInfo", {});
|
836
|
+
if (path == null) {
|
837
|
+
throw new RouterError("No NodeInfo dispatcher registered.");
|
838
|
+
}
|
839
|
+
return new URL(path, this.#url);
|
840
|
+
}
|
841
|
+
getActorUri(handle) {
|
842
|
+
const path = this.#router.build("actor", { handle });
|
843
|
+
if (path == null) {
|
844
|
+
throw new RouterError("No actor dispatcher registered.");
|
845
|
+
}
|
846
|
+
return new URL(path, this.#url);
|
847
|
+
}
|
848
|
+
getObjectUri(
|
849
|
+
// deno-lint-ignore no-explicit-any
|
850
|
+
cls, values) {
|
851
|
+
const callbacks = this.objectCallbacks[cls.typeId.href];
|
852
|
+
if (callbacks == null) {
|
853
|
+
throw new RouterError("No object dispatcher registered.");
|
854
|
+
}
|
855
|
+
for (const param of callbacks.parameters) {
|
856
|
+
if (!(param in values)) {
|
857
|
+
throw new TypeError(`Missing parameter: ${param}`);
|
858
|
+
}
|
859
|
+
}
|
860
|
+
const path = this.#router.build(`object:${cls.typeId.href}`, values);
|
861
|
+
if (path == null) {
|
862
|
+
throw new RouterError("No object dispatcher registered.");
|
863
|
+
}
|
864
|
+
return new URL(path, this.#url);
|
865
|
+
}
|
866
|
+
getOutboxUri(handle) {
|
867
|
+
const path = this.#router.build("outbox", { handle });
|
868
|
+
if (path == null) {
|
869
|
+
throw new RouterError("No outbox dispatcher registered.");
|
870
|
+
}
|
871
|
+
return new URL(path, this.#url);
|
872
|
+
}
|
873
|
+
getInboxUri(handle) {
|
874
|
+
if (handle == null) {
|
875
|
+
const path = this.#router.build("sharedInbox", {});
|
876
|
+
if (path == null) {
|
877
|
+
throw new RouterError("No shared inbox path registered.");
|
878
|
+
}
|
879
|
+
return new URL(path, this.#url);
|
880
|
+
}
|
881
|
+
const path = this.#router.build("inbox", { handle });
|
882
|
+
if (path == null) {
|
883
|
+
throw new RouterError("No inbox path registered.");
|
884
|
+
}
|
885
|
+
return new URL(path, this.#url);
|
886
|
+
}
|
887
|
+
getFollowingUri(handle) {
|
888
|
+
const path = this.#router.build("following", { handle });
|
889
|
+
if (path == null) {
|
890
|
+
throw new RouterError("No following collection path registered.");
|
891
|
+
}
|
892
|
+
return new URL(path, this.#url);
|
893
|
+
}
|
894
|
+
getFollowersUri(handle) {
|
895
|
+
const path = this.#router.build("followers", { handle });
|
896
|
+
if (path == null) {
|
897
|
+
throw new RouterError("No followers collection path registered.");
|
898
|
+
}
|
899
|
+
return new URL(path, this.#url);
|
900
|
+
}
|
901
|
+
parseUri(uri) {
|
902
|
+
if (uri.origin !== this.#url.origin)
|
903
|
+
return null;
|
904
|
+
const route = this.#router.route(uri.pathname);
|
905
|
+
if (route == null)
|
906
|
+
return null;
|
907
|
+
else if (route.name === "actor") {
|
908
|
+
return { type: "actor", handle: route.values.handle };
|
909
|
+
}
|
910
|
+
else if (route.name.startsWith("object:")) {
|
911
|
+
const typeId = route.name.replace(/^object:/, "");
|
912
|
+
return {
|
913
|
+
type: "object",
|
914
|
+
class: this.#objectTypeIds[typeId],
|
915
|
+
typeId: new URL(typeId),
|
916
|
+
values: route.values,
|
917
|
+
};
|
918
|
+
}
|
919
|
+
else if (route.name === "inbox") {
|
920
|
+
return { type: "inbox", handle: route.values.handle };
|
921
|
+
}
|
922
|
+
else if (route.name === "sharedInbox") {
|
923
|
+
return { type: "inbox" };
|
924
|
+
}
|
925
|
+
else if (route.name === "outbox") {
|
926
|
+
return { type: "outbox", handle: route.values.handle };
|
927
|
+
}
|
928
|
+
else if (route.name === "following") {
|
929
|
+
return { type: "following", handle: route.values.handle };
|
930
|
+
}
|
931
|
+
else if (route.name === "followers") {
|
932
|
+
return { type: "followers", handle: route.values.handle };
|
933
|
+
}
|
934
|
+
return null;
|
935
|
+
}
|
936
|
+
getHandleFromActorUri(actorUri) {
|
937
|
+
getLogger(["fedify", "federation"]).warn("Context.getHandleFromActorUri() is deprecated; " +
|
938
|
+
"use Context.parseUri() instead.");
|
939
|
+
const result = this.parseUri(actorUri);
|
940
|
+
if (result?.type === "actor")
|
941
|
+
return result.handle;
|
942
|
+
return null;
|
943
|
+
}
|
944
|
+
async getActorKeyPairs(handle) {
|
945
|
+
let keyPairs;
|
946
|
+
try {
|
947
|
+
keyPairs = await this.getKeyPairsFromHandle(this.#url, this.data, handle);
|
948
|
+
}
|
949
|
+
catch (_) {
|
950
|
+
getLogger(["fedify", "federation", "actor"])
|
951
|
+
.warn("No actor key pairs dispatcher registered.");
|
952
|
+
return [];
|
953
|
+
}
|
954
|
+
const owner = this.getActorUri(handle);
|
955
|
+
const result = [];
|
956
|
+
for (const keyPair of keyPairs) {
|
957
|
+
const newPair = {
|
958
|
+
...keyPair,
|
959
|
+
cryptographicKey: new CryptographicKey({
|
960
|
+
id: keyPair.keyId,
|
961
|
+
owner,
|
962
|
+
publicKey: keyPair.publicKey,
|
963
|
+
}),
|
964
|
+
};
|
965
|
+
result.push(newPair);
|
966
|
+
}
|
967
|
+
return result;
|
968
|
+
}
|
969
|
+
async getKeyPairsFromHandle(url, contextData, handle) {
|
970
|
+
const logger = getLogger(["fedify", "federation", "actor"]);
|
971
|
+
if (this.actorCallbacks?.keyPairsDispatcher == null) {
|
972
|
+
throw new Error("No actor key pairs dispatcher registered.");
|
973
|
+
}
|
974
|
+
const path = this.#router.build("actor", { handle });
|
975
|
+
if (path == null) {
|
976
|
+
logger.warn("No actor dispatcher registered.");
|
977
|
+
return [];
|
978
|
+
}
|
979
|
+
const actorUri = new URL(path, url);
|
980
|
+
const keyPairs = await this.actorCallbacks?.keyPairsDispatcher(contextData, handle);
|
981
|
+
if (keyPairs.length < 1) {
|
982
|
+
logger.warn("No key pairs found for actor {handle}.", { handle });
|
983
|
+
}
|
984
|
+
let i = 0;
|
985
|
+
const result = [];
|
986
|
+
for (const keyPair of keyPairs) {
|
987
|
+
result.push({
|
988
|
+
...keyPair,
|
989
|
+
keyId: new URL(
|
990
|
+
// For backwards compatibility, the first key is always the #main-key:
|
991
|
+
i == 0 ? `#main-key` : `#key-${i + 1}`, actorUri),
|
992
|
+
});
|
993
|
+
i++;
|
994
|
+
}
|
995
|
+
return result;
|
996
|
+
}
|
997
|
+
async getActorKey(handle) {
|
998
|
+
getLogger(["fedify", "federation", "actor"]).warn("Context.getActorKey() method is deprecated; " +
|
999
|
+
"use Context.getActorKeyPairs() method instead.");
|
1000
|
+
let keyPair;
|
1001
|
+
try {
|
1002
|
+
keyPair = await this.getRsaKeyPairFromHandle(handle);
|
1003
|
+
}
|
1004
|
+
catch (_) {
|
1005
|
+
return null;
|
1006
|
+
}
|
1007
|
+
if (keyPair == null)
|
1008
|
+
return null;
|
1009
|
+
return new CryptographicKey({
|
1010
|
+
id: keyPair.keyId,
|
1011
|
+
owner: this.getActorUri(handle),
|
1012
|
+
publicKey: keyPair.publicKey,
|
1013
|
+
});
|
1014
|
+
}
|
1015
|
+
async getRsaKeyPairFromHandle(handle) {
|
1016
|
+
const keyPairs = await this.getKeyPairsFromHandle(this.#url, this.data, handle);
|
1017
|
+
for (const keyPair of keyPairs) {
|
1018
|
+
const { privateKey } = keyPair;
|
1019
|
+
if (privateKey.algorithm.name === "RSASSA-PKCS1-v1_5" &&
|
1020
|
+
privateKey.algorithm.hash
|
1021
|
+
.name ===
|
1022
|
+
"SHA-256") {
|
1023
|
+
return keyPair;
|
1024
|
+
}
|
1025
|
+
}
|
1026
|
+
getLogger(["fedify", "federation", "actor"]).warn("No RSA-PKCS#1-v1.5 SHA-256 key found for actor {handle}.", { handle });
|
1027
|
+
return null;
|
1028
|
+
}
|
1029
|
+
getDocumentLoader(identity) {
|
1030
|
+
if ("handle" in identity) {
|
1031
|
+
const keyPair = this.getRsaKeyPairFromHandle(identity.handle);
|
1032
|
+
return keyPair.then((pair) => pair == null
|
1033
|
+
? this.documentLoader
|
1034
|
+
: this.#authenticatedDocumentLoaderFactory(pair));
|
1035
|
+
}
|
1036
|
+
return this.#authenticatedDocumentLoaderFactory(identity);
|
1037
|
+
}
|
1038
|
+
async sendActivity(sender, recipients, activity, options = {}) {
|
1039
|
+
let senderPair;
|
1040
|
+
if ("handle" in sender) {
|
1041
|
+
const keyPair = await this.getRsaKeyPairFromHandle(sender.handle);
|
1042
|
+
if (keyPair == null) {
|
1043
|
+
throw new Error(`No key pair found for actor ${sender.handle}`);
|
1044
|
+
}
|
1045
|
+
senderPair = keyPair;
|
1046
|
+
}
|
1047
|
+
else {
|
1048
|
+
senderPair = sender;
|
1049
|
+
}
|
1050
|
+
const opts = { ...options };
|
1051
|
+
let expandedRecipients;
|
1052
|
+
if (Array.isArray(recipients)) {
|
1053
|
+
expandedRecipients = recipients;
|
1054
|
+
}
|
1055
|
+
else if (recipients === "followers") {
|
1056
|
+
if (!("handle" in sender)) {
|
1057
|
+
throw new Error("If recipients is 'followers', sender must be an actor handle.");
|
1058
|
+
}
|
1059
|
+
expandedRecipients = [];
|
1060
|
+
for await (const recipient of this.getFollowers(sender.handle)) {
|
1061
|
+
expandedRecipients.push(recipient);
|
1062
|
+
}
|
1063
|
+
const collectionId = this.#router.build("followers", sender);
|
1064
|
+
opts.collectionSync = collectionId == null
|
1065
|
+
? undefined
|
1066
|
+
: new URL(collectionId, this.#url).href;
|
1067
|
+
}
|
1068
|
+
else {
|
1069
|
+
expandedRecipients = [recipients];
|
1070
|
+
}
|
1071
|
+
return await this.#federation.sendActivity(senderPair, expandedRecipients, activity, opts);
|
1072
|
+
}
|
1073
|
+
getFollowers(_handle) {
|
1074
|
+
throw new Error('"followers" recipients are not supported in Context. ' +
|
1075
|
+
"Use RequestContext instead.");
|
1076
|
+
}
|
1077
|
+
}
|
1078
|
+
class RequestContextImpl extends ContextImpl {
|
1079
|
+
#options;
|
1080
|
+
#followersCallbacks;
|
1081
|
+
#signatureTimeWindow;
|
1082
|
+
#invokedFromActorDispatcher;
|
1083
|
+
#invokedFromObjectDispatcher;
|
1084
|
+
request;
|
1085
|
+
url;
|
1086
|
+
constructor(options) {
|
1087
|
+
super(options);
|
1088
|
+
this.#options = options;
|
1089
|
+
this.#followersCallbacks = options.followersCallbacks;
|
1090
|
+
this.#signatureTimeWindow = options.signatureTimeWindow;
|
1091
|
+
this.#invokedFromActorDispatcher = options.invokedFromActorDispatcher;
|
1092
|
+
this.#invokedFromObjectDispatcher = options.invokedFromObjectDispatcher;
|
1093
|
+
this.request = options.request;
|
1094
|
+
this.url = options.url;
|
1095
|
+
}
|
1096
|
+
async *getFollowers(handle) {
|
1097
|
+
if (this.#followersCallbacks == null) {
|
1098
|
+
throw new Error("No followers collection dispatcher registered.");
|
1099
|
+
}
|
1100
|
+
const result = await this.#followersCallbacks.dispatcher(this, handle, null);
|
1101
|
+
if (result != null) {
|
1102
|
+
for (const recipient of result.items)
|
1103
|
+
yield recipient;
|
1104
|
+
return;
|
1105
|
+
}
|
1106
|
+
if (this.#followersCallbacks.firstCursor == null) {
|
1107
|
+
throw new Error("No first cursor dispatcher registered for followers collection.");
|
1108
|
+
}
|
1109
|
+
let cursor = await this.#followersCallbacks.firstCursor(this, handle);
|
1110
|
+
while (cursor != null) {
|
1111
|
+
const result = await this.#followersCallbacks.dispatcher(this, handle, cursor);
|
1112
|
+
if (result == null)
|
1113
|
+
break;
|
1114
|
+
for (const recipient of result.items)
|
1115
|
+
yield recipient;
|
1116
|
+
cursor = result.nextCursor ?? null;
|
1117
|
+
}
|
1118
|
+
}
|
1119
|
+
async getActor(handle) {
|
1120
|
+
if (this.actorCallbacks == null ||
|
1121
|
+
this.actorCallbacks.dispatcher == null) {
|
1122
|
+
throw new Error("No actor dispatcher registered.");
|
1123
|
+
}
|
1124
|
+
if (this.#invokedFromActorDispatcher != null) {
|
1125
|
+
getLogger(["fedify", "federation"]).warn("RequestContext.getActor({getActorHandle}) is invoked from " +
|
1126
|
+
"the actor dispatcher ({actorDispatcherHandle}); " +
|
1127
|
+
"this may cause an infinite loop.", {
|
1128
|
+
getActorHandle: handle,
|
1129
|
+
actorDispatcherHandle: this.#invokedFromActorDispatcher.handle,
|
1130
|
+
});
|
1131
|
+
}
|
1132
|
+
let rsaKey;
|
1133
|
+
try {
|
1134
|
+
rsaKey = await this.getRsaKeyPairFromHandle(handle);
|
1135
|
+
}
|
1136
|
+
catch (_) {
|
1137
|
+
rsaKey = null;
|
1138
|
+
}
|
1139
|
+
return await this.actorCallbacks.dispatcher(new RequestContextImpl({
|
1140
|
+
...this.#options,
|
1141
|
+
invokedFromActorDispatcher: { handle },
|
1142
|
+
}), handle, rsaKey == null ? null : new CryptographicKey({
|
1143
|
+
id: rsaKey.keyId,
|
1144
|
+
owner: this.getActorUri(handle),
|
1145
|
+
publicKey: rsaKey.publicKey,
|
1146
|
+
}));
|
1147
|
+
}
|
1148
|
+
async getObject(
|
1149
|
+
// deno-lint-ignore no-explicit-any
|
1150
|
+
cls, values) {
|
1151
|
+
const callbacks = this.objectCallbacks[cls.typeId.href];
|
1152
|
+
if (callbacks == null) {
|
1153
|
+
throw new Error("No object dispatcher registered.");
|
1154
|
+
}
|
1155
|
+
for (const param of callbacks.parameters) {
|
1156
|
+
if (!(param in values)) {
|
1157
|
+
throw new TypeError(`Missing parameter: ${param}`);
|
1158
|
+
}
|
1159
|
+
}
|
1160
|
+
if (this.#invokedFromObjectDispatcher != null) {
|
1161
|
+
getLogger(["fedify", "federation"]).warn("RequestContext.getObject({getObjectClass}, " +
|
1162
|
+
"{getObjectValues}) is invoked from the object dispatcher " +
|
1163
|
+
"({actorDispatcherClass}, {actorDispatcherValues}); " +
|
1164
|
+
"this may cause an infinite loop.", {
|
1165
|
+
getObjectClass: cls.name,
|
1166
|
+
getObjectValues: values,
|
1167
|
+
actorDispatcherClass: this.#invokedFromObjectDispatcher.cls.name,
|
1168
|
+
actorDispatcherValues: this.#invokedFromObjectDispatcher.values,
|
1169
|
+
});
|
1170
|
+
}
|
1171
|
+
return await callbacks.dispatcher(new RequestContextImpl({
|
1172
|
+
...this.#options,
|
1173
|
+
invokedFromObjectDispatcher: { cls, values },
|
1174
|
+
}), values);
|
1175
|
+
}
|
1176
|
+
#signedKey = undefined;
|
1177
|
+
async getSignedKey() {
|
1178
|
+
if (this.#signedKey !== undefined)
|
1179
|
+
return this.#signedKey;
|
1180
|
+
return this.#signedKey = await verifyRequest(this.request, {
|
1181
|
+
...this,
|
1182
|
+
timeWindow: this.#signatureTimeWindow,
|
1183
|
+
});
|
1184
|
+
}
|
1185
|
+
#signedKeyOwner = undefined;
|
1186
|
+
async getSignedKeyOwner() {
|
1187
|
+
if (this.#signedKeyOwner !== undefined)
|
1188
|
+
return this.#signedKeyOwner;
|
1189
|
+
const key = await this.getSignedKey();
|
1190
|
+
if (key == null)
|
1191
|
+
return this.#signedKeyOwner = null;
|
1192
|
+
return this.#signedKeyOwner = await getKeyOwner(key, this);
|
1193
|
+
}
|
1194
|
+
}
|
1124
1195
|
function notFound(_request) {
|
1125
1196
|
return new Response("Not Found", { status: 404 });
|
1126
1197
|
}
|
package/package.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/federation/middleware.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAM5C,OAAO,EACL,KAAK,kCAAkC,EACvC,KAAK,cAAc,EAIpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAoB,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE1E,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAEV,OAAO,E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