@fedify/testing 2.0.0-dev.226 → 2.0.0-dev.236
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.
- package/dist/mod.cjs +25 -4
- package/dist/mod.d.ts +1 -1
- package/dist/mod.js +25 -4
- package/package.json +2 -2
package/dist/mod.cjs
CHANGED
|
@@ -24,8 +24,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
}) : target, mod));
|
|
25
25
|
|
|
26
26
|
//#endregion
|
|
27
|
-
const __fedify_fedify_federation = __toESM(require("@fedify/fedify/federation"));
|
|
28
27
|
const __fedify_vocab = __toESM(require("@fedify/vocab"));
|
|
28
|
+
const __fedify_fedify_federation = __toESM(require("@fedify/fedify/federation"));
|
|
29
29
|
const es_toolkit = __toESM(require("es-toolkit"));
|
|
30
30
|
const node_assert_strict = __toESM(require("node:assert/strict"));
|
|
31
31
|
|
|
@@ -210,6 +210,7 @@ var MockFederation = class {
|
|
|
210
210
|
nodeInfoDispatcher;
|
|
211
211
|
webFingerDispatcher;
|
|
212
212
|
actorDispatchers = /* @__PURE__ */ new Map();
|
|
213
|
+
actorKeyPairsDispatcher;
|
|
213
214
|
actorPath;
|
|
214
215
|
inboxPath;
|
|
215
216
|
outboxPath;
|
|
@@ -247,7 +248,10 @@ var MockFederation = class {
|
|
|
247
248
|
this.actorDispatchers.set(path, dispatcher);
|
|
248
249
|
this.actorPath = path;
|
|
249
250
|
return {
|
|
250
|
-
setKeyPairsDispatcher: () =>
|
|
251
|
+
setKeyPairsDispatcher: (keyPairsDispatcher) => {
|
|
252
|
+
this.actorKeyPairsDispatcher = keyPairsDispatcher;
|
|
253
|
+
return this;
|
|
254
|
+
},
|
|
251
255
|
mapHandle: () => this,
|
|
252
256
|
mapAlias: () => this,
|
|
253
257
|
authorize: () => this
|
|
@@ -683,8 +687,25 @@ var MockContext = class MockContext {
|
|
|
683
687
|
}
|
|
684
688
|
return null;
|
|
685
689
|
}
|
|
686
|
-
getActorKeyPairs(
|
|
687
|
-
|
|
690
|
+
async getActorKeyPairs(identifier) {
|
|
691
|
+
if (this.federation instanceof MockFederation && this.federation.actorKeyPairsDispatcher) {
|
|
692
|
+
const keyPairs = await this.federation.actorKeyPairsDispatcher(this, identifier);
|
|
693
|
+
const owner = this.getActorUri(identifier);
|
|
694
|
+
return keyPairs.map((kp) => ({
|
|
695
|
+
...kp,
|
|
696
|
+
cryptographicKey: new __fedify_vocab.CryptographicKey({
|
|
697
|
+
id: kp.keyId,
|
|
698
|
+
owner,
|
|
699
|
+
publicKey: kp.publicKey
|
|
700
|
+
}),
|
|
701
|
+
multikey: new __fedify_vocab.Multikey({
|
|
702
|
+
id: kp.keyId,
|
|
703
|
+
controller: owner,
|
|
704
|
+
publicKey: kp.publicKey
|
|
705
|
+
})
|
|
706
|
+
}));
|
|
707
|
+
}
|
|
708
|
+
return [];
|
|
688
709
|
}
|
|
689
710
|
getDocumentLoader(params) {
|
|
690
711
|
if ("keyId" in params) return this.documentLoader;
|
package/dist/mod.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
-
import { Context, Federation, InboxContext, RequestContext } from "@fedify/fedify/federation";
|
|
3
2
|
import { Activity } from "@fedify/vocab";
|
|
3
|
+
import { Context, Federation, InboxContext, RequestContext } from "@fedify/fedify/federation";
|
|
4
4
|
import { MessageQueue } from "@fedify/fedify";
|
|
5
5
|
|
|
6
6
|
//#region src/context.d.ts
|
package/dist/mod.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
|
3
3
|
|
|
4
|
+
import { CryptographicKey, Multikey, lookupObject, traverseCollection } from "@fedify/vocab";
|
|
4
5
|
import { RouterError } from "@fedify/fedify/federation";
|
|
5
|
-
import { lookupObject, traverseCollection } from "@fedify/vocab";
|
|
6
6
|
import { delay } from "es-toolkit";
|
|
7
7
|
import { deepStrictEqual, ok } from "node:assert/strict";
|
|
8
8
|
|
|
@@ -187,6 +187,7 @@ var MockFederation = class {
|
|
|
187
187
|
nodeInfoDispatcher;
|
|
188
188
|
webFingerDispatcher;
|
|
189
189
|
actorDispatchers = /* @__PURE__ */ new Map();
|
|
190
|
+
actorKeyPairsDispatcher;
|
|
190
191
|
actorPath;
|
|
191
192
|
inboxPath;
|
|
192
193
|
outboxPath;
|
|
@@ -224,7 +225,10 @@ var MockFederation = class {
|
|
|
224
225
|
this.actorDispatchers.set(path, dispatcher);
|
|
225
226
|
this.actorPath = path;
|
|
226
227
|
return {
|
|
227
|
-
setKeyPairsDispatcher: () =>
|
|
228
|
+
setKeyPairsDispatcher: (keyPairsDispatcher) => {
|
|
229
|
+
this.actorKeyPairsDispatcher = keyPairsDispatcher;
|
|
230
|
+
return this;
|
|
231
|
+
},
|
|
228
232
|
mapHandle: () => this,
|
|
229
233
|
mapAlias: () => this,
|
|
230
234
|
authorize: () => this
|
|
@@ -660,8 +664,25 @@ var MockContext = class MockContext {
|
|
|
660
664
|
}
|
|
661
665
|
return null;
|
|
662
666
|
}
|
|
663
|
-
getActorKeyPairs(
|
|
664
|
-
|
|
667
|
+
async getActorKeyPairs(identifier) {
|
|
668
|
+
if (this.federation instanceof MockFederation && this.federation.actorKeyPairsDispatcher) {
|
|
669
|
+
const keyPairs = await this.federation.actorKeyPairsDispatcher(this, identifier);
|
|
670
|
+
const owner = this.getActorUri(identifier);
|
|
671
|
+
return keyPairs.map((kp) => ({
|
|
672
|
+
...kp,
|
|
673
|
+
cryptographicKey: new CryptographicKey({
|
|
674
|
+
id: kp.keyId,
|
|
675
|
+
owner,
|
|
676
|
+
publicKey: kp.publicKey
|
|
677
|
+
}),
|
|
678
|
+
multikey: new Multikey({
|
|
679
|
+
id: kp.keyId,
|
|
680
|
+
controller: owner,
|
|
681
|
+
publicKey: kp.publicKey
|
|
682
|
+
})
|
|
683
|
+
}));
|
|
684
|
+
}
|
|
685
|
+
return [];
|
|
665
686
|
}
|
|
666
687
|
getDocumentLoader(params) {
|
|
667
688
|
if ("keyId" in params) return this.documentLoader;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/testing",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.236+9f9235d1",
|
|
4
4
|
"description": "Testing utilities for Fedify applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fedify",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"package.json"
|
|
51
51
|
],
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@fedify/fedify": "^2.0.0-dev.
|
|
53
|
+
"@fedify/fedify": "^2.0.0-dev.236+9f9235d1"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"es-toolkit": "1.43.0"
|