@fedify/fedify 2.4.0-dev.2253 → 2.4.0-dev.2256

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.
Files changed (89) hide show
  1. package/dist/{builder-DdUWFCwL.mjs → builder-DvSQqk2l.mjs} +2 -2
  2. package/dist/compat/transformers.test.mjs +1 -1
  3. package/dist/{compound-proof-CcWDD5VB.mjs → compound-proof-5bg_j_ye.mjs} +2 -2
  4. package/dist/{deno-D9uhdIuD.mjs → deno-AmcRMq5z.mjs} +1 -1
  5. package/dist/{docloader-fbmPhCdS.mjs → docloader-CIP_SG39.mjs} +2 -2
  6. package/dist/federation/builder.test.mjs +1 -1
  7. package/dist/federation/compound-fanout.test.mjs +3 -3
  8. package/dist/federation/handler-compound-proof.test.mjs +3 -3
  9. package/dist/federation/handler.test.mjs +5 -5
  10. package/dist/federation/hashlink-media.test.mjs +2 -2
  11. package/dist/federation/idempotency.test.mjs +2 -2
  12. package/dist/federation/metrics.test.mjs +1 -1
  13. package/dist/federation/middleware.test.mjs +7 -7
  14. package/dist/federation/mod.cjs +1 -1
  15. package/dist/federation/mod.js +1 -1
  16. package/dist/federation/outgoing-proof.test.mjs +5 -5
  17. package/dist/federation/portable-actor.test.mjs +3 -3
  18. package/dist/federation/portable-chain.test.mjs +3 -3
  19. package/dist/federation/portable-collection.test.mjs +4 -4
  20. package/dist/federation/portable-delivery.test.mjs +2 -2
  21. package/dist/federation/portable-gateway-keys.test.mjs +4 -4
  22. package/dist/federation/portable-inbox.test.mjs +4 -4
  23. package/dist/federation/portable-parse-uri.test.mjs +1 -1
  24. package/dist/federation/portable-route-activity.test.mjs +2 -2
  25. package/dist/federation/portable.test.mjs +3 -3
  26. package/dist/federation/send.test.mjs +3 -3
  27. package/dist/federation/tasks/enqueue.test.mjs +1 -1
  28. package/dist/federation/tasks/tasks.test.mjs +2 -2
  29. package/dist/federation/temporal.test.mjs +1 -1
  30. package/dist/federation/webfinger.test.mjs +1 -1
  31. package/dist/{federation-B858-Ylk.cjs → federation-BDzIgqOd.cjs} +3 -3
  32. package/dist/{http-Bp0MKAK3.cjs → http-1fZ83jj7.cjs} +10 -7
  33. package/dist/{http-BoGE-nk7.js → http-BGb3QioZ.js} +10 -7
  34. package/dist/{http-CUyBaVsQ.mjs → http-DkqWu-sm.mjs} +4 -4
  35. package/dist/{key-BlTaKABr.mjs → key-CEsu7oaD.mjs} +2 -2
  36. package/dist/{kv-cache-BnWemxH2.cjs → kv-cache-BEWuZSB4.cjs} +1 -1
  37. package/dist/{kv-cache-DhMzUXEE.js → kv-cache-CGhEgt98.js} +1 -1
  38. package/dist/{kv-cache-Dmqd7s2a.mjs → kv-cache-CJS4mImS.mjs} +1 -1
  39. package/dist/{ld-Dx8r_qJU.mjs → ld-Cf4CPWN_.mjs} +3 -3
  40. package/dist/{metrics-DFkZkLrO.mjs → metrics-CocsZP0E.mjs} +1 -1
  41. package/dist/{middleware-DC018B4u.js → middleware-BfYke3YQ.js} +3 -3
  42. package/dist/{middleware-BNhF-Ayx.mjs → middleware-Cne_jMZo.mjs} +1 -1
  43. package/dist/{middleware-B0RRI88k.mjs → middleware-Dxn0E9ES.mjs} +14 -14
  44. package/dist/{mod-Cy9VNHVw.d.ts → mod-BlLwewYe.d.ts} +2 -0
  45. package/dist/{mod-DoTWIc7F.d.cts → mod-VHYh1lTK.d.cts} +2 -0
  46. package/dist/mod.cjs +4 -4
  47. package/dist/mod.d.cts +1 -1
  48. package/dist/mod.d.ts +1 -1
  49. package/dist/mod.js +4 -4
  50. package/dist/nodeinfo/handler.test.mjs +1 -1
  51. package/dist/{owner-B61jjp5K.mjs → owner-DSJ7nFgy.mjs} +3 -3
  52. package/dist/{portable-collection-BnktjQ04.js → portable-collection-BuBV6xTo.js} +1 -1
  53. package/dist/{portable-collection-CyBJDEzs.mjs → portable-collection-qskqXJrH.mjs} +2 -2
  54. package/dist/{portable-collection-DhEA_nWT.cjs → portable-collection-r-mHg1PV.cjs} +1 -1
  55. package/dist/{portable-key-CPN0QZSA.mjs → portable-key-woGH_1nn.mjs} +1 -1
  56. package/dist/{proof-CZrjvoJ3.mjs → proof-8WiH_-Gq.mjs} +13 -10
  57. package/dist/{send-enxOnmZo.mjs → send-JKzZBgPU.mjs} +3 -3
  58. package/dist/sig/compound-proof-discovery.test.mjs +1 -1
  59. package/dist/sig/compound-proof-producer.test.mjs +1 -1
  60. package/dist/sig/compound-proof-verification.test.mjs +2 -2
  61. package/dist/sig/compound-proof.test.mjs +2 -2
  62. package/dist/sig/http.test.mjs +2 -2
  63. package/dist/sig/key.test.mjs +1 -1
  64. package/dist/sig/ld.test.mjs +2 -2
  65. package/dist/sig/mitra-receive-interop.test.d.mts +2 -0
  66. package/dist/sig/mitra-receive-interop.test.mjs +260 -0
  67. package/dist/sig/mitra-send-interop.test.d.mts +2 -0
  68. package/dist/sig/mitra-send-interop.test.mjs +461 -0
  69. package/dist/sig/mod.cjs +2 -2
  70. package/dist/sig/mod.d.cts +1 -1
  71. package/dist/sig/mod.d.ts +1 -1
  72. package/dist/sig/mod.js +2 -2
  73. package/dist/sig/owner.test.mjs +1 -1
  74. package/dist/sig/portable-collection.test.mjs +1 -1
  75. package/dist/sig/portable-interop.test.d.mts +2 -0
  76. package/dist/sig/portable-interop.test.mjs +156 -0
  77. package/dist/sig/portable-key.test.mjs +6 -6
  78. package/dist/sig/proof.test.mjs +88 -3
  79. package/dist/sig/tootik-request-interop.test.d.mts +2 -0
  80. package/dist/sig/tootik-request-interop.test.mjs +190 -0
  81. package/dist/sig/tootik-send-interop.test.d.mts +2 -0
  82. package/dist/sig/tootik-send-interop.test.mjs +331 -0
  83. package/dist/{temporal-CBVv0xRB.mjs → temporal-CT3fRaMH.mjs} +1 -1
  84. package/dist/testing/kv.test.mjs +1 -1
  85. package/dist/utils/docloader.test.mjs +2 -2
  86. package/dist/utils/kv-cache.test.mjs +1 -1
  87. package/dist/utils/mod.cjs +1 -1
  88. package/dist/utils/mod.js +1 -1
  89. package/package.json +7 -7
@@ -0,0 +1,156 @@
1
+ import "temporal-polyfill";
2
+ import "urlpattern-polyfill";
3
+ globalThis.addEventListener = () => {};
4
+ import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
5
+ import "../std__assert-DvMDRPes.mjs";
6
+ import { t as assert } from "../assert-D1Eafmd_.mjs";
7
+ import { c as verifyPortableObjectProof, d as verifyProof } from "../proof-8WiH_-Gq.mjs";
8
+ import { n as getKeyOwner } from "../owner-DSJ7nFgy.mjs";
9
+ import { t as verifyPortableObject } from "../portable-collection-qskqXJrH.mjs";
10
+ import { Application, DataIntegrityProof, lookupObject } from "@fedify/vocab";
11
+ import { mockDocumentLoader, test } from "@fedify/fixture";
12
+ //#region test-vectors/fep-ef61/tootik-v0.25.4/actor.json
13
+ var actor_default = {
14
+ "@context": [
15
+ "https://www.w3.org/ns/activitystreams",
16
+ "https://w3id.org/security/data-integrity/v1",
17
+ "https://w3id.org/security/v1"
18
+ ],
19
+ id: "https://tootik.example/.well-known/apgateway/did:key:z6MknxT9xX8cmnsEqBk2u74aYaGQNjVQL1eHxhn1qb27p5vE/actor",
20
+ type: "Application",
21
+ inbox: "https://tootik.example/.well-known/apgateway/did:key:z6MknxT9xX8cmnsEqBk2u74aYaGQNjVQL1eHxhn1qb27p5vE/actor/inbox",
22
+ outbox: "https://tootik.example/.well-known/apgateway/did:key:z6MknxT9xX8cmnsEqBk2u74aYaGQNjVQL1eHxhn1qb27p5vE/actor/outbox",
23
+ preferredUsername: "actor",
24
+ followers: "https://tootik.example/.well-known/apgateway/did:key:z6MknxT9xX8cmnsEqBk2u74aYaGQNjVQL1eHxhn1qb27p5vE/actor/followers",
25
+ publicKey: {
26
+ "id": "https://tootik.example/.well-known/apgateway/did:key:z6MknxT9xX8cmnsEqBk2u74aYaGQNjVQL1eHxhn1qb27p5vE/actor#main-key",
27
+ "owner": "https://tootik.example/.well-known/apgateway/did:key:z6MknxT9xX8cmnsEqBk2u74aYaGQNjVQL1eHxhn1qb27p5vE/actor",
28
+ "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr70sLuCyvDBKblca6Jsk\nJW5ZmTpmyFK4gY6dpDkjvsokBjTR6oUO5GF7QGT4xGaGDtnzhd+K0/IE2Jo2cbBu\nTAK92xo3qB4nL+0XIfqXK/ju/pIo4ClZ1oHYNeJnmjGDAJmZmaf9/b0sd0osfTPX\nWSqAkgZuxZYrWSXKs6WYuEJof5YfTHgH5PBzwtQGyexZKYkumyrq5lazeEvqBLyx\nyNc5u6LdkkHP+HR9DJIQ3CDv6d1yQ7ELiP5pXvKRV9jJKlBQ1TK1vlMGC8GcBlDy\nQT0UsbM/1lRbxnbbqiwY6rFlT6FpHd5cl9tblGU6sF9gyCDATCHAdZ/2laUzParD\n+QIDAQAB\n-----END PUBLIC KEY-----\n"
29
+ },
30
+ icon: [{
31
+ "type": "Image",
32
+ "mediaType": "image/gif",
33
+ "url": "https://tootik.example/.well-known/apgateway/did:key:z6MknxT9xX8cmnsEqBk2u74aYaGQNjVQL1eHxhn1qb27p5vE/actor/icon.gif"
34
+ }],
35
+ manuallyApprovesFollowers: false,
36
+ assertionMethod: [{
37
+ "id": "https://tootik.example/.well-known/apgateway/did:key:z6MknxT9xX8cmnsEqBk2u74aYaGQNjVQL1eHxhn1qb27p5vE/actor#ed25519-key",
38
+ "type": "Multikey",
39
+ "controller": "https://tootik.example/.well-known/apgateway/did:key:z6MknxT9xX8cmnsEqBk2u74aYaGQNjVQL1eHxhn1qb27p5vE/actor",
40
+ "publicKeyMultibase": "z6MknxT9xX8cmnsEqBk2u74aYaGQNjVQL1eHxhn1qb27p5vE"
41
+ }, {
42
+ "id": "https://tootik.example/.well-known/apgateway/did:key:z6MknxT9xX8cmnsEqBk2u74aYaGQNjVQL1eHxhn1qb27p5vE/actor#ml-dsa-44-key",
43
+ "type": "Multikey",
44
+ "controller": "https://tootik.example/.well-known/apgateway/did:key:z6Mkn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4uNEPyT3p_kv0smEGU3lzZERTYHPM-CNEF5Pk2rrVea9WxpC0TG2njHxmHsO0nCWmUgoB3cAMWpby-YBaen1xvXt5po7ge5KD3SC_cXMSLAJem_ZMVWtR070zXCJdsoB-GN8nFTchyjPpI6SLxXcVwWXNEzI_dEvcx0YTEwlI9OEDuF2rizU4UzZMIT_Ec5OgEehh-o0MLpgLRvLo15TOz0FFZfaKYWfVS6CEBxHg0g3XwmvbrhA47ZJNfLYniPV4K7ELTp3nsoe9xZo2yORy8KiYUV9AETu90oZd-ZnZG_J1IXY7HmzT3DQ5rXWRMHx1Uym_SU7TCk0hIvFpta012lS_Hv8OZ2cnXC70VUx8_LS27ICE4k6xJbwxZCZZ0oLZ_XSicvg9vOP_N7KWbR_Jc7sxjpIDc2IY9EUNn0FiGs6IDy-YJJ5kq31N0Di28uYuX910sAbymPGl--SD1feo4-SBXA9qejrfq85iHcgKWpOVmID1HxulHKZRcKM-T_TfEVlHUPvkiPo61xda2ak1ni05GpPc_iknAFUbM1D6eIh4mFSxdnLTDXVkvNByPb8QCaZCwOSiN5bDy-CvHseH7uuDrwilnqgMruLQmVj0oj2HM1vsjQqXMdVWi6dtfaj1qqyf8Cti_bt7m0qPKe4B6Mc9ALBFtk6gGLjAuygg4_WSCAr8WPnDjrLEI7Xmo_uFvPRsDEfQUCvXVP_vapaCr6vSPvQ-hJmXy2-u5qe"
46
+ }],
47
+ "implements": [
48
+ {
49
+ "href": "https://datatracker.ietf.org/doc/html/rfc9421",
50
+ "name": "RFC-9421: HTTP Message Signatures"
51
+ },
52
+ {
53
+ "href": "https://datatracker.ietf.org/doc/html/rfc9421#name-eddsa-using-curve-edwards25",
54
+ "name": "RFC-9421 signatures using the Ed25519 algorithm"
55
+ },
56
+ {
57
+ "href": "https://c2sp.org/httpsig-pq@v1.0.0#ml-dsa-44",
58
+ "name": "RFC-9421 signatures using the ml-dsa-44 algorithm"
59
+ }
60
+ ],
61
+ gateways: ["https://tootik.example"],
62
+ proof: {
63
+ "@context": [
64
+ "https://www.w3.org/ns/activitystreams",
65
+ "https://w3id.org/security/data-integrity/v1",
66
+ "https://w3id.org/security/v1"
67
+ ],
68
+ "type": "DataIntegrityProof",
69
+ "cryptosuite": "eddsa-jcs-2022",
70
+ "verificationMethod": "did:key:z6MknxT9xX8cmnsEqBk2u74aYaGQNjVQL1eHxhn1qb27p5vE#z6MknxT9xX8cmnsEqBk2u74aYaGQNjVQL1eHxhn1qb27p5vE",
71
+ "proofPurpose": "assertionMethod",
72
+ "proofValue": "zjGdNqPpqgx45ecMAz8jY3gVRrTphG5Cn7v9EiBKn7WyeHtdvTYPSkzyvWqZqfQuw92Kn3pD58qXw6wFTLAvkWee",
73
+ "created": "2026-09-30T11:57:45Z"
74
+ }
75
+ };
76
+ //#endregion
77
+ //#region src/sig/portable-interop.test.ts
78
+ const options = {
79
+ contextLoader: mockDocumentLoader,
80
+ documentLoader() {
81
+ throw new TypeError("The captured did:key proof must resolve locally");
82
+ }
83
+ };
84
+ test("tootik v0.25.4 actor has a valid DID proof", async () => {
85
+ const key = await verifyProof(actor_default, await DataIntegrityProof.fromJsonLd(actor_default.proof, options), options);
86
+ assert(key != null);
87
+ assertEquals(key.id?.href, actor_default.proof.verificationMethod);
88
+ });
89
+ test("tootik v0.25.4 actor proof rejects tampering", async () => {
90
+ const proof = await DataIntegrityProof.fromJsonLd(actor_default.proof, options);
91
+ assertEquals(await verifyProof({
92
+ ...actor_default,
93
+ preferredUsername: "tampered"
94
+ }, proof, options), null);
95
+ });
96
+ test("tootik v0.25.4 actor retains its unmapped gateways", async () => {
97
+ const original = structuredClone(actor_default);
98
+ assertEquals(actor_default.gateways, ["https://tootik.example"]);
99
+ const parsed = await Application.fromJsonLd(actor_default, options);
100
+ assertEquals(parsed.id?.href, actor_default.id);
101
+ assertEquals(parsed.gateways, [new URL("https://tootik.example")]);
102
+ assert((await verifyPortableObjectProof(actor_default, options)).verified);
103
+ assertEquals(actor_default, original);
104
+ });
105
+ const loadedOptions = {
106
+ contextLoader: mockDocumentLoader,
107
+ documentLoader(url) {
108
+ assertEquals(url.split("#")[0], actor_default.id);
109
+ return Promise.resolve({
110
+ document: structuredClone(actor_default),
111
+ documentUrl: actor_default.id,
112
+ contextUrl: null
113
+ });
114
+ }
115
+ };
116
+ test("tootik v0.25.4 actor can be looked up and own a gateway key", async () => {
117
+ const parsed = await lookupObject(actor_default.id, {
118
+ ...loadedOptions,
119
+ verifyPortableObject: verifyPortableObjectProof
120
+ });
121
+ assert(parsed instanceof Application);
122
+ assertEquals(parsed.gateways, [new URL("https://tootik.example")]);
123
+ const owner = await getKeyOwner(new URL(actor_default.publicKey.id), loadedOptions);
124
+ assert(owner != null);
125
+ assertEquals(owner.id?.href, actor_default.id);
126
+ assertEquals(owner.gateways, [new URL("https://tootik.example")]);
127
+ });
128
+ test("tootik v0.25.4 actor authenticates its gateway for collections", async () => {
129
+ const result = await verifyPortableObject({
130
+ "@context": "https://www.w3.org/ns/activitystreams",
131
+ id: actor_default.outbox,
132
+ type: "OrderedCollection",
133
+ attributedTo: actor_default.id,
134
+ orderedItems: []
135
+ }, {
136
+ ...loadedOptions,
137
+ documentUrl: new URL(actor_default.outbox)
138
+ });
139
+ assert(result.verified);
140
+ assertEquals(result.method, "gateway");
141
+ if (result.method === "gateway") assertEquals(result.gateway, new URL("https://tootik.example"));
142
+ });
143
+ test("tootik v0.25.4 actor rejects tampered gateways", async () => {
144
+ assertEquals(await verifyPortableObjectProof({
145
+ ...actor_default,
146
+ gateways: ["https://attacker.example"]
147
+ }, options), {
148
+ verified: false,
149
+ reason: {
150
+ type: "invalidProof",
151
+ proofIndex: 0
152
+ }
153
+ });
154
+ });
155
+ //#endregion
156
+ export {};
@@ -2,13 +2,13 @@ import { Temporal } from "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
5
- import { a as fetchKeyDetailed, i as fetchKey } from "../key-BlTaKABr.mjs";
6
- import { h as verifyJsonLd, p as signJsonLd } from "../ld-Dx8r_qJU.mjs";
7
- import { d as verifyProof, r as createProof } from "../proof-CZrjvoJ3.mjs";
8
- import { n as resolvePortableActorKey } from "../portable-key-CPN0QZSA.mjs";
9
- import { f as verifyRequest, l as signRequest, p as verifyRequestDetailed } from "../http-CUyBaVsQ.mjs";
5
+ import { a as fetchKeyDetailed, i as fetchKey } from "../key-CEsu7oaD.mjs";
6
+ import { h as verifyJsonLd, p as signJsonLd } from "../ld-Cf4CPWN_.mjs";
7
+ import { d as verifyProof, r as createProof } from "../proof-8WiH_-Gq.mjs";
8
+ import { n as resolvePortableActorKey } from "../portable-key-woGH_1nn.mjs";
9
+ import { f as verifyRequest, l as signRequest, p as verifyRequestDetailed } from "../http-DkqWu-sm.mjs";
10
10
  import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
11
- import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-B61jjp5K.mjs";
11
+ import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-DSJ7nFgy.mjs";
12
12
  import { t as KvKeyCache } from "../keycache-Da8A8mZa.mjs";
13
13
  import { Create, CryptographicKey, Multikey, Note, Person } from "@fedify/vocab";
14
14
  import { FetchError, encodeMultibase, exportDidKey, exportSpki, parseIri, preloadedContexts } from "@fedify/vocab-runtime";
@@ -10,10 +10,10 @@ import "../std__assert-DvMDRPes.mjs";
10
10
  import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
11
11
  import { t as assert } from "../assert-D1Eafmd_.mjs";
12
12
  import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-4IJqPYos.mjs";
13
- import { a as signObject, c as verifyPortableObjectProof, d as verifyProof, i as hasProofLike, r as createProof, s as verifyObject } from "../proof-CZrjvoJ3.mjs";
14
- import { f as verifyRequest } from "../http-CUyBaVsQ.mjs";
13
+ import { a as signObject, c as verifyPortableObjectProof, d as verifyProof, i as hasProofLike, r as createProof, s as verifyObject } from "../proof-8WiH_-Gq.mjs";
14
+ import { f as verifyRequest } from "../http-DkqWu-sm.mjs";
15
15
  import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DIJNHW-Y.mjs";
16
- import { t as getAuthenticatedDocumentLoader } from "../docloader-fbmPhCdS.mjs";
16
+ import { t as getAuthenticatedDocumentLoader } from "../docloader-CIP_SG39.mjs";
17
17
  import { Create, DataIntegrityProof, Document, Multikey, Note, PUBLIC_COLLECTION, Place, Translation } from "@fedify/vocab";
18
18
  import { decodeMultibase, encodeMultibase, exportDidKey, exportMultibaseKey, formatIri, importMultibaseKey, parseIri } from "@fedify/vocab-runtime";
19
19
  import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
@@ -1032,6 +1032,91 @@ test("verifyPortableObjectProof()", async (t) => {
1032
1032
  reason: { type: "invalidGateways" }
1033
1033
  });
1034
1034
  });
1035
+ await t.step("verifies JCS-signed actors with unmapped gateways", async () => {
1036
+ for (const id of [`ap+ef61://${portableDid}/actor`, `https://gateway.example/.well-known/apgateway/${portableDid}/actor`]) {
1037
+ const signed = await signPortableJsonLd({
1038
+ "@context": portableContext,
1039
+ id,
1040
+ type: "Person",
1041
+ inbox: `${id}/inbox`,
1042
+ outbox: `${id}/outbox`,
1043
+ gateways: ["https://gateway.example", "https://other.example"]
1044
+ });
1045
+ const original = structuredClone(signed);
1046
+ assert((await verifyPortableObjectProof(signed, options)).verified);
1047
+ assertEquals(signed, original);
1048
+ assertEquals(await verifyPortableObjectProof({
1049
+ ...signed,
1050
+ gateways: ["https://attacker.example"]
1051
+ }, options), {
1052
+ verified: false,
1053
+ reason: {
1054
+ type: "invalidProof",
1055
+ proofIndex: 0
1056
+ }
1057
+ });
1058
+ }
1059
+ });
1060
+ await t.step("rejects malformed unmapped actor gateways", async () => {
1061
+ const id = `ap+ef61://${portableDid}/actor`;
1062
+ for (const gateways of [
1063
+ [],
1064
+ ["https://gateway.example", 42],
1065
+ [{ bad: "https://gateway.example" }],
1066
+ ["ftp://gateway.example"],
1067
+ ["https://gateway.example/path"],
1068
+ ["https://gateway.example/?query"],
1069
+ ["https://gateway.example/#fragment"],
1070
+ ["https://user:password@gateway.example"]
1071
+ ]) assertEquals(await verifyPortableObjectProof(await signPortableJsonLd({
1072
+ "@context": portableContext,
1073
+ id,
1074
+ type: "Person",
1075
+ inbox: `${id}/inbox`,
1076
+ outbox: `${id}/outbox`,
1077
+ gateways
1078
+ }), options), {
1079
+ verified: false,
1080
+ reason: { type: "invalidGateways" }
1081
+ }, JSON.stringify(gateways));
1082
+ });
1083
+ await t.step("does not replace context-defined gateway semantics", async () => {
1084
+ const id = `ap+ef61://${portableDid}/actor`;
1085
+ const actor = {
1086
+ "@context": portableContext,
1087
+ id,
1088
+ type: "Person",
1089
+ inbox: `${id}/inbox`,
1090
+ outbox: `${id}/outbox`,
1091
+ gateways: ["https://gateway.example"]
1092
+ };
1093
+ const property = "https://w3id.org/fep/ef61/gateways";
1094
+ for (const extra of [
1095
+ { [property]: { "@list": [] } },
1096
+ { [property]: { "@list": [{ "@id": "https://bad.example/path" }] } },
1097
+ { "@context": [...portableContext, { gateways: null }] },
1098
+ { "@context": [...portableContext, { gateways: "https://other.example/gateways" }] },
1099
+ { "@context": [...portableContext, { Person: {
1100
+ "@id": "https://www.w3.org/ns/activitystreams#Person",
1101
+ "@context": { gateways: null }
1102
+ } }] }
1103
+ ]) assertEquals(await verifyPortableObjectProof(await signPortableJsonLd({
1104
+ ...actor,
1105
+ ...extra
1106
+ }), options), {
1107
+ verified: false,
1108
+ reason: { type: "invalidGateways" }
1109
+ }, JSON.stringify(extra));
1110
+ assert((await verifyPortableObjectProof(await signPortableJsonLd({
1111
+ ...actor,
1112
+ gateways: ["https://bad.example/path"],
1113
+ [property]: { "@list": [{ "@id": "https://canonical.example" }] }
1114
+ }), options)).verified);
1115
+ assertEquals(await verifyPortableObjectProof(await signPortableJsonLd(actor, { proofOptions: { cryptosuite: "eddsa-rdfc-2022" } }), options), {
1116
+ verified: false,
1117
+ reason: { type: "invalidGateways" }
1118
+ });
1119
+ });
1035
1120
  await t.step("checks gateways only for FEP-2277 actors", async () => {
1036
1121
  assert((await verifyPortableObjectProof(await signPortableJsonLd({
1037
1122
  "@context": portableContext,
@@ -0,0 +1,2 @@
1
+ import { Temporal } from "temporal-polyfill";
2
+ import { URLPattern } from "urlpattern-polyfill";
@@ -0,0 +1,190 @@
1
+ import { Temporal } from "temporal-polyfill";
2
+ import "urlpattern-polyfill";
3
+ globalThis.addEventListener = () => {};
4
+ import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
5
+ import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
6
+ import "../std__assert-DvMDRPes.mjs";
7
+ import { t as assert } from "../assert-D1Eafmd_.mjs";
8
+ import { c as verifyPortableObjectProof } from "../proof-8WiH_-Gq.mjs";
9
+ import { p as verifyRequestDetailed } from "../http-DkqWu-sm.mjs";
10
+ import { o as createFederation } from "../middleware-Dxn0E9ES.mjs";
11
+ import { t as doesActorOwnKey } from "../owner-DSJ7nFgy.mjs";
12
+ import { Follow, Person } from "@fedify/vocab";
13
+ import { mockDocumentLoader, test } from "@fedify/fixture";
14
+ import { encodeHex } from "byte-encodings/hex";
15
+ //#region test-vectors/fep-ef61/tootik-v0.25.4/follow/actor.json
16
+ var actor_default = {
17
+ "@context": [
18
+ "https://www.w3.org/ns/activitystreams",
19
+ "https://w3id.org/security/data-integrity/v1",
20
+ "https://w3id.org/security/v1"
21
+ ],
22
+ id: "https://tootik.example/.well-known/apgateway/did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR/actor",
23
+ type: "Person",
24
+ inbox: "https://tootik.example/.well-known/apgateway/did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR/actor/inbox",
25
+ outbox: "https://tootik.example/.well-known/apgateway/did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR/actor/outbox",
26
+ preferredUsername: "alice",
27
+ followers: "https://tootik.example/.well-known/apgateway/did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR/actor/followers",
28
+ publicKey: {
29
+ "id": "https://tootik.example/.well-known/apgateway/did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR/actor#main-key",
30
+ "owner": "https://tootik.example/.well-known/apgateway/did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR/actor",
31
+ "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyLpYZnhnVih6ToB4UThp\nEZIcxbBcGng71XeEfiR42v+cCyUL+jzQm12x/I0a3FNh4dzIicMvtbmLewQ/HscR\nUNIxAFHF8GqshIjg2tDAmGswTQDsvTzBsaEixXtL0qTTX8X0tFzVKJEsMJJ99jzg\nodERW73G55WwpJYyI4v1RT3G5tU3p0tmD52hhCLCRLRCPKy75iz416nCwDt5sA8B\nowVE5n/J+tjqG3umnnI3gJpTtuJxTyB/SVjLjnC604RKowwQQTHGAmcl3E5F3IrK\nfnmfqdXNCrNbfvJFFAWB+XNXFB0I+fJbGUZAOYMfjhMGEpPzzkKI8cI1eR+Z5DeZ\nGQIDAQAB\n-----END PUBLIC KEY-----\n"
32
+ },
33
+ icon: [{
34
+ "type": "Image",
35
+ "mediaType": "image/gif",
36
+ "url": "https://tootik.example/.well-known/apgateway/did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR/actor/icon.gif"
37
+ }],
38
+ manuallyApprovesFollowers: false,
39
+ assertionMethod: [{
40
+ "id": "https://tootik.example/.well-known/apgateway/did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR/actor#ed25519-key",
41
+ "type": "Multikey",
42
+ "controller": "https://tootik.example/.well-known/apgateway/did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR/actor",
43
+ "publicKeyMultibase": "z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR"
44
+ }, {
45
+ "id": "https://tootik.example/.well-known/apgateway/did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR/actor#ml-dsa-44-key",
46
+ "type": "Multikey",
47
+ "controller": "https://tootik.example/.well-known/apgateway/did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR/actor",
48
+ "publicKeyMultibase": "ukCQjRdBDVD0QfnNnj4wFAJE82TmNXoNQ80Rf6s3ivFXlFCzb5_tZHVhfsR5JysgCbOqYPnXYyXIgXAm_klgaj1a4_MB-KLhmueucnnMKUjl60ORt4RG2fDAjZoCzBy-m7PMX5hByOfuDTXbAhSFhG44xvBumN2x877PLudpMqhe9hhBDwgL4NTxUWOP3xJR4KhO0GMzjA6r4HGw0F2Mw3cYQNJs2t40k9w_Yt1qiVfyr4Qk0pk5vnZEkNFF71OBm-SUUSPtrHQEo02HhElN7uFE8wgYmziC_RqzrvyWAi9XQofgDGps2d-xXQew28NkyhAjv-7yIwd3ukjm_0UxjslLFpcjRAW7hNkrIm6oxV_Wv3ynpUVII7uc6v3Q3hkTtJxL4bcsl-oOpZKAqJide5A09G0XE_PvPrnVU3n9hH1HIhs4aWUeo3xda_gLfA5yoavGhqh1oOKnT3yiZYysjKt4GbdcLE_AMCDvWAqLdHTywnl5CG_9gUa3GlgjEsrJK8-SWCXoVgjQmGtdLWWMXTwzAwNZZwkoiR72v0uVOAzE54U_0oz6_Fowdgr29o0qu8TTb6NY70fF34XMWDDlKOWpgo7s5ejL15jfsrzcLhzP1xQlcBqQRZIsSQ_e0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RdRqQLG3wW6HFTMJtl6"
49
+ }],
50
+ gateways: ["https://tootik.example"],
51
+ proof: {
52
+ "@context": [
53
+ "https://www.w3.org/ns/activitystreams",
54
+ "https://w3id.org/security/data-integrity/v1",
55
+ "https://w3id.org/security/v1"
56
+ ],
57
+ "type": "DataIntegrityProof",
58
+ "cryptosuite": "eddsa-jcs-2022",
59
+ "verificationMethod": "did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR#z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR",
60
+ "proofPurpose": "assertionMethod",
61
+ "proofValue": "z2G5haKKAJk3rfL8njG9V2jybnPuHrXjR8ipPBjDSFim9cFuJ9xEMEWBLQLdBmoQKXmHhqXfheadf8EaNW3cEpX8s",
62
+ "created": "2026-09-30T13:25:15Z"
63
+ }
64
+ };
65
+ //#endregion
66
+ //#region test-vectors/fep-ef61/tootik-v0.25.4/follow/request.json
67
+ var url = "https://fedify.example:18444/users/alice/inbox";
68
+ var method = "POST";
69
+ var headers = [
70
+ ["accept-encoding", "gzip"],
71
+ ["content-length", "1033"],
72
+ ["content-type", "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\""],
73
+ ["date", "Wed, 30 Sep 2026 13:30:43 GMT"],
74
+ ["digest", "SHA-256=ZlDZCndYkYcCvPMpFmRZJE+QT1SVtwope+KPaV5U/r8="],
75
+ ["host", "fedify.example:18444"],
76
+ ["signature", "keyId=\"https://tootik.example/.well-known/apgateway/did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR/actor#main-key\",algorithm=\"rsa-sha256\",headers=\"(request-target) host date content-type digest\",signature=\"Rqd+mtn7knlPY5SXUE2Zz93ICDgBeamFu5v8SagsII8vYcBTX1gan+S0oded4+f4gLB0cs+xdlaqeAUBj3BtWYBJ/cEcCWDFp+bB0xhq/grE/xt4fkdgCCfXWSU2EnJuFCEmUoB1zRemNvTOHwZV4wDrkLVwQsIxrUIjPbMFTVGyMjnpY71Ydta3rdia7VW0VWK3gEC4FJ6YweFxV52dmcOTmA3Qj1h0riHHVEZXs5UOzPJLL6FJQoz8ezyjE7LanxSoXpeOSHa5K1fAo9i35eJr1/eQdFpHt7ftabpv3+6u6MhCFAt2lJs3XJbJZL8DYNkYwJNAYi9fqmH8JOVuMw==\""],
77
+ ["user-agent", "tootik/0.25.4"]
78
+ ];
79
+ var capturedAt$1 = "2026-09-30T13:30:43.325Z";
80
+ //#endregion
81
+ //#region test-vectors/fep-ef61/tootik-v0.25.4/follow/metadata.json
82
+ var capturedAt = "2026-09-30T13:30:43.325Z";
83
+ var requestBodySha256 = "6650d90a7758918702bcf329166459244f904f5495b70a297be28f695e54febf";
84
+ var actorBodySha256 = "a58dad10d1051aed670bd79ee7dbfb9d3606cc8e6f231a9a742edd9317b28cd8";
85
+ //#endregion
86
+ //#region test-vectors/fep-ef61/tootik-v0.25.4/follow/raw-bodies.json
87
+ var requestBody = "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/data-integrity/v1\",\"https://w3id.org/security/v1\"],\"id\":\"https://tootik.example/.well-known/apgateway/did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR/actor/follow/01a0f282-9cba-7125-af77-e8c7210b7b65\",\"type\":\"Follow\",\"actor\":\"https://tootik.example/.well-known/apgateway/did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR/actor\",\"object\":\"https://fedify.example:18444/users/alice\",\"to\":[\"https://fedify.example:18444/users/alice\"],\"cc\":[],\"proof\":{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/data-integrity/v1\",\"https://w3id.org/security/v1\"],\"type\":\"DataIntegrityProof\",\"cryptosuite\":\"eddsa-jcs-2022\",\"verificationMethod\":\"did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR#z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR\",\"proofPurpose\":\"assertionMethod\",\"proofValue\":\"z4yttRN3ak6xdXqdkg6KF9UyiVLv85tbcEvGFEcAKRSg5hpzhMFZzK2A8dp3o3wnJq5CA9t6nc47umjJkjmT5Kpmk\",\"created\":\"2026-09-30T13:30:41Z\"}}";
88
+ var actorBody = "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/data-integrity/v1\",\"https://w3id.org/security/v1\"],\"id\":\"https://tootik.example/.well-known/apgateway/did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR/actor\",\"type\":\"Person\",\"inbox\":\"https://tootik.example/.well-known/apgateway/did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR/actor/inbox\",\"outbox\":\"https://tootik.example/.well-known/apgateway/did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR/actor/outbox\",\"preferredUsername\":\"alice\",\"followers\":\"https://tootik.example/.well-known/apgateway/did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR/actor/followers\",\"publicKey\":{\"id\":\"https://tootik.example/.well-known/apgateway/did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR/actor#main-key\",\"owner\":\"https://tootik.example/.well-known/apgateway/did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR/actor\",\"publicKeyPem\":\"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyLpYZnhnVih6ToB4UThp\\nEZIcxbBcGng71XeEfiR42v+cCyUL+jzQm12x/I0a3FNh4dzIicMvtbmLewQ/HscR\\nUNIxAFHF8GqshIjg2tDAmGswTQDsvTzBsaEixXtL0qTTX8X0tFzVKJEsMJJ99jzg\\nodERW73G55WwpJYyI4v1RT3G5tU3p0tmD52hhCLCRLRCPKy75iz416nCwDt5sA8B\\nowVE5n/J+tjqG3umnnI3gJpTtuJxTyB/SVjLjnC604RKowwQQTHGAmcl3E5F3IrK\\nfnmfqdXNCrNbfvJFFAWB+XNXFB0I+fJbGUZAOYMfjhMGEpPzzkKI8cI1eR+Z5DeZ\\nGQIDAQAB\\n-----END PUBLIC KEY-----\\n\"},\"icon\":[{\"type\":\"Image\",\"mediaType\":\"image/gif\",\"url\":\"https://tootik.example/.well-known/apgateway/did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR/actor/icon.gif\"}],\"manuallyApprovesFollowers\":false,\"assertionMethod\":[{\"id\":\"https://tootik.example/.well-known/apgateway/did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR/actor#ed25519-key\",\"type\":\"Multikey\",\"controller\":\"https://tootik.example/.well-known/apgateway/did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR/actor\",\"publicKeyMultibase\":\"z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR\"},{\"id\":\"https://tootik.example/.well-known/apgateway/did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR/actor#ml-dsa-44-key\",\"type\":\"Multikey\",\"controller\":\"https://tootik.example/.well-known/apgateway/did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR/actor\",\"publicKeyMultibase\":\"ukCQjRdBDVD0QfnNnj4wFAJE82TmNXoNQ80Rf6s3ivFXlFCzb5_tZHVhfsR5JysgCbOqYPnXYyXIgXAm_klgaj1a4_MB-KLhmueucnnMKUjl60ORt4RG2fDAjZoCzBy-m7PMX5hByOfuDTXbAhSFhG44xvBumN2x877PLudpMqhe9hhBDwgL4NTxUWOP3xJR4KhO0GMzjA6r4HGw0F2Mw3cYQNJs2t40k9w_Yt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-pg2CiLBe3cPiy1Ck_BE7kvA7TyjShi3YyQIGfUcwAoWXOj4lKwejeqUmsjJ-gpD2iVJ3frWao9Cu846ubamb6wQZf5faAx6yTJsHLYdeDBqqJRCMSVEnOYHf6SaNfzdE8EFqCJ7LP2IYDnSFaiZovhja6BJBM4fphH27mnkrQ10whn35XX843QVAOLJa5fn4GoIwkSFY0PSL1J4MT1MobKfA0lROfF5fE29sKLRt-wbnHveAFE_CRiyzW6IFQO9flnSmn83VxigN2hv_xD51KX6p8dCzX1QLl0S9fWF1K9iHkq4ulz6slvypfacesLLGvbVnAWX491PPq9LIOHjCLoZbr1Ap8vkLw61-XvDFSBHUxGKvrlpPOKO5V3zop0sT_QiEymx9DpGAGrbYiyDEC3LhNmD14DxRdRqQLG3wW6HFTMJtl6\"}],\"gateways\":[\"https://tootik.example\"],\"proof\":{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/data-integrity/v1\",\"https://w3id.org/security/v1\"],\"type\":\"DataIntegrityProof\",\"cryptosuite\":\"eddsa-jcs-2022\",\"verificationMethod\":\"did:key:z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR#z6MkpWqhz4YAuBfC4ddjU49mGfs6CAuYcm243K5hW2YEGAyR\",\"proofPurpose\":\"assertionMethod\",\"proofValue\":\"z2G5haKKAJk3rfL8njG9V2jybnPuHrXjR8ipPBjDSFim9cFuJ9xEMEWBLQLdBmoQKXmHhqXfheadf8EaNW3cEpX8s\",\"created\":\"2026-09-30T13:25:15Z\"}}";
89
+ //#endregion
90
+ //#region src/sig/tootik-request-interop.test.ts
91
+ const body = requestBody;
92
+ const activity = JSON.parse(body);
93
+ async function sha256(value) {
94
+ return encodeHex(new Uint8Array(await crypto.subtle.digest("SHA-256", new TextEncoder().encode(value))));
95
+ }
96
+ function loader(document = actor_default) {
97
+ return (url) => {
98
+ assertEquals(url.split("#")[0], actor_default.id);
99
+ return Promise.resolve({
100
+ document: structuredClone(document),
101
+ documentUrl: actor_default.id,
102
+ contextUrl: null
103
+ });
104
+ };
105
+ }
106
+ const options = {
107
+ documentLoader: loader(),
108
+ contextLoader: mockDocumentLoader,
109
+ currentTime: Temporal.Instant.from(capturedAt$1)
110
+ };
111
+ function request(requestBody = body, url$1 = url, headers$2 = new Headers(headers)) {
112
+ return new Request(url$1, {
113
+ method,
114
+ headers: headers$2,
115
+ body: requestBody
116
+ });
117
+ }
118
+ async function deliver(requestBody) {
119
+ const federation = createFederation({
120
+ kv: new MemoryKvStore(),
121
+ documentLoaderFactory: () => loader(),
122
+ contextLoaderFactory: () => mockDocumentLoader,
123
+ signatureTimeWindow: false
124
+ });
125
+ federation.setActorDispatcher("/users/{identifier}", (ctx, identifier) => identifier === "alice" ? new Person({
126
+ id: ctx.getActorUri(identifier),
127
+ inbox: ctx.getInboxUri(identifier)
128
+ }) : null).setKeyPairsDispatcher(() => []);
129
+ const received = [];
130
+ federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").on(Follow, (_ctx, follow) => {
131
+ received.push(follow);
132
+ });
133
+ return {
134
+ response: await federation.fetch(request(requestBody), { contextData: void 0 }),
135
+ received
136
+ };
137
+ }
138
+ test("tootik v0.25.4 captured Follow verifies its proof and HTTP signature", async () => {
139
+ const actorBody$1 = actorBody;
140
+ assertEquals(await sha256(body), requestBodySha256);
141
+ assertEquals(await sha256(actorBody$1), actorBodySha256);
142
+ assertEquals(JSON.parse(actorBody$1), actor_default);
143
+ assertEquals(activity.type, "Follow");
144
+ assertEquals(actor_default.type, "Person");
145
+ assertEquals(activity.actor, actor_default.id);
146
+ assert((await verifyPortableObjectProof(activity, options)).verified);
147
+ const verified = await verifyRequestDetailed(request(), options);
148
+ assert(verified.verified);
149
+ assertEquals(verified.key.id?.href, actor_default.publicKey.id);
150
+ assert(await doesActorOwnKey(await Follow.fromJsonLd(activity, options), verified.key, options));
151
+ assertEquals(capturedAt$1, capturedAt);
152
+ });
153
+ test("tootik v0.25.4 captured Follow reaches the Fedify inbox listener", async () => {
154
+ const { response, received } = await deliver(body);
155
+ assertEquals(response.status, 202);
156
+ assertEquals(received.length, 1);
157
+ assertEquals(received[0].id?.href, activity.id);
158
+ assertEquals(received[0].actorId?.href, actor_default.id);
159
+ });
160
+ test("tootik v0.25.4 captured Follow rejects body tampering", async () => {
161
+ const tampered = {
162
+ ...activity,
163
+ object: "https://fedify.example:18444/users/mallory"
164
+ };
165
+ assertEquals((await verifyPortableObjectProof(tampered, options)).verified, false);
166
+ const changedBody = JSON.stringify(tampered);
167
+ assertEquals((await verifyRequestDetailed(request(changedBody), options)).verified, false);
168
+ const { response, received } = await deliver(changedBody);
169
+ assertEquals(response.status, 401);
170
+ assertEquals(received.length, 0);
171
+ });
172
+ test("tootik v0.25.4 captured Follow rejects signed header and path tampering", async () => {
173
+ const headers$1 = new Headers(headers);
174
+ headers$1.set("Content-Type", "application/json");
175
+ assertEquals((await verifyRequestDetailed(request(body, url, headers$1), options)).verified, false);
176
+ assertEquals((await verifyRequestDetailed(request(body, `${url}/tampered`), options)).verified, false);
177
+ });
178
+ test("tootik v0.25.4 captured Follow rejects a tampered actor proof", async () => {
179
+ const tampered = {
180
+ ...actor_default,
181
+ preferredUsername: "mallory"
182
+ };
183
+ assertEquals((await verifyPortableObjectProof(tampered, options)).verified, false);
184
+ assertEquals((await verifyRequestDetailed(request(), {
185
+ ...options,
186
+ documentLoader: loader(tampered)
187
+ })).verified, false);
188
+ });
189
+ //#endregion
190
+ export {};
@@ -0,0 +1,2 @@
1
+ import { Temporal } from "temporal-polyfill";
2
+ import { URLPattern } from "urlpattern-polyfill";