fix(federation): 🚑 Don't always try to use instance key when an instance is not the request signer

This commit is contained in:
Jesse Wierzbinski 2024-11-24 23:01:47 +01:00
parent 34370a082a
commit 005a3a2721
No known key found for this signature in database
3 changed files with 28 additions and 16 deletions

View file

@ -177,10 +177,21 @@ export const inboxWorker = new Worker<InboxJobData, Response, InboxJobType>(
remoteInstance.data.baseUrl,
)}`;
if (!remoteInstance.data.publicKey?.key) {
throw new Error(
`Instance ${remoteInstance.data.baseUrl} has no public key stored in database`,
);
}
const processor = new InboxProcessor(
request,
data,
remoteInstance,
{
instance: remoteInstance,
key:
sender?.data.publicKey ??
remoteInstance.data.publicKey.key,
},
{
signature,
nonce,