Skip to content

Commit

Permalink
Merge pull request #94 from hyphacoop/fix-cosocial
Browse files Browse the repository at this point in the history
fix: for cosocial rename hs2019 signatures to rsa-256
  • Loading branch information
RangerMauve authored Dec 12, 2024
2 parents 42636c9 + 0f3110f commit 6655387
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/client/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions src/server/apsystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 6655387

Please sign in to comment.