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 8857d78 commit 84ada27
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 @@ -105,6 +105,11 @@ export default async (job: Bull.Job<InboxJobData>): Promise<string> => {
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 (authUser.user.uri !== activity.actor) {
return `skip: LD-Signature user(${authUser.user.uri}) !== activity.actor(${activity.actor})`;
Expand All @@ -115,11 +120,6 @@ export default async (job: Bull.Job<InboxJobData>): Promise<string> => {
if (meta.blockedHosts.includes(ldHost)) {
return `Blocked request: ${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 no LD-Signature. keyId=${signature.keyId}`;
}
Expand Down

0 comments on commit 84ada27

Please sign in to comment.