Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: for cosocial rename hs2019 signatures to rsa-256 #94

Merged
merged 2 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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