From cc72c3d9a5aa38d08ade74ea4a9c4b7bb2c09cca Mon Sep 17 00:00:00 2001 From: f Date: Thu, 4 Jul 2024 10:47:49 -0300 Subject: [PATCH] fix: return empty string when request isn't signed #172 --- src/server/apsystem.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/server/apsystem.ts b/src/server/apsystem.ts index 94e9f23..1faa530 100644 --- a/src/server/apsystem.ts +++ b/src/server/apsystem.ts @@ -93,6 +93,11 @@ export default class ActivityPubSystem { async verifySignedRequest (request: FastifyRequest, fromActor?: string): Promise { // TODO: Fetch and verify Digest header const { url, method, headers } = request + + if (!headers.signature) { + return new Promise((resolve, reject) => resolve("")) + } + const signature = signatureParser.parse({ url, method, headers }) const { keyId } = signature