@oxy.so/federation 2.13.0 → 2.15.0

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.
@@ -7,8 +7,8 @@
7
7
  * because those are identical across every Oxy app: they bridge a federated follow
8
8
  * edge into the Oxy graph (via the identity adapter), record the AP-side follow
9
9
  * row (via the store adapter), and send the Accept back (via the delivery
10
- * service). Every CONTENT verb (Create / Announce / Like / Delete / Update, and a
11
- * non-follow Undo) is handed to the app-registered
10
+ * service). Every CONTENT verb (Create / Announce / Like / Delete / Update /
11
+ * Add / Remove, and a non-follow Undo) is handed to the app-registered
12
12
  * {@link InboundDispatcherConfig.onContentActivity} callback, where the app's own
13
13
  * post/engagement handlers live. The consent gate + notification side effects are
14
14
  * injected so the engine holds no app knowledge.
@@ -299,12 +299,15 @@ function createInboundDispatcher(config) {
299
299
  case 'Reject':
300
300
  await handleReject(activity, verifiedActorUri);
301
301
  break;
302
- // Content verbs — the app owns these (posts, engagement, actor profile edits).
302
+ // Content verbs — the app owns these (posts, engagement, actor profile
303
+ // edits, and collection changes such as pinned posts).
303
304
  case 'Create':
304
305
  case 'Delete':
305
306
  case 'Like':
306
307
  case 'Announce':
307
308
  case 'Update':
309
+ case 'Add':
310
+ case 'Remove':
308
311
  await config.onContentActivity(activity, verifiedActorUri);
309
312
  break;
310
313
  case 'Move': {
@@ -54,7 +54,7 @@ Object.defineProperty(exports, "DeliveryAuthorizationDeniedError", { enumerable:
54
54
  * Inbound ActivityPub dispatch — the untrusted-activity validator + switch, the
55
55
  * follow-protocol handlers (Follow / Accept / Undo(Follow) / Reject) over the
56
56
  * identity + store adapters, and the `onContentActivity` seam every content verb
57
- * (Create / Announce / Like / Delete / Update, non-follow Undo) is handed to.
57
+ * (Create / Announce / Like / Delete / Update / Add / Remove, non-follow Undo) is handed to.
58
58
  */
59
59
  var inboundDispatch_1 = require("./inboundDispatch");
60
60
  Object.defineProperty(exports, "createInboundDispatcher", { enumerable: true, get: function () { return inboundDispatch_1.createInboundDispatcher; } });
@@ -57,14 +57,16 @@ function requestInitHeaders(init) {
57
57
  * `init.redirect === 'manual'`, the redirect `Response` is returned directly so
58
58
  * the caller can apply its own stricter redirect policy.
59
59
  *
60
- * Signed for servers that enforce authorized fetch (e.g. Threads). On a 5xx the
61
- * request is retried unsigned (same SSRF-safe path) as a fallback for public
62
- * resources.
60
+ * Signed for servers that enforce authorized fetch (e.g. Threads). An
61
+ * instance-signed request that gets a 5xx is retried unsigned (same SSRF-safe
62
+ * path) as a fallback for public resources. `init.keyId` signs as another actor
63
+ * (see {@link SignedFetchInit.keyId}); such a request is never retried unsigned.
63
64
  */
64
65
  function createSignedFetch(config) {
65
66
  return async function signedFetch(url, accept, init = {}) {
66
67
  const acceptHeader = `${accept}, application/ld+json; profile="https://www.w3.org/ns/activitystreams"`;
67
- const keyId = await config.getInstanceKeyId();
68
+ const actorSigned = init.keyId !== undefined;
69
+ const keyId = init.keyId ?? (await config.getInstanceKeyId());
68
70
  const extraHeaders = requestInitHeaders(init);
69
71
  const manualRedirect = init.redirect === 'manual';
70
72
  const fetchOnce = async (targetUrl, signed) => {
@@ -100,6 +102,10 @@ function createSignedFetch(config) {
100
102
  throw new Error('redirect loop exhausted');
101
103
  };
102
104
  const { res, finalUrl } = await fetchFollowingRedirects(url, true);
105
+ // An actor-signed answer is the remote's verdict for THAT actor (a follower or
106
+ // recipient): an unsigned retry asks a different question, so it never runs.
107
+ if (actorSigned)
108
+ return res;
103
109
  // If the remote server returns a 5xx (e.g. it can't resolve our keyId to
104
110
  // verify the signature), retry without the signature as a fallback for public
105
111
  // resources. Retry from the post-redirect URL so we don't restart a chain that
@@ -6,8 +6,8 @@
6
6
  * because those are identical across every Oxy app: they bridge a federated follow
7
7
  * edge into the Oxy graph (via the identity adapter), record the AP-side follow
8
8
  * row (via the store adapter), and send the Accept back (via the delivery
9
- * service). Every CONTENT verb (Create / Announce / Like / Delete / Update, and a
10
- * non-follow Undo) is handed to the app-registered
9
+ * service). Every CONTENT verb (Create / Announce / Like / Delete / Update /
10
+ * Add / Remove, and a non-follow Undo) is handed to the app-registered
11
11
  * {@link InboundDispatcherConfig.onContentActivity} callback, where the app's own
12
12
  * post/engagement handlers live. The consent gate + notification side effects are
13
13
  * injected so the engine holds no app knowledge.
@@ -294,12 +294,15 @@ export function createInboundDispatcher(config) {
294
294
  case 'Reject':
295
295
  await handleReject(activity, verifiedActorUri);
296
296
  break;
297
- // Content verbs — the app owns these (posts, engagement, actor profile edits).
297
+ // Content verbs — the app owns these (posts, engagement, actor profile
298
+ // edits, and collection changes such as pinned posts).
298
299
  case 'Create':
299
300
  case 'Delete':
300
301
  case 'Like':
301
302
  case 'Announce':
302
303
  case 'Update':
304
+ case 'Add':
305
+ case 'Remove':
303
306
  await config.onContentActivity(activity, verifiedActorUri);
304
307
  break;
305
308
  case 'Move': {
@@ -44,7 +44,7 @@ export { createDeliveryService, DeliveryAuthorizationDeniedError, } from './deli
44
44
  * Inbound ActivityPub dispatch — the untrusted-activity validator + switch, the
45
45
  * follow-protocol handlers (Follow / Accept / Undo(Follow) / Reject) over the
46
46
  * identity + store adapters, and the `onContentActivity` seam every content verb
47
- * (Create / Announce / Like / Delete / Update, non-follow Undo) is handed to.
47
+ * (Create / Announce / Like / Delete / Update / Add / Remove, non-follow Undo) is handed to.
48
48
  */
49
49
  export { createInboundDispatcher, ActorResolutionPendingError, } from './inboundDispatch.js';
50
50
  /** The WebFinger + host-meta discovery router (domain-parameterized, consent-gated). */
@@ -54,14 +54,16 @@ function requestInitHeaders(init) {
54
54
  * `init.redirect === 'manual'`, the redirect `Response` is returned directly so
55
55
  * the caller can apply its own stricter redirect policy.
56
56
  *
57
- * Signed for servers that enforce authorized fetch (e.g. Threads). On a 5xx the
58
- * request is retried unsigned (same SSRF-safe path) as a fallback for public
59
- * resources.
57
+ * Signed for servers that enforce authorized fetch (e.g. Threads). An
58
+ * instance-signed request that gets a 5xx is retried unsigned (same SSRF-safe
59
+ * path) as a fallback for public resources. `init.keyId` signs as another actor
60
+ * (see {@link SignedFetchInit.keyId}); such a request is never retried unsigned.
60
61
  */
61
62
  export function createSignedFetch(config) {
62
63
  return async function signedFetch(url, accept, init = {}) {
63
64
  const acceptHeader = `${accept}, application/ld+json; profile="https://www.w3.org/ns/activitystreams"`;
64
- const keyId = await config.getInstanceKeyId();
65
+ const actorSigned = init.keyId !== undefined;
66
+ const keyId = init.keyId ?? (await config.getInstanceKeyId());
65
67
  const extraHeaders = requestInitHeaders(init);
66
68
  const manualRedirect = init.redirect === 'manual';
67
69
  const fetchOnce = async (targetUrl, signed) => {
@@ -97,6 +99,10 @@ export function createSignedFetch(config) {
97
99
  throw new Error('redirect loop exhausted');
98
100
  };
99
101
  const { res, finalUrl } = await fetchFollowingRedirects(url, true);
102
+ // An actor-signed answer is the remote's verdict for THAT actor (a follower or
103
+ // recipient): an unsigned retry asks a different question, so it never runs.
104
+ if (actorSigned)
105
+ return res;
100
106
  // If the remote server returns a 5xx (e.g. it can't resolve our keyId to
101
107
  // verify the signature), retry without the signature as a fallback for public
102
108
  // resources. Retry from the post-redirect URL so we don't restart a chain that
@@ -6,8 +6,8 @@
6
6
  * because those are identical across every Oxy app: they bridge a federated follow
7
7
  * edge into the Oxy graph (via the identity adapter), record the AP-side follow
8
8
  * row (via the store adapter), and send the Accept back (via the delivery
9
- * service). Every CONTENT verb (Create / Announce / Like / Delete / Update, and a
10
- * non-follow Undo) is handed to the app-registered
9
+ * service). Every CONTENT verb (Create / Announce / Like / Delete / Update /
10
+ * Add / Remove, and a non-follow Undo) is handed to the app-registered
11
11
  * {@link InboundDispatcherConfig.onContentActivity} callback, where the app's own
12
12
  * post/engagement handlers live. The consent gate + notification side effects are
13
13
  * injected so the engine holds no app knowledge.
@@ -157,7 +157,9 @@ export interface InboundDispatcherConfig {
157
157
  onOutboundFollowAccepted?(actorUri: string): Promise<void>;
158
158
  /**
159
159
  * Handle a CONTENT activity the engine does not own — Create / Announce / Like /
160
- * Delete / Update, and a non-follow Undo. The app's post/engagement handlers.
160
+ * Delete / Update / Add / Remove, and a non-follow Undo. The app's
161
+ * post/engagement handlers; `Add`/`Remove` carry collection changes such as a
162
+ * Mastodon pin (the status added to or removed from the actor's `featured`).
161
163
  */
162
164
  onContentActivity(activity: Record<string, unknown>, verifiedActorUri: string): Promise<void>;
163
165
  /**
@@ -16,7 +16,7 @@
16
16
  * Undo(Follow)/Reject, delegating content verbs to the app), and the webfinger +
17
17
  * actor + inbox + follow-graph Express routers.
18
18
  */
19
- export { createSignedFetch, type SignedFetch, type CreateSignedFetchConfig, type SingleHopFetch, type SingleHopFetchInit, type SignedFetchLogger, } from './signedFetch';
19
+ export { createSignedFetch, type SignedFetch, type SignedFetchInit, type CreateSignedFetchConfig, type SingleHopFetch, type SingleHopFetchInit, type SignedFetchLogger, } from './signedFetch';
20
20
  /**
21
21
  * X's `t.co` wrapper unwrapped into the link the author posted, over the same
22
22
  * injected single-hop transport — for bridged X bios and posts.
@@ -44,7 +44,7 @@ export { createDeliveryService, DeliveryAuthorizationDeniedError, type DeliveryA
44
44
  * Inbound ActivityPub dispatch — the untrusted-activity validator + switch, the
45
45
  * follow-protocol handlers (Follow / Accept / Undo(Follow) / Reject) over the
46
46
  * identity + store adapters, and the `onContentActivity` seam every content verb
47
- * (Create / Announce / Like / Delete / Update, non-follow Undo) is handed to.
47
+ * (Create / Announce / Like / Delete / Update / Add / Remove, non-follow Undo) is handed to.
48
48
  */
49
49
  export { createInboundDispatcher, ActorResolutionPendingError, type InboundMove, type InboundDispatcher, type InboundDispatcherConfig, type InboundDispatcherLogger, type InboundActivityValidation, type InboundLocalUser, type InboundIdentity, type InboundConsent, type InboundActorResolver, type InboundFollowStore, type InboundDelivery, } from './inboundDispatch';
50
50
  /** The WebFinger + host-meta discovery router (domain-parameterized, consent-gated). */
@@ -52,8 +52,21 @@ export interface CreateSignedFetchConfig {
52
52
  /** Optional diagnostics sink (5xx unsigned retry, 401/403 rejection). */
53
53
  logger?: SignedFetchLogger;
54
54
  }
55
+ /** Request options for one {@link SignedFetch} call. */
56
+ export interface SignedFetchInit extends RequestInit {
57
+ /**
58
+ * Sign this request (and every re-signed redirect hop) with this actor key
59
+ * instead of the instance actor's — e.g. a local user's `…#main-key`, so a
60
+ * server that gates a followers-only or direct object on the requesting actor
61
+ * serves it to a follower or recipient. The signer must hold that key.
62
+ *
63
+ * An actor-signed request is never retried unsigned: its answer is the remote's
64
+ * verdict for that actor, so the response is returned as-is on any status.
65
+ */
66
+ keyId?: string;
67
+ }
55
68
  /** A signed ActivityPub GET, returning the standard WHATWG {@link Response}. */
56
- export type SignedFetch = (url: string, accept: string, init?: RequestInit) => Promise<Response>;
69
+ export type SignedFetch = (url: string, accept: string, init?: SignedFetchInit) => Promise<Response>;
57
70
  /**
58
71
  * Build a `signedFetch(url, accept, init?)`:
59
72
  *
@@ -67,8 +80,9 @@ export type SignedFetch = (url: string, accept: string, init?: RequestInit) => P
67
80
  * `init.redirect === 'manual'`, the redirect `Response` is returned directly so
68
81
  * the caller can apply its own stricter redirect policy.
69
82
  *
70
- * Signed for servers that enforce authorized fetch (e.g. Threads). On a 5xx the
71
- * request is retried unsigned (same SSRF-safe path) as a fallback for public
72
- * resources.
83
+ * Signed for servers that enforce authorized fetch (e.g. Threads). An
84
+ * instance-signed request that gets a 5xx is retried unsigned (same SSRF-safe
85
+ * path) as a fallback for public resources. `init.keyId` signs as another actor
86
+ * (see {@link SignedFetchInit.keyId}); such a request is never retried unsigned.
73
87
  */
74
88
  export declare function createSignedFetch(config: CreateSignedFetchConfig): SignedFetch;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxy.so/federation",
3
- "version": "2.13.0",
3
+ "version": "2.15.0",
4
4
  "description": "Oxy Federation — the app-agnostic ActivityPub identity + follow engine substrate: the network-connector contract, normalized cross-network DTOs, HTTP signatures, actor resolution, the outbound delivery transport + follow lifecycle, the inbound dispatcher, and the webfinger/actor/inbox Express routers. Domain-parameterized so every Oxy app backend federates under its own domain.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -375,7 +375,7 @@ describe('Move → onMove', () => {
375
375
  });
376
376
 
377
377
  describe('content verbs → onContentActivity', () => {
378
- it.each(['Create', 'Announce', 'Like', 'Delete', 'Update'])(
378
+ it.each(['Create', 'Announce', 'Like', 'Delete', 'Update', 'Add', 'Remove'])(
379
379
  'routes %s to the app',
380
380
  async (type) => {
381
381
  const rig = makeRig();
@@ -404,7 +404,7 @@ describe('content verbs → onContentActivity', () => {
404
404
  describe('blocked-origin domain policy', () => {
405
405
  const BLOCKED_ACTOR = 'https://spam.example/users/mallory';
406
406
 
407
- it.each(['Create', 'Announce', 'Like', 'Delete', 'Update'])(
407
+ it.each(['Create', 'Announce', 'Like', 'Delete', 'Update', 'Add', 'Remove'])(
408
408
  'drops %s from a blocked origin without reaching the app',
409
409
  async (type) => {
410
410
  const rig = makeRig({ blockedHosts: ['spam.example'] });
@@ -0,0 +1,59 @@
1
+ import { createSignedFetch, type SingleHopFetchInit } from '../node/signedFetch';
2
+
3
+ const INSTANCE_KEY = 'https://app.example/actor#main-key';
4
+ const ALICE_KEY = 'https://app.example/ap/users/alice#main-key';
5
+
6
+ /** A signed fetch over a scripted transport, recording each hop's URL and signing keyId. */
7
+ function rig(responses: Response[]) {
8
+ const hops: Array<{ url: string; keyId: string | null }> = [];
9
+ const signedFetch = createSignedFetch({
10
+ sign: async () => 'sig',
11
+ getInstanceKeyId: async () => INSTANCE_KEY,
12
+ fetchSingleHop: async (url: string, init: SingleHopFetchInit) => {
13
+ hops.push({ url, keyId: /keyId="([^"]+)"/.exec(init.headers.Signature ?? '')?.[1] ?? null });
14
+ const next = responses.shift();
15
+ if (!next) throw new Error(`unexpected hop to ${url}`);
16
+ return next;
17
+ },
18
+ userAgent: 'test',
19
+ });
20
+ return { signedFetch, hops };
21
+ }
22
+
23
+ it('signs as the instance and retries a 5xx unsigned', async () => {
24
+ const { signedFetch, hops } = rig([new Response(null, { status: 502 }), new Response('{}')]);
25
+
26
+ const res = await signedFetch('https://remote.example/notes/1', 'application/activity+json');
27
+
28
+ expect(res.status).toBe(200);
29
+ expect(hops).toEqual([
30
+ { url: 'https://remote.example/notes/1', keyId: INSTANCE_KEY },
31
+ { url: 'https://remote.example/notes/1', keyId: null },
32
+ ]);
33
+ });
34
+
35
+ it('signs every hop as the given actor and never retries an actor-signed request unsigned', async () => {
36
+ const redirected = rig([
37
+ new Response(null, { status: 301, headers: { location: '/statuses/1' } }),
38
+ new Response(null, { status: 401 }),
39
+ ]);
40
+ const refused = await redirected.signedFetch(
41
+ 'https://remote.example/notes/1',
42
+ 'application/activity+json',
43
+ { keyId: ALICE_KEY },
44
+ );
45
+ expect(refused.status).toBe(401);
46
+ expect(redirected.hops).toEqual([
47
+ { url: 'https://remote.example/notes/1', keyId: ALICE_KEY },
48
+ { url: 'https://remote.example/statuses/1', keyId: ALICE_KEY },
49
+ ]);
50
+
51
+ const failing = rig([new Response(null, { status: 503 })]);
52
+ const res = await failing.signedFetch(
53
+ 'https://remote.example/notes/1',
54
+ 'application/activity+json',
55
+ { keyId: ALICE_KEY },
56
+ );
57
+ expect(res.status).toBe(503);
58
+ expect(failing.hops).toHaveLength(1);
59
+ });
@@ -6,8 +6,8 @@
6
6
  * because those are identical across every Oxy app: they bridge a federated follow
7
7
  * edge into the Oxy graph (via the identity adapter), record the AP-side follow
8
8
  * row (via the store adapter), and send the Accept back (via the delivery
9
- * service). Every CONTENT verb (Create / Announce / Like / Delete / Update, and a
10
- * non-follow Undo) is handed to the app-registered
9
+ * service). Every CONTENT verb (Create / Announce / Like / Delete / Update /
10
+ * Add / Remove, and a non-follow Undo) is handed to the app-registered
11
11
  * {@link InboundDispatcherConfig.onContentActivity} callback, where the app's own
12
12
  * post/engagement handlers live. The consent gate + notification side effects are
13
13
  * injected so the engine holds no app knowledge.
@@ -186,7 +186,9 @@ export interface InboundDispatcherConfig {
186
186
  onOutboundFollowAccepted?(actorUri: string): Promise<void>;
187
187
  /**
188
188
  * Handle a CONTENT activity the engine does not own — Create / Announce / Like /
189
- * Delete / Update, and a non-follow Undo. The app's post/engagement handlers.
189
+ * Delete / Update / Add / Remove, and a non-follow Undo. The app's
190
+ * post/engagement handlers; `Add`/`Remove` carry collection changes such as a
191
+ * Mastodon pin (the status added to or removed from the actor's `featured`).
190
192
  */
191
193
  onContentActivity(activity: Record<string, unknown>, verifiedActorUri: string): Promise<void>;
192
194
  /**
@@ -499,12 +501,15 @@ export function createInboundDispatcher(config: InboundDispatcherConfig): Inboun
499
501
  case 'Reject':
500
502
  await handleReject(activity, verifiedActorUri);
501
503
  break;
502
- // Content verbs — the app owns these (posts, engagement, actor profile edits).
504
+ // Content verbs — the app owns these (posts, engagement, actor profile
505
+ // edits, and collection changes such as pinned posts).
503
506
  case 'Create':
504
507
  case 'Delete':
505
508
  case 'Like':
506
509
  case 'Announce':
507
510
  case 'Update':
511
+ case 'Add':
512
+ case 'Remove':
508
513
  await config.onContentActivity(activity, verifiedActorUri);
509
514
  break;
510
515
  case 'Move': {
package/src/node/index.ts CHANGED
@@ -20,6 +20,7 @@
20
20
  export {
21
21
  createSignedFetch,
22
22
  type SignedFetch,
23
+ type SignedFetchInit,
23
24
  type CreateSignedFetchConfig,
24
25
  type SingleHopFetch,
25
26
  type SingleHopFetchInit,
@@ -109,7 +110,7 @@ export {
109
110
  * Inbound ActivityPub dispatch — the untrusted-activity validator + switch, the
110
111
  * follow-protocol handlers (Follow / Accept / Undo(Follow) / Reject) over the
111
112
  * identity + store adapters, and the `onContentActivity` seam every content verb
112
- * (Create / Announce / Like / Delete / Update, non-follow Undo) is handed to.
113
+ * (Create / Announce / Like / Delete / Update / Add / Remove, non-follow Undo) is handed to.
113
114
  */
114
115
  export {
115
116
  createInboundDispatcher,
@@ -64,8 +64,26 @@ export interface CreateSignedFetchConfig {
64
64
  logger?: SignedFetchLogger;
65
65
  }
66
66
 
67
+ /** Request options for one {@link SignedFetch} call. */
68
+ export interface SignedFetchInit extends RequestInit {
69
+ /**
70
+ * Sign this request (and every re-signed redirect hop) with this actor key
71
+ * instead of the instance actor's — e.g. a local user's `…#main-key`, so a
72
+ * server that gates a followers-only or direct object on the requesting actor
73
+ * serves it to a follower or recipient. The signer must hold that key.
74
+ *
75
+ * An actor-signed request is never retried unsigned: its answer is the remote's
76
+ * verdict for that actor, so the response is returned as-is on any status.
77
+ */
78
+ keyId?: string;
79
+ }
80
+
67
81
  /** A signed ActivityPub GET, returning the standard WHATWG {@link Response}. */
68
- export type SignedFetch = (url: string, accept: string, init?: RequestInit) => Promise<Response>;
82
+ export type SignedFetch = (
83
+ url: string,
84
+ accept: string,
85
+ init?: SignedFetchInit,
86
+ ) => Promise<Response>;
69
87
 
70
88
  function requestInitHeaders(init: RequestInit): Record<string, string> {
71
89
  if (!init.headers) return {};
@@ -97,18 +115,20 @@ function requestInitHeaders(init: RequestInit): Record<string, string> {
97
115
  * `init.redirect === 'manual'`, the redirect `Response` is returned directly so
98
116
  * the caller can apply its own stricter redirect policy.
99
117
  *
100
- * Signed for servers that enforce authorized fetch (e.g. Threads). On a 5xx the
101
- * request is retried unsigned (same SSRF-safe path) as a fallback for public
102
- * resources.
118
+ * Signed for servers that enforce authorized fetch (e.g. Threads). An
119
+ * instance-signed request that gets a 5xx is retried unsigned (same SSRF-safe
120
+ * path) as a fallback for public resources. `init.keyId` signs as another actor
121
+ * (see {@link SignedFetchInit.keyId}); such a request is never retried unsigned.
103
122
  */
104
123
  export function createSignedFetch(config: CreateSignedFetchConfig): SignedFetch {
105
124
  return async function signedFetch(
106
125
  url: string,
107
126
  accept: string,
108
- init: RequestInit = {},
127
+ init: SignedFetchInit = {},
109
128
  ): Promise<Response> {
110
129
  const acceptHeader = `${accept}, application/ld+json; profile="https://www.w3.org/ns/activitystreams"`;
111
- const keyId = await config.getInstanceKeyId();
130
+ const actorSigned = init.keyId !== undefined;
131
+ const keyId = init.keyId ?? (await config.getInstanceKeyId());
112
132
  const extraHeaders = requestInitHeaders(init);
113
133
  const manualRedirect = init.redirect === 'manual';
114
134
 
@@ -151,6 +171,10 @@ export function createSignedFetch(config: CreateSignedFetchConfig): SignedFetch
151
171
 
152
172
  const { res, finalUrl } = await fetchFollowingRedirects(url, true);
153
173
 
174
+ // An actor-signed answer is the remote's verdict for THAT actor (a follower or
175
+ // recipient): an unsigned retry asks a different question, so it never runs.
176
+ if (actorSigned) return res;
177
+
154
178
  // If the remote server returns a 5xx (e.g. it can't resolve our keyId to
155
179
  // verify the signature), retry without the signature as a fallback for public
156
180
  // resources. Retry from the post-redirect URL so we don't restart a chain that