@fedify/fedify 0.7.0-dev.116 → 0.7.0-dev.118

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of @fedify/fedify might be problematic. Click here for more details.

package/CHANGES.md CHANGED
@@ -10,7 +10,21 @@ To be released.
10
10
 
11
11
  - Added `PUBLIC_COLLECTION` constant for [public addressing].
12
12
 
13
+ - `Federation` now supports [authorized fetch] for actor dispatcher and
14
+ collection dispatchers.
15
+
16
+ - Added `ActorCallbackSetters.authorize()` method.
17
+ - Added `CollectionCallbackSetters.authorize()` method.
18
+ - Added `AuthorizedPredicate` type.
19
+ - Added `RequestContext.getSignedKey()` method.
20
+ - Added `FederationFetchOptions.onUnauthorized` option for handling
21
+ unauthorized fetches.
22
+
23
+ - The default implementation of `FederationFetchOptions.onNotAcceptable`
24
+ option now responds with `Vary: Accept, Signature` header.
25
+
13
26
  [public addressing]: https://www.w3.org/TR/activitypub/#public-addressing
27
+ [authorized fetch]: https://swicg.github.io/activitypub-http-signature/#authorized-fetch
14
28
 
15
29
 
16
30
  Version 0.6.0
@@ -13,20 +13,22 @@ export function acceptsJsonLd(request) {
13
13
  types.includes("application/ld+json") ||
14
14
  types.includes("application/json");
15
15
  }
16
- export async function handleActor(request, { handle, context, actorDispatcher, onNotFound, onNotAcceptable, }) {
16
+ export async function handleActor(request, { handle, context, actorDispatcher, authorizePredicate, onNotFound, onNotAcceptable, onUnauthorized, }) {
17
17
  if (actorDispatcher == null) {
18
18
  const response = onNotFound(request);
19
19
  return response instanceof Promise ? await response : response;
20
20
  }
21
21
  const key = await context.getActorKey(handle);
22
22
  const actor = await actorDispatcher(context, handle, key);
23
- if (actor == null) {
24
- const response = onNotFound(request);
25
- return response instanceof Promise ? await response : response;
26
- }
27
- if (!acceptsJsonLd(request)) {
28
- const response = onNotAcceptable(request);
29
- return response instanceof Promise ? await response : response;
23
+ if (actor == null)
24
+ return await onNotFound(request);
25
+ if (!acceptsJsonLd(request))
26
+ return await onNotAcceptable(request);
27
+ if (authorizePredicate != null) {
28
+ const key = await context.getSignedKey();
29
+ if (!await authorizePredicate(context, handle, key)) {
30
+ return await onUnauthorized(request);
31
+ }
30
32
  }
31
33
  const jsonLd = await actor.toJsonLd(context);
32
34
  return new Response(JSON.stringify(jsonLd), {
@@ -36,32 +38,19 @@ export async function handleActor(request, { handle, context, actorDispatcher, o
36
38
  },
37
39
  });
38
40
  }
39
- export async function handleCollection(request, { handle, context, collectionCallbacks, onNotFound, onNotAcceptable, }) {
40
- if (collectionCallbacks == null) {
41
- const response = onNotFound(request);
42
- return response instanceof Promise ? await response : response;
43
- }
41
+ export async function handleCollection(request, { handle, context, collectionCallbacks, onUnauthorized, onNotFound, onNotAcceptable, }) {
42
+ if (collectionCallbacks == null)
43
+ return await onNotFound(request);
44
44
  const url = new URL(request.url);
45
45
  const cursor = url.searchParams.get("cursor");
46
46
  let collection;
47
47
  if (cursor == null) {
48
- const firstCursorPromise = collectionCallbacks.firstCursor?.(context, handle);
49
- const firstCursor = firstCursorPromise instanceof Promise
50
- ? await firstCursorPromise
51
- : firstCursorPromise;
52
- const totalItemsPromise = collectionCallbacks.counter?.(context, handle);
53
- const totalItems = totalItemsPromise instanceof Promise
54
- ? await totalItemsPromise
55
- : totalItemsPromise;
48
+ const firstCursor = await collectionCallbacks.firstCursor?.(context, handle);
49
+ const totalItems = await collectionCallbacks.counter?.(context, handle);
56
50
  if (firstCursor == null) {
57
- const pagePromise = collectionCallbacks.dispatcher(context, handle, null);
58
- const page = pagePromise instanceof Promise
59
- ? await pagePromise
60
- : pagePromise;
61
- if (page == null) {
62
- const response = onNotFound(request);
63
- return response instanceof Promise ? await response : response;
64
- }
51
+ const page = await collectionCallbacks.dispatcher(context, handle, null);
52
+ if (page == null)
53
+ return await onNotFound(request);
65
54
  const { items } = page;
66
55
  collection = new OrderedCollection({
67
56
  totalItems: totalItems == null ? null : Number(totalItems),
@@ -69,10 +58,7 @@ export async function handleCollection(request, { handle, context, collectionCal
69
58
  });
70
59
  }
71
60
  else {
72
- const lastCursorPromise = collectionCallbacks.lastCursor?.(context, handle);
73
- const lastCursor = lastCursorPromise instanceof Promise
74
- ? await lastCursorPromise
75
- : lastCursorPromise;
61
+ const lastCursor = await collectionCallbacks.lastCursor?.(context, handle);
76
62
  const first = new URL(context.url);
77
63
  first.searchParams.set("cursor", firstCursor);
78
64
  let last = null;
@@ -88,14 +74,9 @@ export async function handleCollection(request, { handle, context, collectionCal
88
74
  }
89
75
  }
90
76
  else {
91
- const pagePromise = collectionCallbacks.dispatcher(context, handle, cursor);
92
- const page = pagePromise instanceof Promise
93
- ? await pagePromise
94
- : pagePromise;
95
- if (page == null) {
96
- const response = onNotFound(request);
97
- return response instanceof Promise ? await response : response;
98
- }
77
+ const page = await collectionCallbacks.dispatcher(context, handle, cursor);
78
+ if (page == null)
79
+ return await onNotFound(request);
99
80
  const { items, prevCursor, nextCursor } = page;
100
81
  let prev = null;
101
82
  if (prevCursor != null) {
@@ -111,9 +92,13 @@ export async function handleCollection(request, { handle, context, collectionCal
111
92
  partOf.searchParams.delete("cursor");
112
93
  collection = new OrderedCollectionPage({ prev, next, items, partOf });
113
94
  }
114
- if (!acceptsJsonLd(request)) {
115
- const response = onNotAcceptable(request);
116
- return response instanceof Promise ? await response : response;
95
+ if (!acceptsJsonLd(request))
96
+ return await onNotAcceptable(request);
97
+ if (collectionCallbacks.authorizePredicate != null) {
98
+ const key = await context.getSignedKey();
99
+ if (!await collectionCallbacks.authorizePredicate(context, handle, key)) {
100
+ return await onUnauthorized(request);
101
+ }
117
102
  }
118
103
  const jsonLd = await collection.toJsonLd(context);
119
104
  return new Response(JSON.stringify(jsonLd), {
@@ -1,6 +1,7 @@
1
1
  import * as dntShim from "../_dnt.shims.js";
2
2
  import { Temporal } from "@js-temporal/polyfill";
3
3
  import { exportJwk, importJwk, validateCryptoKey } from "../httpsig/key.js";
4
+ import { verify } from "../httpsig/mod.js";
4
5
  import { handleNodeInfo, handleNodeInfoJrd } from "../nodeinfo/handler.js";
5
6
  import { fetchDocumentLoader, getAuthenticatedDocumentLoader, kvCache, } from "../runtime/docloader.js";
6
7
  import { Activity, CryptographicKey } from "../vocab/mod.js";
@@ -218,10 +219,16 @@ export class Federation {
218
219
  };
219
220
  if (request == null)
220
221
  return context;
222
+ let signedKey = undefined;
221
223
  const reqCtx = {
222
224
  ...context,
223
225
  request,
224
226
  url,
227
+ async getSignedKey() {
228
+ if (signedKey !== undefined)
229
+ return signedKey;
230
+ return signedKey = await verify(request, context.documentLoader);
231
+ },
225
232
  };
226
233
  return reqCtx;
227
234
  }
@@ -281,10 +288,14 @@ export class Federation {
281
288
  const callbacks = { dispatcher };
282
289
  this.#actorCallbacks = callbacks;
283
290
  const setters = {
284
- setKeyPairDispatcher: (dispatcher) => {
291
+ setKeyPairDispatcher(dispatcher) {
285
292
  callbacks.keyPairDispatcher = dispatcher;
286
293
  return setters;
287
294
  },
295
+ authorize(predicate) {
296
+ callbacks.authorizePredicate = predicate;
297
+ return setters;
298
+ },
288
299
  };
289
300
  return setters;
290
301
  }
@@ -336,6 +347,10 @@ export class Federation {
336
347
  callbacks.lastCursor = cursor;
337
348
  return setters;
338
349
  },
350
+ authorize(predicate) {
351
+ callbacks.authorizePredicate = predicate;
352
+ return setters;
353
+ },
339
354
  };
340
355
  return setters;
341
356
  }
@@ -375,6 +390,10 @@ export class Federation {
375
390
  callbacks.lastCursor = cursor;
376
391
  return setters;
377
392
  },
393
+ authorize(predicate) {
394
+ callbacks.authorizePredicate = predicate;
395
+ return setters;
396
+ },
378
397
  };
379
398
  return setters;
380
399
  }
@@ -414,6 +433,10 @@ export class Federation {
414
433
  callbacks.lastCursor = cursor;
415
434
  return setters;
416
435
  },
436
+ authorize(predicate) {
437
+ callbacks.authorizePredicate = predicate;
438
+ return setters;
439
+ },
417
440
  };
418
441
  return setters;
419
442
  }
@@ -558,9 +581,10 @@ export class Federation {
558
581
  * @returns The response to the request.
559
582
  * @since 0.6.0
560
583
  */
561
- async fetch(request, { onNotFound, onNotAcceptable, contextData, }) {
584
+ async fetch(request, { onNotFound, onNotAcceptable, onUnauthorized, contextData, }) {
562
585
  onNotFound ??= notFound;
563
586
  onNotAcceptable ??= notAcceptable;
587
+ onUnauthorized ??= unauthorized;
564
588
  const url = new URL(request.url);
565
589
  const route = this.#router.route(url.pathname);
566
590
  if (route == null) {
@@ -587,6 +611,8 @@ export class Federation {
587
611
  handle: route.values.handle,
588
612
  context,
589
613
  actorDispatcher: this.#actorCallbacks?.dispatcher,
614
+ authorizePredicate: this.#actorCallbacks?.authorizePredicate,
615
+ onUnauthorized,
590
616
  onNotFound,
591
617
  onNotAcceptable,
592
618
  });
@@ -595,6 +621,7 @@ export class Federation {
595
621
  handle: route.values.handle,
596
622
  context,
597
623
  collectionCallbacks: this.#outboxCallbacks,
624
+ onUnauthorized,
598
625
  onNotFound,
599
626
  onNotAcceptable,
600
627
  });
@@ -622,6 +649,7 @@ export class Federation {
622
649
  handle: route.values.handle,
623
650
  context,
624
651
  collectionCallbacks: this.#followingCallbacks,
652
+ onUnauthorized,
625
653
  onNotFound,
626
654
  onNotAcceptable,
627
655
  });
@@ -630,6 +658,7 @@ export class Federation {
630
658
  handle: route.values.handle,
631
659
  context,
632
660
  collectionCallbacks: this.#followersCallbacks,
661
+ onUnauthorized,
633
662
  onNotFound,
634
663
  onNotAcceptable,
635
664
  });
@@ -644,5 +673,18 @@ function notFound(_request) {
644
673
  return new Response("Not Found", { status: 404 });
645
674
  }
646
675
  function notAcceptable(_request) {
647
- return new Response("Not Acceptable", { status: 406 });
676
+ return new Response("Not Acceptable", {
677
+ status: 406,
678
+ headers: {
679
+ Vary: "Accept, Signature",
680
+ },
681
+ });
682
+ }
683
+ function unauthorized(_request) {
684
+ return new Response("Unauthorized", {
685
+ status: 401,
686
+ headers: {
687
+ Vary: "Accept, Signature",
688
+ },
689
+ });
648
690
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/fedify",
3
- "version": "0.7.0-dev.116+6ef7c7a4",
3
+ "version": "0.7.0-dev.118+e78b836d",
4
4
  "description": "An ActivityPub server framework",
5
5
  "keywords": [
6
6
  "ActivityPub",
@@ -62,4 +62,16 @@ export type InboxErrorHandler<TContextData> = (context: RequestContext<TContextD
62
62
  * @since 0.6.0
63
63
  */
64
64
  export type OutboxErrorHandler = (error: Error, activity: Activity | null) => void | Promise<void>;
65
+ /**
66
+ * A callback that determines if a request is authorized or not.
67
+ *
68
+ * @typeParam TContextData The context data to pass to the {@link Context}.
69
+ * @param context The request context.
70
+ * @param handle The handle of the actor that is being requested.
71
+ * @param signedKey The key that was used to sign the request, or `null` if
72
+ * the request was not signed or the signature was invalid.
73
+ * @returns `true` if the request is authorized, `false` otherwise.
74
+ * @since 0.7.0
75
+ */
76
+ export type AuthorizePredicate<TContextData> = (context: RequestContext<TContextData>, handle: string, signedKey: CryptographicKey | null) => boolean | Promise<boolean>;
65
77
  //# sourceMappingURL=callback.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"callback.d.ts","sourceRoot":"","sources":["../../src/federation/callback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,CAAC,YAAY,IAAI,CAC7C,OAAO,EAAE,cAAc,CAAC,YAAY,CAAC,KAClC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAElC;;;;GAIG;AACH,MAAM,MAAM,eAAe,CAAC,YAAY,IAAI,CAC1C,OAAO,E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1B;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAC/B,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,GAAG,IAAI,KACtB,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1B;;;;;;;;;;GAUG;AACH,MAAM,MAAM,kBAAkB,CAAC,YAAY,IAAI,CAC7C,OAAO,EAAE,cAAc,CAAC,YAAY,CAAC,EACrC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,gBAAgB,GAAG,IAAI,KAC/B,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC"}
@@ -131,6 +131,19 @@ export interface RequestContext<TContextData> extends Context<TContextData> {
131
131
  * The URL of the request.
132
132
  */
133
133
  readonly url: URL;
134
+ /**
135
+ * Gets the public key of the sender, if any exists and it is verified.
136
+ * Otherwise, `null` is returned.
137
+ *
138
+ * This can be used for implementing [authorized fetch] (also known as
139
+ * secure mode) in ActivityPub.
140
+ *
141
+ * [authorized fetch]: https://swicg.github.io/activitypub-http-signature/#authorized-fetch
142
+ *
143
+ * @returns The public key of the sender, or `null` if the sender is not verified.
144
+ * @since 0.7.0
145
+ */
146
+ getSignedKey(): Promise<CryptographicKey | null>;
134
147
  }
135
148
  /**
136
149
  * Options for {@link Context.sendActivity} method and
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/federation/context.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,OAAO,CAAC,YAAY;IACnC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IA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B;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB"}
@@ -2,7 +2,7 @@
2
2
  /// <reference types="node" />
3
3
  import type { DocumentLoader } from "../runtime/docloader.js";
4
4
  import { Activity, type Link, type Object } from "../vocab/vocab.js";
5
- import type { ActorDispatcher, CollectionCounter, CollectionCursor, CollectionDispatcher, InboxErrorHandler, InboxListener } from "./callback.js";
5
+ import type { ActorDispatcher, AuthorizePredicate, CollectionCounter, CollectionCursor, CollectionDispatcher, InboxErrorHandler, InboxListener } from "./callback.js";
6
6
  import type { RequestContext } from "./context.js";
7
7
  import type { KvKey, KvStore } from "./kv.js";
8
8
  export declare function acceptsJsonLd(request: Request): boolean;
@@ -10,10 +10,12 @@ export interface ActorHandlerParameters<TContextData> {
10
10
  handle: string;
11
11
  context: RequestContext<TContextData>;
12
12
  actorDispatcher?: ActorDispatcher<TContextData>;
13
+ authorizePredicate?: AuthorizePredicate<TContextData>;
14
+ onUnauthorized(request: Request): Response | Promise<Response>;
13
15
  onNotFound(request: Request): Response | Promise<Response>;
14
16
  onNotAcceptable(request: Request): Response | Promise<Response>;
15
17
  }
16
- export declare function handleActor<TContextData>(request: Request, { handle, context, actorDispatcher, onNotFound, onNotAcceptable, }: ActorHandlerParameters<TContextData>): Promise<Response>;
18
+ export declare function handleActor<TContextData>(request: Request, { handle, context, actorDispatcher, authorizePredicate, onNotFound, onNotAcceptable, onUnauthorized, }: ActorHandlerParameters<TContextData>): Promise<Response>;
17
19
  /**
18
20
  * Callbacks for handling a collection.
19
21
  */
@@ -34,15 +36,20 @@ export interface CollectionCallbacks<TItem, TContextData> {
34
36
  * A callback that returns the last cursor for a collection.
35
37
  */
36
38
  lastCursor?: CollectionCursor<TContextData>;
39
+ /**
40
+ * A callback that determines if a request is authorized to access the collection.
41
+ */
42
+ authorizePredicate?: AuthorizePredicate<TContextData>;
37
43
  }
38
44
  export interface CollectionHandlerParameters<TItem, TContextData> {
39
45
  handle: string;
40
46
  context: RequestContext<TContextData>;
41
47
  collectionCallbacks?: CollectionCallbacks<TItem, TContextData>;
48
+ onUnauthorized(request: Request): Response | Promise<Response>;
42
49
  onNotFound(request: Request): Response | Promise<Response>;
43
50
  onNotAcceptable(request: Request): Response | Promise<Response>;
44
51
  }
45
- export declare function handleCollection<TItem extends URL | Object | Link, TContextData>(request: Request, { handle, context, collectionCallbacks, onNotFound, onNotAcceptable, }: CollectionHandlerParameters<TItem, TContextData>): Promise<Response>;
52
+ export declare function handleCollection<TItem extends URL | Object | Link, TContextData>(request: Request, { handle, context, collectionCallbacks, onUnauthorized, onNotFound, onNotAcceptable, }: CollectionHandlerParameters<TItem, TContextData>): Promise<Response>;
46
53
  export interface InboxHandlerParameters<TContextData> {
47
54
  handle: string | null;
48
55
  context: RequestContext<TContextData>;
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/federation/handler.ts"],"names":[],"mappings":";;AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EACL,QAAQ,EACR,KAAK,IAAI,EACT,KAAK,MAAM,EAGZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACd,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAE9C,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CASvD;AAED,MAAM,WAAW,sBAAsB,CAAC,YAAY;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC;IACtC,eAAe,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC;IAChD,UAAU,CAAC,OAAO,EAAE,OAAO,GA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C,YAAY;IAClD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC;IACtC,EAAE,EAAE,OAAO,CAAC;IACZ,QAAQ,EAAE,KAAK,CAAC;IAChB,eAAe,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC;IAChD,cAAc,EAAE,GAAG,CACjB,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,QAAQ,EACpC,aAAa,CAAC,YAAY,EAAE,QAAQ,CAAC,CACtC,CAAC;IACF,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC;IACpD,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC5D;AAED,wBAAsB,WAAW,CAAC,YAAY,EAC5C,OAAO,EAAE,OAAO,EAChB,EACE,MAAM,EACN,OAAO,EACP,EAAE,EACF,QAAQ,EACR,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,UAAU,GACX,EAAE,sBAAsB,CAAC,YAAY,CAAC,GACtC,OAAO,CAAC,QAAQ,CAAC,CAyGnB;AAED;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,cAAc,EAAE,cAAc,CAAC;CAChC;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,QAAQ,CAAC,CAOnB;AAED;;;;;;;;GAQG;AACH,wBAAsB,6BAA6B,CACjD,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAK1B"}
@@ -5,7 +5,7 @@ import { Temporal } from "@js-temporal/polyfill";
5
5
  import { type AuthenticatedDocumentLoaderFactory, type DocumentLoader } from "../runtime/docloader.js";
6
6
  import type { Actor } from "../vocab/actor.js";
7
7
  import { Activity } from "../vocab/mod.js";
8
- import type { ActorDispatcher, ActorKeyPairDispatcher, CollectionCounter, CollectionCursor, CollectionDispatcher, InboxErrorHandler, InboxListener, NodeInfoDispatcher, OutboxErrorHandler } from "./callback.js";
8
+ import type { ActorDispatcher, ActorKeyPairDispatcher, AuthorizePredicate, CollectionCounter, CollectionCursor, CollectionDispatcher, InboxErrorHandler, InboxListener, NodeInfoDispatcher, OutboxErrorHandler } from "./callback.js";
9
9
  import type { Context, RequestContext, SendActivityOptions } from "./context.js";
10
10
  import type { KvKey, KvStore } from "./kv.js";
11
11
  import type { MessageQueue } from "./mq.js";
@@ -258,7 +258,7 @@ export declare class Federation<TContextData> {
258
258
  * @returns The response to the request.
259
259
  * @since 0.6.0
260
260
  */
261
- fetch(request: Request, { onNotFound, onNotAcceptable, contextData, }: FederationFetchOptions<TContextData>): Promise<Response>;
261
+ fetch(request: Request, { onNotFound, onNotAcceptable, onUnauthorized, contextData, }: FederationFetchOptions<TContextData>): Promise<Response>;
262
262
  }
263
263
  /**
264
264
  * Parameters of {@link Federation.fetch} method.
@@ -285,6 +285,14 @@ export interface FederationFetchOptions<TContextData> {
285
285
  * @returns The response to the request.
286
286
  */
287
287
  onNotAcceptable?: (request: Request) => Response | Promise<Response>;
288
+ /**
289
+ * A callback to handle a request when the request is unauthorized.
290
+ * If not provided, a 401 response is returned.
291
+ * @param request The request object.
292
+ * @returns The response to the request.
293
+ * @since 0.7.0
294
+ */
295
+ onUnauthorized?: (request: Request) => Response | Promise<Response>;
288
296
  }
289
297
  /**
290
298
  * Additional settings for the actor dispatcher.
@@ -306,14 +314,43 @@ export interface ActorCallbackSetters<TContextData> {
306
314
  * @returns The setters object so that settings can be chained.
307
315
  */
308
316
  setKeyPairDispatcher(dispatcher: ActorKeyPairDispatcher<TContextData>): ActorCallbackSetters<TContextData>;
317
+ /**
318
+ * Specifies the conditions under which requests are authorized.
319
+ * @param predicate A callback that returns whether a request is authorized.
320
+ * @returns The setters object so that settings can be chained.
321
+ * @since 0.7.0
322
+ */
323
+ authorize(predicate: AuthorizePredicate<TContextData>): ActorCallbackSetters<TContextData>;
309
324
  }
310
325
  /**
311
326
  * Additional settings for a collection dispatcher.
312
327
  */
313
328
  export interface CollectionCallbackSetters<TContextData> {
329
+ /**
330
+ * Sets the counter for the collection.
331
+ * @param counter A callback that returns the number of items in the collection.
332
+ * @returns The setters object so that settings can be chained.
333
+ */
314
334
  setCounter(counter: CollectionCounter<TContextData>): CollectionCallbackSetters<TContextData>;
335
+ /**
336
+ * Sets the first cursor for the collection.
337
+ * @param cursor The cursor for the first item in the collection.
338
+ * @returns The setters object so that settings can be chained.
339
+ */
315
340
  setFirstCursor(cursor: CollectionCursor<TContextData>): CollectionCallbackSetters<TContextData>;
341
+ /**
342
+ * Sets the last cursor for the collection.
343
+ * @param cursor The cursor for the last item in the collection.
344
+ * @returns The setters object so that settings can be chained.
345
+ */
316
346
  setLastCursor(cursor: CollectionCursor<TContextData>): CollectionCallbackSetters<TContextData>;
347
+ /**
348
+ * Specifies the conditions under which requests are authorized.
349
+ * @param predicate A callback that returns whether a request is authorized.
350
+ * @returns The setters object so that settings can be chained.
351
+ * @since 0.7.0
352
+ */
353
+ authorize(predicate: AuthorizePredicate<TContextData>): CollectionCallbackSetters<TContextData>;
317
354
  }
318
355
  /**
319
356
  * Registry for inbox listeners for different activity types.
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/federation/middleware.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD,OAAO,EACL,KAAK,kCAAkC,EACvC,KAAK,cAAc,EAIpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAoB,MA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kB,CAAC,YAAY,CAAC,GAC1C,yBAAyB,CAAC,YAAY,CAAC,CAAC;CAC5C;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB,CAAC,YAAY;IAC/C;;;;;;OAMG;IACH,EAAE,CAAC,SAAS,SAAS,QAAQ,EAE3B,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,SAAS,EACvC,QAAQ,EAAE,aAAa,CAAC,YAAY,EAAE,SAAS,CAAC,GAC/C,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAErC;;;;;;OAMG;IACH,OAAO,CACL,OAAO,EAAE,iBAAiB,CAAC,YAAY,CAAC,GACvC,mBAAmB,CAAC,YAAY,CAAC,CAAC;CACtC"}
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/testing/context.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAIxE,wBAAgB,aAAa,CAAC,YAAY,EACxC,EACE,IAAI,EACJ,cAAc,EACd,cAAc,EACd,WAAW,EACX,YAAY,EACZ,WAAW,EACX,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,YAAY,GACb,EAAE,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,GAAG;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,GACzD,OAAO,CAAC,YAAY,CAAC,CA0BvB;AAED,wBAAgB,oBAAoB,CAAC,YAAY,EAC/C,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,GAAG;IAC5C,GAAG,EAAE,GAAG,CAAC;IACT,IAAI,EAAE,YAAY,CAAC;CACpB,GACA,cAAc,CAAC,YAAY,CAAC,CAM9B"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/testing/context.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,c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