@fedify/fedify 2.4.0-dev.2129 → 2.4.0-dev.2141

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 (80) hide show
  1. package/dist/{builder-C0bxZDL0.mjs → builder-BI7H61zO.mjs} +2 -2
  2. package/dist/compat/mod.d.cts +1 -1
  3. package/dist/compat/mod.d.ts +1 -1
  4. package/dist/compat/transformers.test.mjs +1 -1
  5. package/dist/{compound-proof-D9Kljk_7.mjs → compound-proof-D0H4LLvQ.mjs} +15 -20
  6. package/dist/{context-Cz1w5Krc.d.ts → context-B2C8nuN3.d.ts} +3 -2
  7. package/dist/{context-Dvec_D_h.d.cts → context-CrDDVrbF.d.cts} +3 -2
  8. package/dist/{deno-_o3lkDlG.mjs → deno-BXI_BLNy.mjs} +1 -1
  9. package/dist/{docloader-BbS0rO-Y.mjs → docloader-B5BIo7e9.mjs} +2 -2
  10. package/dist/federation/builder.test.mjs +1 -1
  11. package/dist/federation/compound-fanout.test.mjs +3 -3
  12. package/dist/federation/handler-compound-proof.test.mjs +64 -8
  13. package/dist/federation/handler.test.mjs +5 -5
  14. package/dist/federation/hashlink-media.test.mjs +2 -2
  15. package/dist/federation/idempotency.test.mjs +2 -2
  16. package/dist/federation/metrics.test.mjs +1 -1
  17. package/dist/federation/middleware.test.mjs +7 -7
  18. package/dist/federation/mod.cjs +1 -1
  19. package/dist/federation/mod.d.cts +2 -2
  20. package/dist/federation/mod.d.ts +2 -2
  21. package/dist/federation/mod.js +1 -1
  22. package/dist/federation/outgoing-proof.test.mjs +5 -5
  23. package/dist/federation/portable-actor.test.mjs +3 -3
  24. package/dist/federation/portable-chain.test.mjs +17 -5
  25. package/dist/federation/portable-gateway-keys.test.mjs +3 -3
  26. package/dist/federation/portable-inbox.test.mjs +4 -4
  27. package/dist/federation/portable.test.mjs +3 -3
  28. package/dist/federation/send.test.mjs +3 -3
  29. package/dist/federation/tasks/enqueue.test.mjs +1 -1
  30. package/dist/federation/tasks/tasks.test.mjs +2 -2
  31. package/dist/federation/temporal.test.mjs +1 -1
  32. package/dist/federation/webfinger.test.mjs +1 -1
  33. package/dist/{federation-DRY8KrkB.cjs → federation-DqDOPjWo.cjs} +14 -19
  34. package/dist/{http-BpOiZE09.mjs → http-CEx2SZjf.mjs} +4 -4
  35. package/dist/{http-C2M6wcs8.js → http-D4KW2GTi.js} +4 -3
  36. package/dist/{http-B1J6E-bT.cjs → http-DSYQQn23.cjs} +9 -2
  37. package/dist/{key-DolJjJab.mjs → key-C0giKuki.mjs} +2 -2
  38. package/dist/{kv-cache-Bq2cah0c.mjs → kv-cache-AWTrxTq3.mjs} +1 -1
  39. package/dist/{kv-cache-D9nRbG2Q.cjs → kv-cache-BcsvaCCL.cjs} +1 -1
  40. package/dist/{kv-cache-D7TiyMxv.js → kv-cache-D_E-2K3i.js} +1 -1
  41. package/dist/{ld-Dwc176V4.mjs → ld-CWDReGMZ.mjs} +3 -3
  42. package/dist/{metrics-CDaHfBXY.mjs → metrics-DxlVXwn5.mjs} +1 -1
  43. package/dist/{middleware-CylX-pvI.js → middleware-1mv9QR16.js} +14 -19
  44. package/dist/{middleware-CmB1FD8A.mjs → middleware-B7stx5gy.mjs} +1 -1
  45. package/dist/{middleware-DN3MdTDg.mjs → middleware-CAWRGSwH.mjs} +14 -14
  46. package/dist/{mod-DGOIxEfb.d.cts → mod-B7SfEqIP.d.cts} +1 -1
  47. package/dist/{mod-owwElvpw.d.ts → mod-C06GoL5Z.d.ts} +1 -1
  48. package/dist/mod.cjs +4 -4
  49. package/dist/mod.d.cts +2 -2
  50. package/dist/mod.d.ts +2 -2
  51. package/dist/mod.js +4 -4
  52. package/dist/nodeinfo/handler.test.mjs +1 -1
  53. package/dist/{owner-BNHhwjNu.mjs → owner-CgoCOTUQ.mjs} +3 -3
  54. package/dist/{portable-collection-CRpTUHCY.mjs → portable-collection-0_5DyXMt.mjs} +2 -2
  55. package/dist/{portable-collection-PTGD0q70.cjs → portable-collection-BD8fE3j3.cjs} +1 -1
  56. package/dist/{portable-collection-CgglAI9B.js → portable-collection-CG9P_i0E.js} +1 -1
  57. package/dist/{portable-key-DqX2emHQ.mjs → portable-key-BXkgMpw1.mjs} +1 -1
  58. package/dist/{proof-B4_0E-KU.mjs → proof-B5s-W6Sm.mjs} +6 -5
  59. package/dist/{send-Dpu5qbP5.mjs → send-BAJvkdNL.mjs} +3 -3
  60. package/dist/sig/compound-proof-discovery.test.mjs +1 -1
  61. package/dist/sig/compound-proof-producer.test.mjs +1 -1
  62. package/dist/sig/compound-proof-verification.test.mjs +196 -2
  63. package/dist/sig/compound-proof.test.mjs +2 -2
  64. package/dist/sig/http.test.mjs +2 -2
  65. package/dist/sig/key.test.mjs +1 -1
  66. package/dist/sig/ld.test.mjs +2 -2
  67. package/dist/sig/mod.cjs +2 -2
  68. package/dist/sig/mod.js +2 -2
  69. package/dist/sig/owner.test.mjs +1 -1
  70. package/dist/sig/portable-collection.test.mjs +1 -1
  71. package/dist/sig/portable-key.test.mjs +5 -5
  72. package/dist/sig/proof.test.mjs +45 -3
  73. package/dist/{temporal-78JVR3GK.mjs → temporal-BkCPJ_uC.mjs} +1 -1
  74. package/dist/testing/kv.test.mjs +1 -1
  75. package/dist/testing/mod.d.mts +3 -2
  76. package/dist/utils/docloader.test.mjs +2 -2
  77. package/dist/utils/kv-cache.test.mjs +1 -1
  78. package/dist/utils/mod.cjs +1 -1
  79. package/dist/utils/mod.js +1 -1
  80. package/package.json +6 -6
@@ -4,9 +4,9 @@ globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
5
5
  import "../std__assert-DvMDRPes.mjs";
6
6
  import { t as assert } from "../assert-D1Eafmd_.mjs";
7
- import { a as verifyMapLocalProof, c as verifyPortableObjectProofPolicy } from "../proof-B4_0E-KU.mjs";
7
+ import { a as verifyMapLocalProof, c as verifyPortableObjectProofPolicy } from "../proof-B5s-W6Sm.mjs";
8
8
  import { n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
9
- import { a as verifyCompoundPortableObjectProofs, i as inspectCompoundPortableObjectApplicability, o as verifyCompoundProofDocuments, t as containsCompoundPortableObject } from "../compound-proof-D9Kljk_7.mjs";
9
+ import { a as verifyCompoundPortableObjectProofs, i as inspectCompoundPortableObjectApplicability, o as verifyCompoundProofDocuments, t as containsCompoundPortableObject } from "../compound-proof-D0H4LLvQ.mjs";
10
10
  import { t as map_local_create_note_default } from "../map-local-create-note-B0SeXJms.mjs";
11
11
  import { t as map_local_context_conflict_default } from "../map-local-context-conflict-DOYEEJ3u.mjs";
12
12
  import { CryptographicKey, Multikey, Person } from "@fedify/vocab";
@@ -618,5 +618,199 @@ test("verifyCompoundPortableObjectProofs() exempts only keys of the parent itsel
618
618
  assert(result.portableObjects.some((o) => o.path !== "" && !o.verified), name);
619
619
  }
620
620
  });
621
+ /**
622
+ * Rewrites the IDs of a {@link compatibleActor}'s keys as they are written,
623
+ * e.g., as `ap:` URIs, which the serializer would canonicalize otherwise.
624
+ */
625
+ function withKeyIds(actor, keyBase, { id = actor.id, owner = id } = {}) {
626
+ const [multikey] = actor.assertionMethod;
627
+ return {
628
+ ...actor,
629
+ id,
630
+ publicKey: {
631
+ ...asRecord(actor.publicKey),
632
+ id: `${keyBase}#main-key`,
633
+ owner
634
+ },
635
+ assertionMethod: [{
636
+ ...multikey,
637
+ id: `${keyBase}#ed25519-key`,
638
+ controller: owner
639
+ }]
640
+ };
641
+ }
642
+ const apActorId = `ap://${compatibleDid}/actor`;
643
+ test("verifyCompoundPortableObjectProofs() exempts keys at ap: URIs embedded in portable actors", async () => {
644
+ const actor = await compatibleActor();
645
+ const encodedDid = encodeURIComponent(compatibleDid);
646
+ const cases = {
647
+ "ap: keys of an ap: actor": [apActorId, apActorId],
648
+ "ap: keys of a compatible-ID actor": [compatibleActorId, apActorId],
649
+ "ap+ef61: keys": [apActorId, `ap+ef61://${compatibleDid}/actor`],
650
+ "keys with percent-encoded DIDs": [apActorId, `ap://${encodedDid}/actor`],
651
+ "ap+ef61: keys of a percent-encoded actor": [`ap+ef61://${encodedDid}/actor`, `ap+ef61://${encodedDid}/actor`],
652
+ "keys with an uppercase scheme": [apActorId, `AP://${compatibleDid}/actor`],
653
+ "keys with location hints": [apActorId, `${apActorId}?@gateway=https%3A%2F%2Fgw.example`]
654
+ };
655
+ for (const [name, [id, keyBase]] of Object.entries(cases)) {
656
+ const result = await verifyCompoundPortableObjectProofs(await signCompatible(withKeyIds(actor, keyBase, { id })), limits, options);
657
+ assert(result.status === "ok", name);
658
+ assert(result.verified, name);
659
+ assertEquals(result.portableObjects.map((o) => o.path), [""], name);
660
+ }
661
+ const apActor = withKeyIds(actor, apActorId, { id: apActorId });
662
+ const atIdKeys = (key) => {
663
+ const { id, ...rest } = asRecord(key);
664
+ return {
665
+ ...rest,
666
+ "@id": id
667
+ };
668
+ };
669
+ const withAtIds = await verifyCompoundPortableObjectProofs(await signCompatible({
670
+ ...apActor,
671
+ publicKey: atIdKeys(apActor.publicKey),
672
+ assertionMethod: apActor.assertionMethod.map(atIdKeys)
673
+ }), limits, options);
674
+ assert(withAtIds.status === "ok");
675
+ assert(withAtIds.verified);
676
+ assertEquals(withAtIds.portableObjects.map((o) => o.path), [""]);
677
+ const withApTerm = await verifyCompoundPortableObjectProofs(await signCompatible({
678
+ ...withKeyIds(actor, apActorId, { id: apActorId }),
679
+ "@context": [...actor["@context"], { ap: "https://ap.example/" }]
680
+ }), limits, options);
681
+ assert(withApTerm.status === "ok");
682
+ assert(withApTerm.verified);
683
+ assertEquals(withApTerm.portableObjects.map((o) => o.path), [""]);
684
+ const result = await verifyCompoundPortableObjectProofs(await signCompatible({
685
+ "@context": [...compatibleContext],
686
+ id: `ap://${compatibleDid}/activities/1`,
687
+ type: "Update",
688
+ actor: apActorId,
689
+ object: await signCompatible(withKeyIds(actor, apActorId, { id: apActorId }))
690
+ }), limits, options);
691
+ assert(result.status === "ok");
692
+ assert(result.verified);
693
+ assertEquals(result.portableObjects.map((o) => o.path), ["/object", ""]);
694
+ });
695
+ test("verifyCompoundPortableObjectProofs() exempts only ap: keys of the parent itself", async () => {
696
+ const actor = withKeyIds(await compatibleActor(), apActorId, { id: apActorId });
697
+ const publicKey = asRecord(actor.publicKey);
698
+ const otherDid = "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK";
699
+ const keyIds = {
700
+ "a key of another actor": `ap://${compatibleDid}/other#main-key`,
701
+ "a key of another DID": `ap://${otherDid}/actor#main-key`,
702
+ "a key without a fragment": apActorId,
703
+ "a key with an empty fragment": `${apActorId}#`,
704
+ "a key with dot segments": `ap://${compatibleDid}/x/../actor#main-key`,
705
+ "a key with encoded dot segments": `ap://${compatibleDid}/x/%2E%2E/actor#main-key`,
706
+ "a key with an encoded slash": `${apActorId}%2F#main-key`,
707
+ "a key with an encoded fragment delimiter": `${apActorId}%23main-key`,
708
+ "a compatible key with dot segments": `https://gw.example/.well-known/apgateway/${compatibleDid}/x/../actor#main-key`
709
+ };
710
+ const cases = {};
711
+ for (const [name, id] of Object.entries(keyIds)) cases[name] = {
712
+ ...actor,
713
+ publicKey: {
714
+ ...publicKey,
715
+ id
716
+ }
717
+ };
718
+ Object.assign(cases, {
719
+ "a key owned by another actor": {
720
+ ...actor,
721
+ publicKey: {
722
+ ...publicKey,
723
+ owner: `ap://${otherDid}/actor`
724
+ }
725
+ },
726
+ "a key controlled by another actor": {
727
+ ...actor,
728
+ assertionMethod: actor.assertionMethod.map((key) => ({
729
+ ...key,
730
+ controller: `ap://${otherDid}/actor`
731
+ }))
732
+ },
733
+ "a key with extra content": {
734
+ ...actor,
735
+ publicKey: {
736
+ ...publicKey,
737
+ name: "Extra"
738
+ }
739
+ },
740
+ "a key with a scoped context": {
741
+ ...actor,
742
+ publicKey: {
743
+ ...publicKey,
744
+ "@context": { CryptographicKey: {
745
+ "@id": "https://w3id.org/security#Key",
746
+ "@context": {}
747
+ } }
748
+ }
749
+ }
750
+ });
751
+ for (const [name, document] of Object.entries(cases)) {
752
+ const result = await verifyCompoundPortableObjectProofs(await signCompatible(document), limits, options);
753
+ assert(result.status === "ok", name);
754
+ assertEquals(result.verified, false, name);
755
+ assert(result.portableObjects.find((o) => o.path === "")?.verified, name);
756
+ assert(result.portableObjects.some((o) => o.path !== "" && !o.verified), name);
757
+ }
758
+ const conflicting = await verifyCompoundPortableObjectProofs(await signCompatible({
759
+ ...actor,
760
+ publicKey: {
761
+ ...publicKey,
762
+ "@id": `ap://${compatibleDid}/other#main-key`
763
+ }
764
+ }), limits, options);
765
+ assert(conflicting.status === "ok");
766
+ assertEquals(conflicting.verified, false);
767
+ });
768
+ test("verifyCompoundPortableObjectProofs() exempts ap: keys only of verified actors", async () => {
769
+ const actor = withKeyIds(await compatibleActor(), apActorId, { id: apActorId });
770
+ const signed = await signCompatible(actor);
771
+ const unverified = {
772
+ "": true,
773
+ "/object": false,
774
+ "/object/publicKey": false,
775
+ "/object/assertionMethod/0": false
776
+ };
777
+ const cases = {
778
+ "an unsigned actor": [actor, unverified],
779
+ "a tampered actor": [{
780
+ ...signed,
781
+ name: "Tampered"
782
+ }, unverified],
783
+ "an actor with a key with an invalid proof": [await signCompatible({
784
+ ...actor,
785
+ publicKey: {
786
+ ...asRecord(actor.publicKey),
787
+ "@context": [...compatibleContext],
788
+ proof: asRecord(signed.proof)
789
+ }
790
+ }), {
791
+ "": true,
792
+ "/object": true,
793
+ "/object/publicKey": false
794
+ }]
795
+ };
796
+ for (const [name, [object, expected]] of Object.entries(cases)) {
797
+ const result = await verifyCompoundPortableObjectProofs(await signCompatible({
798
+ "@context": [...compatibleContext],
799
+ id: `ap://${compatibleDid}/activities/1`,
800
+ type: "Update",
801
+ actor: apActorId,
802
+ object
803
+ }), limits, options);
804
+ assert(result.status === "ok", name);
805
+ assertEquals(result.verified, false, name);
806
+ assertEquals(Object.fromEntries(result.portableObjects.map((o) => [o.path, o.verified])), expected, name);
807
+ }
808
+ });
809
+ test("verifyCompoundPortableObjectProofs() leaves keys at DID URLs alone", async () => {
810
+ const result = await verifyCompoundPortableObjectProofs(await signCompatible(withKeyIds(await compatibleActor(), compatibleDid, { id: apActorId })), limits, options);
811
+ assert(result.status === "ok");
812
+ assert(result.verified);
813
+ assertEquals(result.portableObjects.map((o) => o.path), [""]);
814
+ });
621
815
  //#endregion
622
816
  export {};
@@ -6,9 +6,9 @@ import "../std__assert-DvMDRPes.mjs";
6
6
  import { t as assert } from "../assert-D1Eafmd_.mjs";
7
7
  import { n as preloadedOnlyDocumentLoader } from "../public-audience--klBIOk1.mjs";
8
8
  import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-4IJqPYos.mjs";
9
- import { i as signObject, u as verifyProof } from "../proof-B4_0E-KU.mjs";
9
+ import { i as signObject, u as verifyProof } from "../proof-B5s-W6Sm.mjs";
10
10
  import { n as ed25519PrivateKey, r as ed25519PublicKey } from "../keys-DIJNHW-Y.mjs";
11
- import { o as verifyCompoundProofDocuments } from "../compound-proof-D9Kljk_7.mjs";
11
+ import { o as verifyCompoundProofDocuments } from "../compound-proof-D0H4LLvQ.mjs";
12
12
  import { t as map_local_create_note_default } from "../map-local-create-note-B0SeXJms.mjs";
13
13
  import { t as map_local_context_conflict_default } from "../map-local-context-conflict-DOYEEJ3u.mjs";
14
14
  import { Create, DataIntegrityProof, Note, Question } from "@fedify/vocab";
@@ -11,8 +11,8 @@ import { t as assertThrows } from "../assert_throws-BYITOvPO.mjs";
11
11
  import "../std__assert-DvMDRPes.mjs";
12
12
  import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
13
13
  import { t as assert } from "../assert-D1Eafmd_.mjs";
14
- import { n as exportJwk } from "../key-DolJjJab.mjs";
15
- import { a as listRequestSignatures, c as selectRequestSignature, d as verifyRequest, f as verifyRequestDetailed, i as formatRfc9421SignatureParameters, l as signRequest, n as doubleKnock, o as parseRfc9421Signature, r as formatRfc9421Signature, s as parseRfc9421SignatureInput, t as createRfc9421SignatureBase, u as timingSafeEqual } from "../http-BpOiZE09.mjs";
14
+ import { n as exportJwk } from "../key-C0giKuki.mjs";
15
+ import { a as listRequestSignatures, c as selectRequestSignature, d as verifyRequest, f as verifyRequestDetailed, i as formatRfc9421SignatureParameters, l as signRequest, n as doubleKnock, o as parseRfc9421Signature, r as formatRfc9421Signature, s as parseRfc9421SignatureInput, t as createRfc9421SignatureBase, u as timingSafeEqual } from "../http-CEx2SZjf.mjs";
16
16
  import { i as rsaPrivateKey2, l as rsaPublicKey5, o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
17
17
  import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
18
18
  import { FetchError, exportSpki } from "@fedify/vocab-runtime";
@@ -6,7 +6,7 @@ import { t as assertThrows } from "../assert_throws-BYITOvPO.mjs";
6
6
  import "../std__assert-DvMDRPes.mjs";
7
7
  import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
8
8
  import { t as assert } from "../assert-D1Eafmd_.mjs";
9
- import { a as fetchKeyDetailed, c as validateCryptoKey, i as fetchKey, n as exportJwk, o as generateCryptoKeyPair, s as importJwk } from "../key-DolJjJab.mjs";
9
+ import { a as fetchKeyDetailed, c as validateCryptoKey, i as fetchKey, n as exportJwk, o as generateCryptoKeyPair, s as importJwk } from "../key-C0giKuki.mjs";
10
10
  import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DIJNHW-Y.mjs";
11
11
  import { CryptographicKey, Multikey } from "@fedify/vocab";
12
12
  import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
@@ -8,8 +8,8 @@ import { t as assertInstanceOf } from "../assert_instance_of-mrXWWNY-.mjs";
8
8
  import { t as assertThrows } from "../assert_throws-BYITOvPO.mjs";
9
9
  import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
10
10
  import { t as assert } from "../assert-D1Eafmd_.mjs";
11
- import { o as generateCryptoKeyPair } from "../key-DolJjJab.mjs";
12
- import { a as compactJsonLd, f as isInvalidUrlTypeError, g as verifySignature, h as verifyJsonLd, i as attachSignature, n as UnsafeJsonLdError, o as createSignature, p as signJsonLd, s as detachSignature, u as hasSignatureLike } from "../ld-Dwc176V4.mjs";
11
+ import { o as generateCryptoKeyPair } from "../key-C0giKuki.mjs";
12
+ import { a as compactJsonLd, f as isInvalidUrlTypeError, g as verifySignature, h as verifyJsonLd, i as attachSignature, n as UnsafeJsonLdError, o as createSignature, p as signJsonLd, s as detachSignature, u as hasSignatureLike } from "../ld-CWDReGMZ.mjs";
13
13
  import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DIJNHW-Y.mjs";
14
14
  import { CryptographicKey } from "@fedify/vocab";
15
15
  import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
package/dist/sig/mod.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  const { URLPattern } = require("urlpattern-polyfill");
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const require_http = require("../http-B1J6E-bT.cjs");
4
- const require_portable_collection = require("../portable-collection-PTGD0q70.cjs");
3
+ const require_http = require("../http-DSYQQn23.cjs");
4
+ const require_portable_collection = require("../portable-collection-BD8fE3j3.cjs");
5
5
  exports.attachSignature = require_http.attachSignature;
6
6
  exports.createProof = require_http.createProof;
7
7
  exports.createSignature = require_http.createSignature;
package/dist/sig/mod.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { B as fetchKeyDetailed, C as attachSignature, E as detachSignature, F as verifySignature, H as importJwk, L as exportJwk, M as signJsonLd, P as verifyJsonLd, T as createSignature, V as generateCryptoKeyPair, a as signRequest, d as createProof, dt as parseAcceptSignature, f as hasProofLike, ft as validateAcceptSignature, g as verifyPortableObjectProof, h as verifyObject, k as hasSignatureLike, lt as formatAcceptSignature, o as verifyRequest, p as signObject, s as verifyRequestDetailed, ut as fulfillAcceptSignature, y as verifyProof, z as fetchKey } from "../http-C2M6wcs8.js";
4
- import { n as doesActorOwnKey, r as getKeyOwner, t as verifyPortableObject } from "../portable-collection-CgglAI9B.js";
3
+ import { B as fetchKeyDetailed, C as attachSignature, E as detachSignature, F as verifySignature, H as importJwk, L as exportJwk, M as signJsonLd, P as verifyJsonLd, T as createSignature, V as generateCryptoKeyPair, a as signRequest, d as createProof, dt as parseAcceptSignature, f as hasProofLike, ft as validateAcceptSignature, g as verifyPortableObjectProof, h as verifyObject, k as hasSignatureLike, lt as formatAcceptSignature, o as verifyRequest, p as signObject, s as verifyRequestDetailed, ut as fulfillAcceptSignature, y as verifyProof, z as fetchKey } from "../http-D4KW2GTi.js";
4
+ import { n as doesActorOwnKey, r as getKeyOwner, t as verifyPortableObject } from "../portable-collection-CG9P_i0E.js";
5
5
  export { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getKeyOwner, hasProofLike, hasSignatureLike, importJwk, parseAcceptSignature, signJsonLd, signObject, signRequest, validateAcceptSignature, verifyJsonLd, verifyObject, verifyPortableObject, verifyPortableObjectProof, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
@@ -6,7 +6,7 @@ import { t as assertFalse } from "../assert_false-CPdRnc3E.mjs";
6
6
  import "../std__assert-DvMDRPes.mjs";
7
7
  import { t as assert } from "../assert-D1Eafmd_.mjs";
8
8
  import { o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
9
- import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-BNHhwjNu.mjs";
9
+ import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-CgoCOTUQ.mjs";
10
10
  import { Create, CryptographicKey, lookupObject } from "@fedify/vocab";
11
11
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
12
12
  //#region src/sig/owner.test.ts
@@ -2,7 +2,7 @@ import "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { n as ed25519PrivateKey, r as ed25519PublicKey } from "../keys-DIJNHW-Y.mjs";
5
- import { t as verifyPortableObject } from "../portable-collection-CRpTUHCY.mjs";
5
+ import { t as verifyPortableObject } from "../portable-collection-0_5DyXMt.mjs";
6
6
  import { Collection, CollectionPage, Note, OrderedCollection, Person, traverseCollection } from "@fedify/vocab";
7
7
  import { test } from "@fedify/fixture";
8
8
  import { FetchError, encodeMultibase, exportDidKey, preloadedContexts } from "@fedify/vocab-runtime";
@@ -2,12 +2,12 @@ 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 { i as fetchKey } from "../key-DolJjJab.mjs";
6
- import { h as verifyJsonLd, p as signJsonLd } from "../ld-Dwc176V4.mjs";
7
- import { n as createProof, u as verifyProof } from "../proof-B4_0E-KU.mjs";
8
- import { d as verifyRequest, f as verifyRequestDetailed, l as signRequest } from "../http-BpOiZE09.mjs";
5
+ import { i as fetchKey } from "../key-C0giKuki.mjs";
6
+ import { h as verifyJsonLd, p as signJsonLd } from "../ld-CWDReGMZ.mjs";
7
+ import { n as createProof, u as verifyProof } from "../proof-B5s-W6Sm.mjs";
8
+ import { d as verifyRequest, f as verifyRequestDetailed, l as signRequest } from "../http-CEx2SZjf.mjs";
9
9
  import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
10
- import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-BNHhwjNu.mjs";
10
+ import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-CgoCOTUQ.mjs";
11
11
  import { t as KvKeyCache } from "../keycache-BInaECGj.mjs";
12
12
  import { Create, CryptographicKey, Multikey, Note, Person } from "@fedify/vocab";
13
13
  import { test } from "@fedify/fixture";
@@ -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 { i as signObject, n as createProof, o as verifyObject, r as hasProofLike, s as verifyPortableObjectProof, u as verifyProof } from "../proof-B4_0E-KU.mjs";
14
- import { d as verifyRequest } from "../http-BpOiZE09.mjs";
13
+ import { i as signObject, n as createProof, o as verifyObject, r as hasProofLike, s as verifyPortableObjectProof, u as verifyProof } from "../proof-B5s-W6Sm.mjs";
14
+ import { d as verifyRequest } from "../http-CEx2SZjf.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-BbS0rO-Y.mjs";
16
+ import { t as getAuthenticatedDocumentLoader } from "../docloader-B5BIo7e9.mjs";
17
17
  import { Create, DataIntegrityProof, Document, Multikey, Note, PUBLIC_COLLECTION, Place, Translation } from "@fedify/vocab";
18
18
  import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
19
19
  import { decodeMultibase, encodeMultibase, exportDidKey, exportMultibaseKey, formatIri, importMultibaseKey, parseIri } from "@fedify/vocab-runtime";
@@ -1655,6 +1655,48 @@ test("verifyObject() hydrates pending proof references", async () => {
1655
1655
  assertEquals(proofFetches, 1);
1656
1656
  assertInstanceOf(verified, Note);
1657
1657
  });
1658
+ test("verifyObject() does not pass its proof verifier on to cached proofs", async () => {
1659
+ const did = await exportDidKey(ed25519PublicKey.publicKey);
1660
+ const method = did.substring(8);
1661
+ const keyId = new URL(`${did}#${method}`);
1662
+ const proofUrl = `ap://did:key:${method}/proofs/1`;
1663
+ const signed = await signPortableJsonLd({
1664
+ "@context": portableContext,
1665
+ id: `ap://did:key:${method}/objects/1`,
1666
+ type: "Note",
1667
+ attributedTo: `ap://did:key:${method}/actor`,
1668
+ content: "Portable note with a referenced proof"
1669
+ }, {
1670
+ verificationMethod: keyId,
1671
+ proofOptions: { id: proofUrl }
1672
+ });
1673
+ const rawProof = signed.proof;
1674
+ const referencedJsonLd = { ...signed };
1675
+ delete referencedJsonLd.proof;
1676
+ referencedJsonLd["https://w3id.org/security#proof"] = [{ "@graph": [rawProof] }, { "@graph": [{ "@id": proofUrl }] }];
1677
+ const rootVerifier = async () => ({ verified: false });
1678
+ for (const verifyPortableObject of [void 0, rootVerifier]) {
1679
+ let proofFetches = 0;
1680
+ const verified = await verifyObject(Note, referencedJsonLd, {
1681
+ documentLoader(url) {
1682
+ proofFetches++;
1683
+ return Promise.resolve({
1684
+ contextUrl: null,
1685
+ document: structuredClone(rawProof),
1686
+ documentUrl: url
1687
+ });
1688
+ },
1689
+ contextLoader: mockDocumentLoader,
1690
+ ...verifyPortableObject == null ? {} : { verifyPortableObject }
1691
+ });
1692
+ assertInstanceOf(verified, Note);
1693
+ assertEquals(proofFetches, 1);
1694
+ const proofs = await Array.fromAsync(verified.getProofs());
1695
+ assertEquals(proofs.length, 2);
1696
+ assertEquals(proofFetches, 1);
1697
+ for (const proof of proofs) assert(proof._verifyPortableObject === verifyPortableObject);
1698
+ }
1699
+ });
1658
1700
  test("verifyObject() hydrates portable proof references with gateway hints", async () => {
1659
1701
  const did = await exportDidKey(ed25519PublicKey.publicKey);
1660
1702
  const method = did.substring(8);
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { c as getNormalizationContextLoader } from "./ld-Dwc176V4.mjs";
4
+ import { c as getNormalizationContextLoader } from "./ld-CWDReGMZ.mjs";
5
5
  import jsonld from "@fedify/vocab-runtime/jsonld";
6
6
  //#region src/federation/temporal.ts
7
7
  function isPlainObject(value) {
@@ -6,7 +6,7 @@ import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
6
6
  import { t as ManualClockKvStore } from "../kv-DBRWVx3Q.mjs";
7
7
  import { n as baseOptions, o as stringSchema, t as MockQueue } from "../tasks-dbCShlCb.mjs";
8
8
  import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
9
- import { o as createFederation } from "../middleware-DN3MdTDg.mjs";
9
+ import { o as createFederation } from "../middleware-CAWRGSwH.mjs";
10
10
  //#region src/testing/kv.test.ts
11
11
  test("ManualClockKvStore keeps an entry at its exact expiration instant", async () => {
12
12
  const kv = new ManualClockKvStore();
@@ -2891,8 +2891,9 @@ interface Context<TContextData> {
2891
2891
  * property accessors, `lookupObject()`, and `traverseCollection()`, passing
2892
2892
  * a context as their options applies the policy, e.g.,
2893
2893
  * `await create.getObject(ctx)`. Objects parsed with a context as options,
2894
- * such as activities that inboxes receive, also use it by default for
2895
- * their property accessors. It never verifies an object by itself being
2894
+ * such as activities that inboxes receive, and objects that accessors
2895
+ * fetch with a context as options also use it by default for their
2896
+ * property accessors. It never verifies an object by itself being
2896
2897
  * there: it only applies to objects that are dereferenced.
2897
2898
  *
2898
2899
  * It is optional only so that custom implementations of this interface
@@ -5,9 +5,9 @@ import { t as esm_default } from "../esm-BHXXx4Wx.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
6
6
  import "../std__assert-DvMDRPes.mjs";
7
7
  import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
8
- import { d as verifyRequest } from "../http-BpOiZE09.mjs";
8
+ import { d as verifyRequest } from "../http-CEx2SZjf.mjs";
9
9
  import { i as rsaPrivateKey2 } from "../keys-DIJNHW-Y.mjs";
10
- import { t as getAuthenticatedDocumentLoader } from "../docloader-BbS0rO-Y.mjs";
10
+ import { t as getAuthenticatedDocumentLoader } from "../docloader-B5BIo7e9.mjs";
11
11
  import { configure, reset } from "@logtape/logtape";
12
12
  import { mockDocumentLoader, test } from "@fedify/fixture";
13
13
  import { FetchError, UrlError } from "@fedify/vocab-runtime";
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as kvCache, t as MockKvStore } from "../kv-cache-Bq2cah0c.mjs";
4
+ import { n as kvCache, t as MockKvStore } from "../kv-cache-AWTrxTq3.mjs";
5
5
  import { deepStrictEqual, throws } from "node:assert";
6
6
  import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
7
7
  import { preloadedContexts } from "@fedify/vocab-runtime";
@@ -1,5 +1,5 @@
1
1
  const { URLPattern } = require("urlpattern-polyfill");
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const require_kv_cache = require("../kv-cache-D9nRbG2Q.cjs");
3
+ const require_kv_cache = require("../kv-cache-BcsvaCCL.cjs");
4
4
  exports.getAuthenticatedDocumentLoader = require_kv_cache.getAuthenticatedDocumentLoader;
5
5
  exports.kvCache = require_kv_cache.kvCache;
package/dist/utils/mod.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../kv-cache-D7TiyMxv.js";
3
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../kv-cache-D_E-2K3i.js";
4
4
  export { getAuthenticatedDocumentLoader, kvCache };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/fedify",
3
- "version": "2.4.0-dev.2129+c0ddb433",
3
+ "version": "2.4.0-dev.2141+881cc858",
4
4
  "description": "An ActivityPub server framework",
5
5
  "keywords": [
6
6
  "ActivityPub",
@@ -151,10 +151,10 @@
151
151
  "structured-field-values": "^2.0.4",
152
152
  "temporal-polyfill": "^1.0.1",
153
153
  "urlpattern-polyfill": "^10.1.0",
154
- "@fedify/uri-template": "2.4.0-dev.2129+c0ddb433",
155
- "@fedify/vocab": "2.4.0-dev.2129+c0ddb433",
156
- "@fedify/webfinger": "2.4.0-dev.2129+c0ddb433",
157
- "@fedify/vocab-runtime": "2.4.0-dev.2129+c0ddb433"
154
+ "@fedify/uri-template": "2.4.0-dev.2141+881cc858",
155
+ "@fedify/vocab": "2.4.0-dev.2141+881cc858",
156
+ "@fedify/vocab-runtime": "2.4.0-dev.2141+881cc858",
157
+ "@fedify/webfinger": "2.4.0-dev.2141+881cc858"
158
158
  },
159
159
  "devDependencies": {
160
160
  "@std/assert": "npm:@jsr/std__assert@^0.226.0",
@@ -167,7 +167,7 @@
167
167
  "typescript": "^6.0.0",
168
168
  "wrangler": "^4.17.0",
169
169
  "@fedify/fixture": "2.0.0",
170
- "@fedify/vocab-tools": "^2.4.0-dev.2129+c0ddb433"
170
+ "@fedify/vocab-tools": "^2.4.0-dev.2141+881cc858"
171
171
  },
172
172
  "scripts": {
173
173
  "build:self": "tsdown",