From d30c1a49db49a42a21dd6f10af308e944364f8d0 Mon Sep 17 00:00:00 2001 From: Mauve Signweaver Date: Tue, 10 Dec 2024 16:04:04 -0500 Subject: [PATCH 1/2] fix: for cosocial rename hs2019 signatures to rsa-256 --- src/server/apsystem.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/server/apsystem.ts b/src/server/apsystem.ts index 5b073a8..488a0d9 100644 --- a/src/server/apsystem.ts +++ b/src/server/apsystem.ts @@ -122,6 +122,11 @@ export default class ActivityPubSystem { }) } + // Fix for cosocial + if (typeof headers.signature === 'string' && headers.signature.includes('hs2019')) { + headers.signature = headers.signature.replace('hs2019', 'rsa-sha256') + } + const signature = signatureParser.parse({ url, method, headers }) const { keyId } = signature From 0f3110fcecbc7689a6889ba02dd74062de3f566b Mon Sep 17 00:00:00 2001 From: Mauve Signweaver Date: Tue, 10 Dec 2024 16:09:27 -0500 Subject: [PATCH 2/2] fix: have no end slashes in actor request mocks --- src/client/index.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/index.test.ts b/src/client/index.test.ts index 4bcc496..63ad766 100644 --- a/src/client/index.test.ts +++ b/src/client/index.test.ts @@ -59,10 +59,10 @@ test('Actor Info Management', async t => { const mockActorInfo = { name: 'Test Actor', inbox: 'https://test.instance/inbox' } // Mock Fetch Actor Info - mockSignedFetch.withArgs(`${instance}/v1/testActor/`, sinon.match.any).resolves(new Response(JSON.stringify(mockActorInfo))) + mockSignedFetch.withArgs(`${instance}/v1/testActor`, sinon.match({ method: 'GET' })).resolves(new Response(JSON.stringify(mockActorInfo))) // Mock Delete Actor - mockSignedFetch.withArgs(`${instance}/v1/testActor/`, sinon.match({ method: 'DELETE' })).resolves(new Response()) + mockSignedFetch.withArgs(`${instance}/v1/testActor`, sinon.match({ method: 'DELETE' })).resolves(new Response()) const actorInfo = await client.getActorInfo('testActor') t.deepEqual(actorInfo, mockActorInfo)