@rmdes/indiekit-endpoint-activitypub 1.0.9 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,6 +15,7 @@ import {
15
15
  Person,
16
16
  PropertyValue,
17
17
  createFederation,
18
+ generateCryptoKeyPair,
18
19
  importSpki,
19
20
  } from "@fedify/fedify";
20
21
  import { configure, getConsoleSink } from "@logtape/logtape";
@@ -134,23 +135,35 @@ export function setupFederation(options) {
134
135
  return new Person(personOptions);
135
136
  },
136
137
  )
138
+ .mapHandle((_ctx, username) => (username === handle ? handle : null))
137
139
  .setKeyPairsDispatcher(async (ctx, identifier) => {
138
140
  if (identifier !== handle) return [];
139
141
 
142
+ const keyPairs = [];
143
+
144
+ // Import legacy RSA key pair (for HTTP Signatures compatibility)
140
145
  const legacyKey = await collections.ap_keys.findOne({});
141
146
  if (legacyKey?.publicKeyPem && legacyKey?.privateKeyPem) {
142
147
  try {
143
- const publicKey = await importSpki(legacyKey.publicKeyPem, "RSA");
148
+ const publicKey = await importSpki(legacyKey.publicKeyPem);
144
149
  const privateKey = await importPkcs8Pem(legacyKey.privateKeyPem);
145
- return [{ publicKey, privateKey }];
150
+ keyPairs.push({ publicKey, privateKey });
146
151
  } catch {
147
152
  console.warn(
148
- "[ActivityPub] Could not import legacy RSA keys, generating new key pairs",
153
+ "[ActivityPub] Could not import legacy RSA keys",
149
154
  );
150
155
  }
151
156
  }
152
157
 
153
- return [];
158
+ // Generate Ed25519 key pair (for Object Integrity Proofs)
159
+ try {
160
+ const ed25519 = await generateCryptoKeyPair("Ed25519");
161
+ keyPairs.push(ed25519);
162
+ } catch (error) {
163
+ console.warn("[ActivityPub] Could not generate Ed25519 key pair:", error.message);
164
+ }
165
+
166
+ return keyPairs;
154
167
  });
155
168
 
156
169
  // --- Inbox listeners ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-activitypub",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.",
5
5
  "keywords": [
6
6
  "indiekit",