Skip to content

Commit 731e208

Browse files
committed
fedify inbox: Embed actor to Delete(Application)
1 parent 3b55db2 commit 731e208

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

Diff for: CHANGES.md

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ To be released.
1111
- Fixed a bug of `Object.toJsonLd()` method where it had incorrectly compacted
1212
the `name` property when it was not a language map.
1313

14+
- The `Delete(Application)` activities sent by the `fedify inbox` command now
15+
embed the entire actor object instead of just the actor's URI so that
16+
the peers can verify the actor's signature without fetching the actor
17+
object.
18+
1419

1520
Version 1.0.1
1621
-------------

Diff for: cli/inbox.tsx

+19-12
Original file line numberDiff line numberDiff line change
@@ -194,18 +194,25 @@ async function acceptsFollowFrom(actor: Actor): Promise<boolean> {
194194
const peers: Record<string, Actor> = {};
195195

196196
async function sendDeleteToPeers(server: TemporaryServer): Promise<void> {
197-
const ctx = federation.createContext(server.url, -1);
198-
const actorId = ctx.getActorUri("i");
199-
await ctx.sendActivity(
200-
{ identifier: "i" },
201-
Object.values(peers),
202-
new Delete({
203-
id: new URL(`#delete`, actorId),
204-
actor: actorId,
205-
to: PUBLIC_COLLECTION,
206-
object: actorId,
207-
}),
208-
);
197+
const ctx = federation.createContext(new Request(server.url), -1);
198+
const actor = (await ctx.getActor("i"))!;
199+
try {
200+
await ctx.sendActivity(
201+
{ identifier: "i" },
202+
Object.values(peers),
203+
new Delete({
204+
id: new URL(`#delete`, actor.id!),
205+
actor: actor.id!,
206+
to: PUBLIC_COLLECTION,
207+
object: actor,
208+
}),
209+
);
210+
} catch (error) {
211+
logger.error(
212+
"Failed to send Delete(Application) activities to peers:\n{error}",
213+
{ error },
214+
);
215+
}
209216
}
210217

211218
const followers: Record<string, Actor> = {};

0 commit comments

Comments
 (0)