fix: add WebFinger handle mapper and Ed25519 key pair
1. mapHandle() — tells Fedify how to resolve WebFinger usernames to actor identifiers, suppressing the "No actor handle mapper is set" warning on every WebFinger lookup. 2. Ed25519 key pair — generated alongside the legacy RSA pair so Fedify can create Object Integrity Proofs on outbound activities. RSA is kept for HTTP Signatures backward compatibility.
This commit is contained in:
+17
-4
@@ -15,6 +15,7 @@ import {
|
||||
Person,
|
||||
PropertyValue,
|
||||
createFederation,
|
||||
generateCryptoKeyPair,
|
||||
importSpki,
|
||||
} from "@fedify/fedify";
|
||||
import { configure, getConsoleSink } from "@logtape/logtape";
|
||||
@@ -134,23 +135,35 @@ export function setupFederation(options) {
|
||||
return new Person(personOptions);
|
||||
},
|
||||
)
|
||||
.mapHandle((_ctx, username) => (username === handle ? handle : null))
|
||||
.setKeyPairsDispatcher(async (ctx, identifier) => {
|
||||
if (identifier !== handle) return [];
|
||||
|
||||
const keyPairs = [];
|
||||
|
||||
// Import legacy RSA key pair (for HTTP Signatures compatibility)
|
||||
const legacyKey = await collections.ap_keys.findOne({});
|
||||
if (legacyKey?.publicKeyPem && legacyKey?.privateKeyPem) {
|
||||
try {
|
||||
const publicKey = await importSpki(legacyKey.publicKeyPem, "RSA");
|
||||
const publicKey = await importSpki(legacyKey.publicKeyPem);
|
||||
const privateKey = await importPkcs8Pem(legacyKey.privateKeyPem);
|
||||
return [{ publicKey, privateKey }];
|
||||
keyPairs.push({ publicKey, privateKey });
|
||||
} catch {
|
||||
console.warn(
|
||||
"[ActivityPub] Could not import legacy RSA keys, generating new key pairs",
|
||||
"[ActivityPub] Could not import legacy RSA keys",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return [];
|
||||
// Generate Ed25519 key pair (for Object Integrity Proofs)
|
||||
try {
|
||||
const ed25519 = await generateCryptoKeyPair("Ed25519");
|
||||
keyPairs.push(ed25519);
|
||||
} catch (error) {
|
||||
console.warn("[ActivityPub] Could not generate Ed25519 key pair:", error.message);
|
||||
}
|
||||
|
||||
return keyPairs;
|
||||
});
|
||||
|
||||
// --- Inbox listeners ---
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@rmdes/indiekit-endpoint-activitypub",
|
||||
"version": "1.0.9",
|
||||
"version": "1.0.10",
|
||||
"description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.",
|
||||
"keywords": [
|
||||
"indiekit",
|
||||
|
||||
Reference in New Issue
Block a user