Skip to content

Commit

Permalink
LD 上に
Browse files Browse the repository at this point in the history
  • Loading branch information
mei23 committed Apr 29, 2024
1 parent 70543fb commit 1b36be8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/queue/processors/inbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ export const tryProcessInbox = async (data: InboxJobData, ctx?: ApContext): Prom
return `skip: LD-Signatureの検証に失敗しました`;
}

const activity2 = JSON.parse(JSON.stringify(activity));
delete activity2.signature;
const compacted = await ldSignature.compact(activity2, FIXED_CONTEXT);
activity = compacted as any;

// もう一度actorチェック
if (user.uri !== activity.actor) {
return `skip: LD-Signature user(${user.uri}) !== activity.actor(${activity.actor})`;
Expand All @@ -122,11 +127,6 @@ export const tryProcessInbox = async (data: InboxJobData, ctx?: ApContext): Prom
if (await isBlockedHost(ldHost)) {
return `skip: Blocked instance: ${ldHost}`;
}

const activity2 = JSON.parse(JSON.stringify(activity));
delete activity2.signature;
const compacted = await ldSignature.compact(activity2, FIXED_CONTEXT);
activity = compacted as any;
} else {
return `skip: http-signature verification failed and ${config.ignoreApForwarded ? 'ignoreApForwarded' : 'no LD-Signature'}. keyId=${signature.keyId}`;
}
Expand Down

0 comments on commit 1b36be8

Please sign in to comment.