@fedify/fedify 1.6.1-dev.880 → 1.6.1-dev.883
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/{actor-DvmEmDn9.js → actor-CwAL6Q82.js} +180 -180
- package/dist/{actor-DIk6hH_U.js → actor-DezwbbQX.js} +3 -3
- package/dist/{actor-f67C7yQD.d.ts → actor-tT_B0pDn.d.ts} +5 -8
- package/dist/{assert-Dv75vaGI.js → assert-YJk-1DlZ.js} +1 -1
- package/dist/{assert_equals-ClvzlhZu.js → assert_equals-Dnj7ejjL.js} +16 -9
- package/dist/{assert_instance_of--9UCVKsi.js → assert_instance_of-DBIoG5k7.js} +1 -1
- package/dist/{assert_is_error-D162gXcM.js → assert_is_error-jyzqjHud.js} +1 -1
- package/dist/{assert_not_equals-Cyf5m9Ke.js → assert_not_equals-wx-SRs4i.js} +1 -1
- package/dist/{assert_rejects-FOHCtlD2.js → assert_rejects-BZjUwo62.js} +2 -2
- package/dist/{assert_throws-CRfQJvVx.js → assert_throws-gBPv3v2V.js} +2 -2
- package/dist/{authdocloader-B3ME-k-0.js → authdocloader-C-_Lr-KH.js} +3 -3
- package/dist/{authdocloader-Bt52x-cz.js → authdocloader-Df1y1MKv.js} +4 -4
- package/dist/{builder-DT_CjHJM.js → builder-C8tsk_Xe.js} +3 -3
- package/dist/{client-Dw1pCSIt.d.ts → client-Cd552pKL.d.ts} +6 -9
- package/dist/{client-CSQzJhcr.js → client-CwjvB-Dh.js} +1 -1
- package/dist/{collection-QaGK9TVn.js → collection-Dfb0TPno.js} +1 -1
- package/dist/compat/mod.d.ts +12 -12
- package/dist/compat/mod.js +1 -1
- package/dist/compat/transformers.test.js +21 -21
- package/dist/{context-DBM4y1xF.d.ts → context-DRhhOsMk.d.ts} +12 -28
- package/dist/{context-DaUJ8XgG.js → context-DfToVZY6.js} +2 -2
- package/dist/{docloader-BesQV-nU.js → docloader-BFRgyDAa.js} +1 -2
- package/dist/{docloader-DdQSFoDK.js → docloader-BXc5egq6.js} +1 -2
- package/dist/{docloader-DTRsVZPo.d.ts → docloader-DlUDOVSe.d.ts} +4 -7
- package/dist/{esm-BxIKwi-M.js → esm-Btx3E8og.js} +1 -1
- package/dist/federation/builder.test.js +12 -12
- package/dist/federation/collection.test.js +9 -9
- package/dist/federation/handler.test.js +28 -28
- package/dist/federation/inbox.test.js +6 -6
- package/dist/federation/keycache.test.js +6 -6
- package/dist/federation/kv.test.js +8 -8
- package/dist/federation/middleware.test.js +28 -28
- package/dist/federation/mod.d.ts +11 -11
- package/dist/federation/mod.js +12 -12
- package/dist/federation/mq.test.js +10 -10
- package/dist/federation/retry.test.js +2 -2
- package/dist/federation/router.test.js +9 -9
- package/dist/federation/send.test.js +18 -18
- package/dist/{federation-Bmj7soSg.js → federation-3B6BDKCK.js} +1 -1
- package/dist/{http-nvlEiwC4.js → http-3CJyDlPz.js} +4 -4
- package/dist/{http-CZyKN-rt.d.ts → http-BkUCISGt.d.ts} +6 -14
- package/dist/{http-DKFoMKYk.js → http-DC3mY9EG.js} +4 -4
- package/dist/{inbox-DUxOSixz.js → inbox-CCbuuUqY.js} +4 -4
- package/dist/{key-C_i44VCP.js → key-CD8i4ZB_.js} +2 -2
- package/dist/{key-B6j6aQIf.js → key-Ce8aGBE5.js} +5 -5
- package/dist/{key-DnZNsfoE.js → key-D0WW7EHK.js} +3 -3
- package/dist/{key-BiM3rCVA.js → key-Y8a6dgOq.js} +4 -4
- package/dist/{keycache-NtvEqcq9.js → keycache-BtADunPo.js} +2 -2
- package/dist/{keys-R9p0S8_o.js → keys-BIY57kjo.js} +1 -1
- package/dist/{kv-BmsWxOQ2.d.ts → kv-p8sC8PTT.d.ts} +3 -7
- package/dist/{ld-BLZnxCWX.js → ld-D4G5WL1G.js} +4 -4
- package/dist/{lookup-B38eCiCI.js → lookup-C8V37GPa.js} +1 -1
- package/dist/{lookup-DXgwlvAK.js → lookup-CQnVHXIh.js} +3 -3
- package/dist/{lookup-CNK83LQK.js → lookup-Ds1_3qy2.js} +1 -1
- package/dist/{lookup-nlxO7x0u.d.ts → lookup-vJccIKCS.d.ts} +4 -8
- package/dist/middleware-DPuaf71I.js +17 -0
- package/dist/{middleware-Bjqgfc8l.js → middleware-DRpRVwO7.js} +18 -18
- package/dist/{middleware-FhQhkH0G.js → middleware-Jvf6WsMN.js} +18 -18
- package/dist/middleware-XHndzOUD.js +33 -0
- package/dist/{mod-iE_61Xjt.d.ts → mod-BTHfUeLo.d.ts} +2 -9
- package/dist/{mod-BUAWJ2pK.d.ts → mod-BUTm-sog.d.ts} +5 -9
- package/dist/{mod-CsYfI7YL.d.ts → mod-CgmTOt4z.d.ts} +3 -21
- package/dist/{mod-Bx6Du4Ct.d.ts → mod-DSPyncxx.d.ts} +5 -11
- package/dist/mod.d.ts +14 -14
- package/dist/mod.js +12 -12
- package/dist/{mq-Bue016Tz.d.ts → mq-nceTGCuc.d.ts} +3 -7
- package/dist/nodeinfo/client.test.js +23 -36
- package/dist/nodeinfo/handler.test.js +27 -27
- package/dist/nodeinfo/mod.d.ts +3 -3
- package/dist/nodeinfo/mod.js +2 -2
- package/dist/nodeinfo/semver.test.js +8 -8
- package/dist/nodeinfo/types.test.js +8 -8
- package/dist/{owner-C_Gw25Id.d.ts → owner-CbRc94FP.d.ts} +6 -9
- package/dist/{owner-DKsEWurW.js → owner-Dyk0zd-q.js} +3 -3
- package/dist/{proof-DtIUHGA0.js → proof-B8Hm2M5c.js} +3 -3
- package/dist/{proof-DKetjewp.js → proof-D-CWdNQx.js} +5 -5
- package/dist/runtime/authdocloader.test.js +17 -17
- package/dist/runtime/docloader.test.js +69 -66
- package/dist/runtime/key.test.js +13 -13
- package/dist/runtime/langstr.test.js +8 -8
- package/dist/runtime/mod.d.ts +5 -5
- package/dist/runtime/mod.js +6 -6
- package/dist/runtime/multibase/multibase.test.js +8 -8
- package/dist/runtime/url.test.js +4 -4
- package/dist/{send-Z9IEW2ZG.js → send-CJXTH3ST.js} +3 -3
- package/dist/sig/http.test.js +52 -47
- package/dist/sig/key.test.js +14 -14
- package/dist/sig/ld.test.js +12 -12
- package/dist/sig/mod.d.ts +7 -7
- package/dist/sig/mod.js +6 -6
- package/dist/sig/owner.test.js +16 -16
- package/dist/sig/proof.test.js +15 -15
- package/dist/{std__assert-CaBUULmX.js → std__assert-CHXwj7zk.js} +1 -1
- package/dist/testing/docloader.test.js +8 -8
- package/dist/testing/mod.d.ts +0 -1
- package/dist/{transformers-jxj-4o2K.js → transformers-ghwJuzGY.js} +1 -1
- package/dist/{types-C9A_t_ZN.js → types-D3XNqpGz.js} +1 -1
- package/dist/vocab/actor.test.js +60 -49
- package/dist/vocab/lookup.test.js +13 -13
- package/dist/vocab/mod.d.ts +5 -5
- package/dist/vocab/mod.js +4 -4
- package/dist/vocab/type.test.js +3 -3
- package/dist/vocab/vocab.test.js +129 -132
- package/dist/{vocab-CHuz96Ha.js → vocab-CPrCb9BR.js} +3 -3
- package/dist/{vocab-7mZSoHR0.js → vocab-CaZSjoCB.js} +178 -178
- package/dist/{vocab-C4bpdeio.d.ts → vocab-DSFLLLe6.d.ts} +2 -7
- package/dist/webfinger/handler.test.js +27 -27
- package/dist/webfinger/lookup.test.js +41 -46
- package/dist/webfinger/mod.d.ts +3 -3
- package/dist/webfinger/mod.js +2 -2
- package/dist/x/cfworkers.d.ts +2 -9
- package/dist/x/cfworkers.test.js +8 -8
- package/dist/x/hono.d.ts +11 -12
- package/dist/x/sveltekit.d.ts +11 -12
- package/package.json +2 -3
- package/dist/hongminhee__deno-mock-fetch-DJKLj_H-.js +0 -188
- package/dist/middleware-B8XTnZdu.js +0 -33
- package/dist/middleware-D-_NS4x8.js +0 -17
- /package/dist/{denokv-iB_ggPGm.js → denokv-B_GFWjrl.js} +0 -0
@@ -3,20 +3,20 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { assertEquals } from "../assert_equals-
|
7
|
-
import "../assert-
|
8
|
-
import "../assert_instance_of
|
6
|
+
import { assertEquals } from "../assert_equals-Dnj7ejjL.js";
|
7
|
+
import "../assert-YJk-1DlZ.js";
|
8
|
+
import "../assert_instance_of-DBIoG5k7.js";
|
9
9
|
import { MemoryKvStore } from "../kv-DohFOP2C.js";
|
10
|
-
import { FetchError, contexts_default, deno_default, getDocumentLoader, getUserAgent, kvCache } from "../docloader-
|
10
|
+
import { FetchError, contexts_default, deno_default, getDocumentLoader, getUserAgent, kvCache } from "../docloader-BXc5egq6.js";
|
11
11
|
import { UrlError } from "../url-kTAI6_KP.js";
|
12
12
|
import { test } from "../testing-jcGLO9Lp.js";
|
13
|
-
import "../std__assert-
|
14
|
-
import { assertRejects } from "../assert_rejects-
|
15
|
-
import "../assert_is_error-
|
16
|
-
import "../assert_not_equals-
|
17
|
-
import { assertThrows } from "../assert_throws-
|
13
|
+
import "../std__assert-CHXwj7zk.js";
|
14
|
+
import { assertRejects } from "../assert_rejects-BZjUwo62.js";
|
15
|
+
import "../assert_is_error-jyzqjHud.js";
|
16
|
+
import "../assert_not_equals-wx-SRs4i.js";
|
17
|
+
import { assertThrows } from "../assert_throws-gBPv3v2V.js";
|
18
18
|
import { mockDocumentLoader } from "../docloader-09nVWLAZ.js";
|
19
|
-
import {
|
19
|
+
import { esm_default } from "../esm-Btx3E8og.js";
|
20
20
|
import process from "node:process";
|
21
21
|
|
22
22
|
//#region runtime/docloader.test.ts
|
@@ -31,13 +31,13 @@ test("new FetchError()", () => {
|
|
31
31
|
});
|
32
32
|
test("getDocumentLoader()", async (t) => {
|
33
33
|
const fetchDocumentLoader = getDocumentLoader();
|
34
|
-
|
35
|
-
|
34
|
+
esm_default.spyGlobal();
|
35
|
+
esm_default.get("https://example.com/object", { body: {
|
36
36
|
"@context": "https://www.w3.org/ns/activitystreams",
|
37
37
|
id: "https://example.com/object",
|
38
38
|
name: "Fetched object",
|
39
39
|
type: "Object"
|
40
|
-
}
|
40
|
+
} });
|
41
41
|
await t.step("ok", async () => {
|
42
42
|
assertEquals(await fetchDocumentLoader("https://example.com/object"), {
|
43
43
|
contextUrl: null,
|
@@ -50,43 +50,37 @@ test("getDocumentLoader()", async (t) => {
|
|
50
50
|
}
|
51
51
|
});
|
52
52
|
});
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
53
|
+
esm_default.get("https://example.com/link-ctx", {
|
54
|
+
body: {
|
55
|
+
id: "https://example.com/link-ctx",
|
56
|
+
name: "Fetched object",
|
57
|
+
type: "Object"
|
58
|
+
},
|
59
59
|
headers: {
|
60
60
|
"Content-Type": "application/activity+json",
|
61
61
|
Link: "<https://www.w3.org/ns/activitystreams>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\""
|
62
62
|
}
|
63
|
-
})
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
"
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
"@context": "https://www.w3.org/ns/activitystreams",
|
80
|
-
id: "https://example.com/obj-w-wrong-link",
|
81
|
-
name: "Fetched object",
|
82
|
-
type: "Object"
|
83
|
-
}), {
|
84
|
-
status: 200,
|
63
|
+
});
|
64
|
+
esm_default.get("https://example.com/link-obj", { headers: {
|
65
|
+
"Content-Type": "text/html; charset=utf-8",
|
66
|
+
Link: "<https://example.com/object>; rel=\"alternate\"; type=\"application/activity+json\""
|
67
|
+
} });
|
68
|
+
esm_default.get("https://example.com/link-obj-relative", { headers: {
|
69
|
+
"Content-Type": "text/html; charset=utf-8",
|
70
|
+
Link: "</object>; rel=\"alternate\"; type=\"application/activity+json\""
|
71
|
+
} });
|
72
|
+
esm_default.get("https://example.com/obj-w-wrong-link", {
|
73
|
+
body: {
|
74
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
75
|
+
id: "https://example.com/obj-w-wrong-link",
|
76
|
+
name: "Fetched object",
|
77
|
+
type: "Object"
|
78
|
+
},
|
85
79
|
headers: {
|
86
80
|
"Content-Type": "text/html; charset=utf-8",
|
87
81
|
Link: "<https://example.com/object>; rel=\"alternate\"; type=\"application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"\""
|
88
82
|
}
|
89
|
-
})
|
83
|
+
});
|
90
84
|
await t.step("Link header", async () => {
|
91
85
|
assertEquals(await fetchDocumentLoader("https://example.com/link-ctx"), {
|
92
86
|
contextUrl: "https://www.w3.org/ns/activitystreams",
|
@@ -141,7 +135,8 @@ test("getDocumentLoader()", async (t) => {
|
|
141
135
|
}
|
142
136
|
});
|
143
137
|
});
|
144
|
-
|
138
|
+
esm_default.get("https://example.com/html-link", {
|
139
|
+
body: `<html>
|
145
140
|
<head>
|
146
141
|
<meta charset=utf-8>
|
147
142
|
<link
|
@@ -149,10 +144,9 @@ test("getDocumentLoader()", async (t) => {
|
|
149
144
|
type='application/activity+json'
|
150
145
|
href="https://example.com/object">
|
151
146
|
</head>
|
152
|
-
</html>`,
|
153
|
-
status: 200,
|
147
|
+
</html>`,
|
154
148
|
headers: { "Content-Type": "text/html; charset=utf-8" }
|
155
|
-
})
|
149
|
+
});
|
156
150
|
await t.step("HTML <link>", async () => {
|
157
151
|
assertEquals(await fetchDocumentLoader("https://example.com/html-link"), {
|
158
152
|
contextUrl: null,
|
@@ -165,7 +159,8 @@ test("getDocumentLoader()", async (t) => {
|
|
165
159
|
}
|
166
160
|
});
|
167
161
|
});
|
168
|
-
|
162
|
+
esm_default.get("https://example.com/html-a", {
|
163
|
+
body: `<html>
|
169
164
|
<head>
|
170
165
|
<meta charset=utf-8>
|
171
166
|
</head>
|
@@ -175,10 +170,9 @@ test("getDocumentLoader()", async (t) => {
|
|
175
170
|
type=application/activity+json
|
176
171
|
href=https://example.com/object>test</a>
|
177
172
|
</body>
|
178
|
-
</html>`,
|
179
|
-
status: 200,
|
173
|
+
</html>`,
|
180
174
|
headers: { "Content-Type": "text/html; charset=utf-8" }
|
181
|
-
})
|
175
|
+
});
|
182
176
|
await t.step("HTML <a>", async () => {
|
183
177
|
assertEquals(await fetchDocumentLoader("https://example.com/html-a"), {
|
184
178
|
contextUrl: null,
|
@@ -191,15 +185,15 @@ test("getDocumentLoader()", async (t) => {
|
|
191
185
|
}
|
192
186
|
});
|
193
187
|
});
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
188
|
+
esm_default.get("https://example.com/wrong-content-type", {
|
189
|
+
body: {
|
190
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
191
|
+
id: "https://example.com/wrong-content-type",
|
192
|
+
name: "Fetched object",
|
193
|
+
type: "Object"
|
194
|
+
},
|
201
195
|
headers: { "Content-Type": "text/html; charset=utf-8" }
|
202
|
-
})
|
196
|
+
});
|
203
197
|
await t.step("Wrong Content-Type", async () => {
|
204
198
|
assertEquals(await fetchDocumentLoader("https://example.com/wrong-content-type"), {
|
205
199
|
contextUrl: null,
|
@@ -212,7 +206,7 @@ test("getDocumentLoader()", async (t) => {
|
|
212
206
|
}
|
213
207
|
});
|
214
208
|
});
|
215
|
-
|
209
|
+
esm_default.get("https://example.com/404", { status: 404 });
|
216
210
|
await t.step("not ok", async () => {
|
217
211
|
await assertRejects(() => fetchDocumentLoader("https://example.com/404"), FetchError, "HTTP 404: https://example.com/404");
|
218
212
|
});
|
@@ -226,8 +220,12 @@ test("getDocumentLoader()", async (t) => {
|
|
226
220
|
await t.step("deny non-HTTP/HTTPS", async () => {
|
227
221
|
await assertRejects(() => fetchDocumentLoader("ftp://localhost"), UrlError);
|
228
222
|
});
|
229
|
-
|
230
|
-
|
223
|
+
esm_default.get("https://example.com/localhost-redirect", {
|
224
|
+
status: 302,
|
225
|
+
headers: { Location: "https://localhost/object" }
|
226
|
+
});
|
227
|
+
esm_default.get("https://example.com/localhost-link", {
|
228
|
+
body: `<html>
|
231
229
|
<head>
|
232
230
|
<meta charset=utf-8>
|
233
231
|
<link
|
@@ -235,10 +233,15 @@ test("getDocumentLoader()", async (t) => {
|
|
235
233
|
type='application/activity+json'
|
236
234
|
href="https://localhost/object">
|
237
235
|
</head>
|
238
|
-
</html>`,
|
239
|
-
status: 200,
|
236
|
+
</html>`,
|
240
237
|
headers: { "Content-Type": "text/html; charset=utf-8" }
|
241
|
-
})
|
238
|
+
});
|
239
|
+
esm_default.get("https://localhost/object", { body: {
|
240
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
241
|
+
id: "https://localhost/object",
|
242
|
+
name: "Fetched object",
|
243
|
+
type: "Object"
|
244
|
+
} });
|
242
245
|
await t.step("allowPrivateAddress: false", async () => {
|
243
246
|
await assertRejects(() => fetchDocumentLoader("https://localhost/object"), UrlError);
|
244
247
|
await assertRejects(() => fetchDocumentLoader("https://example.com/localhost-redirect"), UrlError);
|
@@ -251,7 +254,7 @@ test("getDocumentLoader()", async (t) => {
|
|
251
254
|
documentUrl: "https://localhost/object",
|
252
255
|
document: {
|
253
256
|
"@context": "https://www.w3.org/ns/activitystreams",
|
254
|
-
id: "https://
|
257
|
+
id: "https://localhost/object",
|
255
258
|
name: "Fetched object",
|
256
259
|
type: "Object"
|
257
260
|
}
|
@@ -260,7 +263,7 @@ test("getDocumentLoader()", async (t) => {
|
|
260
263
|
assertEquals(await fetchDocumentLoader2("https://example.com/localhost-redirect"), expected);
|
261
264
|
assertEquals(await fetchDocumentLoader2("https://example.com/localhost-link"), expected);
|
262
265
|
});
|
263
|
-
|
266
|
+
esm_default.hardReset();
|
264
267
|
});
|
265
268
|
test("kvCache()", async (t) => {
|
266
269
|
const kv = new MemoryKvStore();
|
package/dist/runtime/key.test.js
CHANGED
@@ -3,24 +3,24 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { assertEquals } from "../assert_equals-
|
7
|
-
import "../assert-
|
8
|
-
import "../assert_instance_of
|
9
|
-
import "../docloader-
|
6
|
+
import { assertEquals } from "../assert_equals-Dnj7ejjL.js";
|
7
|
+
import "../assert-YJk-1DlZ.js";
|
8
|
+
import "../assert_instance_of-DBIoG5k7.js";
|
9
|
+
import "../docloader-BXc5egq6.js";
|
10
10
|
import "../url-kTAI6_KP.js";
|
11
11
|
import "../multibase-DeCHcK8L.js";
|
12
|
-
import { exportMultibaseKey, exportSpki, importMultibaseKey, importPem, importPkcs1, importSpki } from "../vocab-
|
12
|
+
import { exportMultibaseKey, exportSpki, importMultibaseKey, importPem, importPkcs1, importSpki } from "../vocab-CaZSjoCB.js";
|
13
13
|
import "../langstr-DbWheeIS.js";
|
14
|
-
import "../lookup-
|
14
|
+
import "../lookup-Ds1_3qy2.js";
|
15
15
|
import "../type-D2s5lmbZ.js";
|
16
|
-
import "../actor-
|
17
|
-
import { exportJwk, importJwk } from "../key-
|
16
|
+
import "../actor-DezwbbQX.js";
|
17
|
+
import { exportJwk, importJwk } from "../key-D0WW7EHK.js";
|
18
18
|
import { test } from "../testing-jcGLO9Lp.js";
|
19
|
-
import "../std__assert-
|
20
|
-
import "../assert_rejects-
|
21
|
-
import "../assert_is_error-
|
22
|
-
import "../assert_not_equals-
|
23
|
-
import "../assert_throws-
|
19
|
+
import "../std__assert-CHXwj7zk.js";
|
20
|
+
import "../assert_rejects-BZjUwo62.js";
|
21
|
+
import "../assert_is_error-jyzqjHud.js";
|
22
|
+
import "../assert_not_equals-wx-SRs4i.js";
|
23
|
+
import "../assert_throws-gBPv3v2V.js";
|
24
24
|
|
25
25
|
//#region runtime/key.test.ts
|
26
26
|
const rsaSpki = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxsRuvCkgJtflBTl4OVsm\nnt/J1mQfZasfJtN33dcZ3d1lJroxmgmMu69zjGEAwkNbMQaWNLqC4eogkJaeJ4RR\n5MHYXkL9nNilVoTkjX5BVit3puzs7XJ7WQnKQgQMI+ezn24GHsZ/v1JIo77lerX5\nk4HNwTNVt+yaZVQWaOMR3+6FwziQR6kd0VuG9/a9dgAnz2cEoORRC1i4W7IZaB1s\nZnh1WbHbevlGd72HSXll5rocPIHn8gq6xpBgpHwRphlRsgn4KHaJ6brXDIJjrnQh\nIe/YUBOGj/ImSEXhRwlFerKsoAVnZ0Hwbfa46qk44TAt8CyoPMWmpK6pt0ng4pQ2\nuwIDAQAB\n-----END PUBLIC KEY-----\n";
|
@@ -3,16 +3,16 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { assertEquals } from "../assert_equals-
|
7
|
-
import "../assert-
|
8
|
-
import "../assert_instance_of
|
6
|
+
import { assertEquals } from "../assert_equals-Dnj7ejjL.js";
|
7
|
+
import "../assert-YJk-1DlZ.js";
|
8
|
+
import "../assert_instance_of-DBIoG5k7.js";
|
9
9
|
import { LanguageString } from "../langstr-DbWheeIS.js";
|
10
10
|
import { test } from "../testing-jcGLO9Lp.js";
|
11
|
-
import "../std__assert-
|
12
|
-
import "../assert_rejects-
|
13
|
-
import "../assert_is_error-
|
14
|
-
import "../assert_not_equals-
|
15
|
-
import "../assert_throws-
|
11
|
+
import "../std__assert-CHXwj7zk.js";
|
12
|
+
import "../assert_rejects-BZjUwo62.js";
|
13
|
+
import "../assert_is_error-jyzqjHud.js";
|
14
|
+
import "../assert_not_equals-wx-SRs4i.js";
|
15
|
+
import "../assert_throws-gBPv3v2V.js";
|
16
16
|
import { parseLanguageTag } from "@phensley/language-tag";
|
17
17
|
import util from "node:util";
|
18
18
|
|
package/dist/runtime/mod.d.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
3
|
-
import "../kv-
|
4
|
-
import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, DocumentLoaderFactoryOptions, FetchError
|
5
|
-
import { LanguageString
|
6
|
-
import "../http-
|
7
|
-
import { GetAuthenticatedDocumentLoaderOptions, exportMultibaseKey, exportSpki, getAuthenticatedDocumentLoader, importMultibaseKey, importPem, importPkcs1, importSpki } from "../mod-
|
3
|
+
import "../kv-p8sC8PTT.js";
|
4
|
+
import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, DocumentLoaderFactoryOptions, FetchError, GetDocumentLoaderOptions, GetUserAgentOptions, KvCacheParameters, RemoteDocument, fetchDocumentLoader, getDocumentLoader, getUserAgent, kvCache } from "../docloader-DlUDOVSe.js";
|
5
|
+
import { LanguageString } from "../vocab-DSFLLLe6.js";
|
6
|
+
import "../http-BkUCISGt.js";
|
7
|
+
import { GetAuthenticatedDocumentLoaderOptions, exportMultibaseKey, exportSpki, getAuthenticatedDocumentLoader, importMultibaseKey, importPem, importPkcs1, importSpki } from "../mod-BTHfUeLo.js";
|
8
8
|
export { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, DocumentLoaderFactoryOptions, FetchError, GetAuthenticatedDocumentLoaderOptions, GetDocumentLoaderOptions, GetUserAgentOptions, KvCacheParameters, LanguageString, RemoteDocument, exportMultibaseKey, exportSpki, fetchDocumentLoader, getAuthenticatedDocumentLoader, getDocumentLoader, getUserAgent, importMultibaseKey, importPem, importPkcs1, importSpki, kvCache };
|
package/dist/runtime/mod.js
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
|
-
import { FetchError, fetchDocumentLoader, getDocumentLoader, getUserAgent, kvCache } from "../docloader-
|
6
|
-
import { LanguageString, exportMultibaseKey
|
7
|
-
import "../lookup-
|
8
|
-
import "../key-
|
9
|
-
import "../http-
|
10
|
-
import { getAuthenticatedDocumentLoader
|
5
|
+
import { FetchError, fetchDocumentLoader, getDocumentLoader, getUserAgent, kvCache } from "../docloader-BFRgyDAa.js";
|
6
|
+
import { LanguageString, exportMultibaseKey, exportSpki, importMultibaseKey, importPem, importPkcs1, importSpki } from "../actor-CwAL6Q82.js";
|
7
|
+
import "../lookup-C8V37GPa.js";
|
8
|
+
import "../key-CD8i4ZB_.js";
|
9
|
+
import "../http-DC3mY9EG.js";
|
10
|
+
import { getAuthenticatedDocumentLoader } from "../authdocloader-Df1y1MKv.js";
|
11
11
|
import "../runtime-BSkOVUWM.js";
|
12
12
|
|
13
13
|
export { FetchError, LanguageString, exportMultibaseKey, exportSpki, fetchDocumentLoader, getAuthenticatedDocumentLoader, getDocumentLoader, getUserAgent, importMultibaseKey, importPem, importPkcs1, importSpki, kvCache };
|
@@ -3,16 +3,16 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { assertEquals } from "../../assert_equals-
|
7
|
-
import "../../assert-
|
8
|
-
import "../../assert_instance_of
|
6
|
+
import { assertEquals } from "../../assert_equals-Dnj7ejjL.js";
|
7
|
+
import "../../assert-YJk-1DlZ.js";
|
8
|
+
import "../../assert_instance_of-DBIoG5k7.js";
|
9
9
|
import { codes, decode, decodeText, encode, encodeText, names } from "../../multibase-DeCHcK8L.js";
|
10
10
|
import { test } from "../../testing-jcGLO9Lp.js";
|
11
|
-
import "../../std__assert-
|
12
|
-
import "../../assert_rejects-
|
13
|
-
import "../../assert_is_error-
|
14
|
-
import "../../assert_not_equals-
|
15
|
-
import "../../assert_throws-
|
11
|
+
import "../../std__assert-CHXwj7zk.js";
|
12
|
+
import "../../assert_rejects-BZjUwo62.js";
|
13
|
+
import "../../assert_is_error-jyzqjHud.js";
|
14
|
+
import "../../assert_not_equals-wx-SRs4i.js";
|
15
|
+
import "../../assert_throws-gBPv3v2V.js";
|
16
16
|
|
17
17
|
//#region runtime/multibase/multibase.test.ts
|
18
18
|
test("multibase.encode and decode", async (t) => {
|
package/dist/runtime/url.test.js
CHANGED
@@ -3,12 +3,12 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { assertEquals } from "../assert_equals-
|
7
|
-
import { assert } from "../assert-
|
6
|
+
import { assertEquals } from "../assert_equals-Dnj7ejjL.js";
|
7
|
+
import { assert } from "../assert-YJk-1DlZ.js";
|
8
8
|
import { UrlError, expandIPv6Address, isValidPublicIPv4Address, isValidPublicIPv6Address, validatePublicUrl } from "../url-kTAI6_KP.js";
|
9
9
|
import { test } from "../testing-jcGLO9Lp.js";
|
10
|
-
import { assertFalse, assertRejects } from "../assert_rejects-
|
11
|
-
import "../assert_is_error-
|
10
|
+
import { assertFalse, assertRejects } from "../assert_rejects-BZjUwo62.js";
|
11
|
+
import "../assert_is_error-jyzqjHud.js";
|
12
12
|
|
13
13
|
//#region runtime/url.test.ts
|
14
14
|
test("validatePublicUrl()", async () => {
|
@@ -3,8 +3,8 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { deno_default } from "./docloader-
|
7
|
-
import { doubleKnock } from "./http-
|
6
|
+
import { deno_default } from "./docloader-BXc5egq6.js";
|
7
|
+
import { doubleKnock } from "./http-3CJyDlPz.js";
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
9
9
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
10
10
|
|
@@ -27,7 +27,7 @@ function extractInboxes({ recipients, preferSharedInbox, excludeBaseUris }) {
|
|
27
27
|
if (inbox != null && recipient.id != null) {
|
28
28
|
if (excludeBaseUris != null && excludeBaseUris.some((u) => u.origin === inbox?.origin)) continue;
|
29
29
|
inboxes[inbox.href] ??= {
|
30
|
-
actorIds: new Set(),
|
30
|
+
actorIds: /* @__PURE__ */ new Set(),
|
31
31
|
sharedInbox
|
32
32
|
};
|
33
33
|
inboxes[inbox.href].actorIds.add(recipient.id.href);
|
package/dist/sig/http.test.js
CHANGED
@@ -3,28 +3,28 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { assertEquals } from "../assert_equals-
|
7
|
-
import { assert } from "../assert-
|
8
|
-
import "../assert_instance_of
|
9
|
-
import "../docloader-
|
6
|
+
import { assertEquals } from "../assert_equals-Dnj7ejjL.js";
|
7
|
+
import { assert } from "../assert-YJk-1DlZ.js";
|
8
|
+
import "../assert_instance_of-DBIoG5k7.js";
|
9
|
+
import "../docloader-BXc5egq6.js";
|
10
10
|
import "../url-kTAI6_KP.js";
|
11
11
|
import "../multibase-DeCHcK8L.js";
|
12
|
-
import { exportSpki } from "../vocab-
|
12
|
+
import { exportSpki } from "../vocab-CaZSjoCB.js";
|
13
13
|
import "../langstr-DbWheeIS.js";
|
14
|
-
import "../lookup-
|
14
|
+
import "../lookup-Ds1_3qy2.js";
|
15
15
|
import "../type-D2s5lmbZ.js";
|
16
|
-
import "../actor-
|
17
|
-
import { exportJwk } from "../key-
|
18
|
-
import { createRfc9421SignatureBase, doubleKnock, formatRfc9421Signature, formatRfc9421SignatureParameters, parseRfc9421Signature, parseRfc9421SignatureInput, signRequest, timingSafeEqual, verifyRequest } from "../http-
|
16
|
+
import "../actor-DezwbbQX.js";
|
17
|
+
import { exportJwk } from "../key-D0WW7EHK.js";
|
18
|
+
import { createRfc9421SignatureBase, doubleKnock, formatRfc9421Signature, formatRfc9421SignatureParameters, parseRfc9421Signature, parseRfc9421SignatureInput, signRequest, timingSafeEqual, verifyRequest } from "../http-3CJyDlPz.js";
|
19
19
|
import { test } from "../testing-jcGLO9Lp.js";
|
20
|
-
import { assertExists, assertStringIncludes } from "../std__assert-
|
21
|
-
import { assertFalse } from "../assert_rejects-
|
22
|
-
import "../assert_is_error-
|
23
|
-
import "../assert_not_equals-
|
24
|
-
import "../assert_throws-
|
20
|
+
import { assertExists, assertStringIncludes } from "../std__assert-CHXwj7zk.js";
|
21
|
+
import { assertFalse } from "../assert_rejects-BZjUwo62.js";
|
22
|
+
import "../assert_is_error-jyzqjHud.js";
|
23
|
+
import "../assert_not_equals-wx-SRs4i.js";
|
24
|
+
import "../assert_throws-gBPv3v2V.js";
|
25
25
|
import { mockDocumentLoader } from "../docloader-09nVWLAZ.js";
|
26
|
-
import { rsaPrivateKey2, rsaPublicKey1, rsaPublicKey2, rsaPublicKey5 } from "../keys-
|
27
|
-
import {
|
26
|
+
import { rsaPrivateKey2, rsaPublicKey1, rsaPublicKey2, rsaPublicKey5 } from "../keys-BIY57kjo.js";
|
27
|
+
import { esm_default } from "../esm-Btx3E8og.js";
|
28
28
|
import { encodeBase64 } from "byte-encodings/base64";
|
29
29
|
|
30
30
|
//#region sig/http.test.ts
|
@@ -624,11 +624,12 @@ test("verifyRequest() [rfc9421] test vector from Mastodon", async () => {
|
|
624
624
|
assertEquals(await exportSpki(result2.publicKey), await exportSpki(rsaPublicKey5.publicKey));
|
625
625
|
});
|
626
626
|
test("doubleKnock() function with successful first attempt", async () => {
|
627
|
-
|
627
|
+
esm_default.spyGlobal();
|
628
628
|
let requestCount = 0;
|
629
629
|
let firstRequestSpec = null;
|
630
|
-
|
630
|
+
esm_default.post("https://example.com/inbox-accepts-rfc9421", (cl) => {
|
631
631
|
requestCount++;
|
632
|
+
const req = cl.request;
|
632
633
|
const signatureInputHeader = req.headers.get("Signature-Input");
|
633
634
|
const signatureHeader = req.headers.get("Signature");
|
634
635
|
if (signatureInputHeader && signatureHeader) {
|
@@ -668,14 +669,15 @@ test("doubleKnock() function with successful first attempt", async () => {
|
|
668
669
|
assertExists(loggedRequest, "Request should be logged");
|
669
670
|
assert(loggedRequest?.headers.has("Signature-Input"), "Logged request should have RFC 9421 Signature-Input header");
|
670
671
|
assert(loggedRequest?.headers.has("Signature"), "Logged request should have RFC 9421 Signature header");
|
671
|
-
|
672
|
+
esm_default.hardReset();
|
672
673
|
});
|
673
674
|
test("doubleKnock() function with fallback to draft-cavage", async () => {
|
674
|
-
|
675
|
+
esm_default.spyGlobal();
|
675
676
|
let requestCount = 0;
|
676
677
|
let firstSpec = null;
|
677
678
|
let secondSpec = null;
|
678
|
-
|
679
|
+
esm_default.post("https://example.com/inbox-accepts-draft-cavage", (cl) => {
|
680
|
+
const req = cl.request;
|
679
681
|
requestCount++;
|
680
682
|
if (req.headers.has("Signature-Input")) {
|
681
683
|
firstSpec = "rfc9421";
|
@@ -711,19 +713,19 @@ test("doubleKnock() function with fallback to draft-cavage", async () => {
|
|
711
713
|
assertEquals(secondSpec, "draft-cavage-http-signatures-12", "Second attempt should use draft-cavage");
|
712
714
|
assertEquals(specDeterminer.rememberedOrigin, "https://example.com", "Origin should be remembered");
|
713
715
|
assertEquals(specDeterminer.rememberedSpec, "draft-cavage-http-signatures-12", "Successful spec should be remembered");
|
714
|
-
|
716
|
+
esm_default.hardReset();
|
715
717
|
});
|
716
718
|
test("doubleKnock() function with redirect handling", async () => {
|
717
|
-
|
719
|
+
esm_default.spyGlobal();
|
718
720
|
const requestedUrls = [];
|
719
721
|
const responseCodes = [];
|
720
|
-
|
721
|
-
requestedUrls.push(
|
722
|
+
esm_default.post("https://example.com/redirect-endpoint", (cl) => {
|
723
|
+
requestedUrls.push(cl.url);
|
722
724
|
responseCodes.push(302);
|
723
725
|
return Response.redirect("https://example.com/final-endpoint", 302);
|
724
726
|
});
|
725
|
-
|
726
|
-
requestedUrls.push(
|
727
|
+
esm_default.post("https://example.com/final-endpoint", (cl) => {
|
728
|
+
requestedUrls.push(cl.url);
|
727
729
|
responseCodes.push(202);
|
728
730
|
return new Response("", { status: 202 });
|
729
731
|
});
|
@@ -741,13 +743,14 @@ test("doubleKnock() function with redirect handling", async () => {
|
|
741
743
|
assertEquals(requestedUrls[0], "https://example.com/redirect-endpoint", "First request should be to redirect-endpoint");
|
742
744
|
assertEquals(requestedUrls[1], "https://example.com/final-endpoint", "Second request should be to final-endpoint");
|
743
745
|
assertEquals(responseCodes, [302, 202], "Response status codes should match expected sequence");
|
744
|
-
|
746
|
+
esm_default.hardReset();
|
745
747
|
});
|
746
748
|
test("doubleKnock() function with both specs rejected", async () => {
|
747
|
-
|
749
|
+
esm_default.spyGlobal();
|
748
750
|
let requestCount = 0;
|
749
751
|
const attempts = [];
|
750
|
-
|
752
|
+
esm_default.post("https://example.com/inbox-rejects-all", (cl) => {
|
753
|
+
const req = cl.request;
|
751
754
|
requestCount++;
|
752
755
|
if (req.headers.has("Signature-Input")) attempts.push("rfc9421");
|
753
756
|
else if (req.headers.has("Signature")) attempts.push("draft-cavage");
|
@@ -768,13 +771,14 @@ test("doubleKnock() function with both specs rejected", async () => {
|
|
768
771
|
assertEquals(attempts.length, 2, "Two signature attempts should have been made");
|
769
772
|
assertEquals(attempts[0], "rfc9421", "First attempt should use RFC 9421");
|
770
773
|
assertEquals(attempts[1], "draft-cavage", "Second attempt should use draft-cavage");
|
771
|
-
|
774
|
+
esm_default.hardReset();
|
772
775
|
});
|
773
776
|
test("doubleKnock() function with specDeterminer choosing draft-cavage first", async () => {
|
774
|
-
|
777
|
+
esm_default.spyGlobal();
|
775
778
|
let requestCount = 0;
|
776
779
|
let firstSpec = null;
|
777
|
-
|
780
|
+
esm_default.post("https://example.com/inbox-accepts-any", (cl) => {
|
781
|
+
const req = cl.request;
|
778
782
|
requestCount++;
|
779
783
|
if (req.headers.has("Signature-Input")) firstSpec = "rfc9421";
|
780
784
|
else if (req.headers.has("Signature")) firstSpec = "draft-cavage";
|
@@ -798,25 +802,25 @@ test("doubleKnock() function with specDeterminer choosing draft-cavage first", a
|
|
798
802
|
assertEquals(response.status, 202, "Response status should be 202 Accepted");
|
799
803
|
assertEquals(requestCount, 1, "Only one request should have been made");
|
800
804
|
assertEquals(firstSpec, "draft-cavage", "First attempt should use draft-cavage");
|
801
|
-
|
805
|
+
esm_default.hardReset();
|
802
806
|
});
|
803
807
|
test("doubleKnock() complex redirect chain test", async () => {
|
804
|
-
|
808
|
+
esm_default.spyGlobal();
|
805
809
|
const requestedUrls = [];
|
806
|
-
|
807
|
-
requestedUrls.push(
|
810
|
+
esm_default.post("https://example.com/redirect1", (cl) => {
|
811
|
+
requestedUrls.push(cl.url);
|
808
812
|
return Response.redirect("https://example.com/redirect2", 302);
|
809
813
|
});
|
810
|
-
|
811
|
-
requestedUrls.push(
|
814
|
+
esm_default.post("https://example.com/redirect2", (cl) => {
|
815
|
+
requestedUrls.push(cl.url);
|
812
816
|
return Response.redirect("https://example.com/redirect3", 307);
|
813
817
|
});
|
814
|
-
|
815
|
-
requestedUrls.push(
|
818
|
+
esm_default.post("https://example.com/redirect3", (cl) => {
|
819
|
+
requestedUrls.push(cl.url);
|
816
820
|
return Response.redirect("https://example.com/final", 301);
|
817
821
|
});
|
818
|
-
|
819
|
-
requestedUrls.push(
|
822
|
+
esm_default.post("https://example.com/final", (cl) => {
|
823
|
+
requestedUrls.push(cl.url);
|
820
824
|
return new Response("Success", { status: 200 });
|
821
825
|
});
|
822
826
|
const request = new Request("https://example.com/redirect1", {
|
@@ -841,13 +845,14 @@ test("doubleKnock() complex redirect chain test", async () => {
|
|
841
845
|
assertEquals(requestedUrls[3], "https://example.com/final", "Fourth request should be to final");
|
842
846
|
assertEquals(logs.length, 4, "Four requests should have been logged");
|
843
847
|
for (const loggedReq of logs) assert(loggedReq.headers.has("Signature-Input") || loggedReq.headers.has("Signature"), "Each request should be signed with either RFC 9421 or draft-cavage");
|
844
|
-
|
848
|
+
esm_default.hardReset();
|
845
849
|
});
|
846
850
|
test("doubleKnock() async specDeterminer test", async () => {
|
847
|
-
|
851
|
+
esm_default.spyGlobal();
|
848
852
|
let requestCount = 0;
|
849
853
|
let specUsed = null;
|
850
|
-
|
854
|
+
esm_default.post("https://example.com/inbox-async-determiner", (cl) => {
|
855
|
+
const req = cl.request;
|
851
856
|
requestCount++;
|
852
857
|
if (req.headers.has("Signature-Input")) specUsed = "rfc9421";
|
853
858
|
else if (req.headers.has("Signature")) specUsed = "draft-cavage-http-signatures-12";
|
@@ -874,7 +879,7 @@ test("doubleKnock() async specDeterminer test", async () => {
|
|
874
879
|
assertEquals(response.status, 202, "Response status should be 202 Accepted");
|
875
880
|
assertEquals(requestCount, 1, "Only one request should have been made");
|
876
881
|
assertEquals(specUsed, "draft-cavage-http-signatures-12", "Should use spec from async determiner");
|
877
|
-
|
882
|
+
esm_default.hardReset();
|
878
883
|
});
|
879
884
|
test("timingSafeEqual()", async (t) => {
|
880
885
|
await t.step("should return true for equal empty arrays", () => {
|