summaryrefslogtreecommitdiff
path: root/packages/backend/src/queue
diff options
context:
space:
mode:
authorHazelnoot <acomputerdog@gmail.com>2024-10-14 14:41:16 -0400
committerHazelnoot <acomputerdog@gmail.com>2024-10-26 10:40:15 -0400
commit5eb9a263e25b174aba1fb417ff73780f1bc88946 (patch)
tree9f724ea3f7b39bb8edc642b1f3d0549a657add02 /packages/backend/src/queue
parentremove cached public keys after deletion (diff)
downloadsharkey-5eb9a263e25b174aba1fb417ff73780f1bc88946.tar.gz
sharkey-5eb9a263e25b174aba1fb417ff73780f1bc88946.tar.bz2
sharkey-5eb9a263e25b174aba1fb417ff73780f1bc88946.zip
fix public key re-fetch logic
Diffstat (limited to 'packages/backend/src/queue')
-rw-r--r--packages/backend/src/queue/processors/InboxProcessorService.ts18
1 files changed, 7 insertions, 11 deletions
diff --git a/packages/backend/src/queue/processors/InboxProcessorService.ts b/packages/backend/src/queue/processors/InboxProcessorService.ts
index 8b3d2ebb50..8c116f82b9 100644
--- a/packages/backend/src/queue/processors/InboxProcessorService.ts
+++ b/packages/backend/src/queue/processors/InboxProcessorService.ts
@@ -118,19 +118,15 @@ export class InboxProcessorService implements OnApplicationShutdown {
// HTTP-Signatureの検証
let httpSignatureValidated = httpSignature.verifySignature(signature, authUser.key.keyPem);
- // また、signatureのsignerは、activity.actorと一致する必要がある
- if (!httpSignatureValidated || authUser.user.uri !== activity.actor) {
- let renewKeyFailed = true;
-
- if (!httpSignatureValidated) {
- authUser.key = await this.apDbResolverService.refetchPublicKeyForApId(authUser.user);
-
- if (authUser.key != null) {
- httpSignatureValidated = httpSignature.verifySignature(signature, authUser.key.keyPem);
- renewKeyFailed = false;
- }
+ if (!httpSignatureValidated) {
+ authUser.key = await this.apDbResolverService.refetchPublicKeyForApId(authUser.user);
+ if (authUser.key != null) {
+ httpSignatureValidated = httpSignature.verifySignature(signature, authUser.key.keyPem);
}
+ }
+ // また、signatureのsignerは、activity.actorと一致する必要がある
+ if (!httpSignatureValidated || authUser.user.uri !== getApId(activity.actor)) {
// 一致しなくても、でもLD-Signatureがありそうならそっちも見る
const ldSignature = activity.signature;
if (ldSignature) {