@fedify/fedify 2.2.0-pr.695.16 → 2.2.0-pr.697.18

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 (63) hide show
  1. package/dist/activity-listener-Ck3JZ_hR.mjs +40 -0
  2. package/dist/{builder-7PVCiLiR.mjs → builder-CssIxEgK.mjs} +57 -7
  3. package/dist/compat/mod.d.cts +1 -1
  4. package/dist/compat/mod.d.ts +1 -1
  5. package/dist/compat/transformers.test.mjs +1 -1
  6. package/dist/{context-78ecvxf5.d.ts → context-BGrYMSTk.d.ts} +143 -1
  7. package/dist/{context-DYDPdoCb.d.cts → context-CMUd4wy0.d.cts} +143 -1
  8. package/dist/{context-Juj6bdHC.mjs → context-Dk_tacqz.mjs} +17 -2
  9. package/dist/{deno-vxcWcxQS.mjs → deno-DFC3hdDk.mjs} +1 -1
  10. package/dist/{docloader-D7q0-Xef.mjs → docloader-DJSGzW4N.mjs} +2 -2
  11. package/dist/federation/builder.test.mjs +25 -1
  12. package/dist/federation/handler.test.mjs +369 -8
  13. package/dist/federation/idempotency.test.mjs +2 -2
  14. package/dist/federation/inbox.test.mjs +3 -3
  15. package/dist/federation/middleware.test.mjs +510 -8
  16. package/dist/federation/mod.cjs +1 -1
  17. package/dist/federation/mod.d.cts +3 -3
  18. package/dist/federation/mod.d.ts +3 -3
  19. package/dist/federation/mod.js +1 -1
  20. package/dist/federation/send.test.mjs +3 -3
  21. package/dist/federation/webfinger.test.mjs +2 -2
  22. package/dist/{http-RZPxDWq5.mjs → http-BrF-JQov.mjs} +2 -2
  23. package/dist/{http-JxF7bG0o.cjs → http-DDRsBRY5.cjs} +1 -1
  24. package/dist/{http-D-MhhYUF.js → http-nVAbZPuI.js} +1 -1
  25. package/dist/{key-CGx_dDkX.mjs → key-2MxqHz-F.mjs} +1 -1
  26. package/dist/{kv-cache-D84Mk0fZ.js → kv-cache-5w7DZnmJ.js} +1 -1
  27. package/dist/{kv-cache-C2gdVgvb.cjs → kv-cache-CPeV5q6I.cjs} +1 -1
  28. package/dist/{ld-wup-liFO.mjs → ld-bY6topKr.mjs} +26 -3
  29. package/dist/{middleware-BjVx-_bv.mjs → middleware-BCJUFXYb.mjs} +612 -180
  30. package/dist/{middleware-Bn75dPug.cjs → middleware-BPHO6DE3.cjs} +676 -323
  31. package/dist/{middleware-RF-sUfTr.js → middleware-C10kVjEo.js} +670 -322
  32. package/dist/{middleware-wdfeWjRJ.mjs → middleware-DI82-dr3.mjs} +1 -1
  33. package/dist/{middleware-CXOVT4Ph.cjs → middleware-JAlnEFGy.cjs} +1 -1
  34. package/dist/{mod-CEohtXhV.d.cts → mod-BcJHeuv1.d.cts} +1 -1
  35. package/dist/{mod-CokIUYDr.d.ts → mod-CJXfyw7v.d.ts} +1 -1
  36. package/dist/{mod-DvxszxXC.d.ts → mod-CR8soWa9.d.ts} +18 -1
  37. package/dist/{mod-DoJBjjnO.d.cts → mod-Cr3f-ACa.d.cts} +18 -1
  38. package/dist/mod.cjs +6 -4
  39. package/dist/mod.d.cts +5 -5
  40. package/dist/mod.d.ts +5 -5
  41. package/dist/mod.js +5 -5
  42. package/dist/nodeinfo/handler.test.mjs +2 -2
  43. package/dist/{owner-q2mUMM9a.mjs → owner-D4-A8f_n.mjs} +2 -2
  44. package/dist/{proof--CpZsF_p.mjs → proof-45_MjnD1.mjs} +32 -3
  45. package/dist/{proof-_Zyfqyce.cjs → proof-COdach6j.cjs} +61 -3
  46. package/dist/{proof-CirP9OSd.js → proof-CnfkRjXL.js} +54 -2
  47. package/dist/{send-CVJfx7bF.mjs → send-BeNvLSaC.mjs} +2 -2
  48. package/dist/sig/http.test.mjs +2 -2
  49. package/dist/sig/key.test.mjs +1 -1
  50. package/dist/sig/ld.test.mjs +44 -2
  51. package/dist/sig/mod.cjs +4 -2
  52. package/dist/sig/mod.d.cts +2 -2
  53. package/dist/sig/mod.d.ts +2 -2
  54. package/dist/sig/mod.js +3 -3
  55. package/dist/sig/owner.test.mjs +1 -1
  56. package/dist/sig/proof.test.mjs +46 -2
  57. package/dist/testing/mod.d.mts +149 -1
  58. package/dist/testing/mod.mjs +2 -2
  59. package/dist/utils/docloader.test.mjs +2 -2
  60. package/dist/utils/mod.cjs +1 -1
  61. package/dist/utils/mod.js +1 -1
  62. package/package.json +5 -5
  63. package/dist/inbox-CmYvcSMM.mjs +0 -179
@@ -1,11 +1,11 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as createRequestContext } from "../context-Juj6bdHC.mjs";
4
+ import { r as createRequestContext } from "../context-Dk_tacqz.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
6
  import "../std__assert-Duiq_YC9.mjs";
7
7
  import { t as MemoryKvStore } from "../kv-tL2TOE9X.mjs";
8
- import { a as createFederation, o as handleWebFinger } from "../middleware-BjVx-_bv.mjs";
8
+ import { o as createFederation, s as handleWebFinger } from "../middleware-BCJUFXYb.mjs";
9
9
  import { test } from "@fedify/fixture";
10
10
  import { Image, Link, Person, Tombstone } from "@fedify/vocab";
11
11
  //#region src/federation/webfinger.test.ts
@@ -1,9 +1,9 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-vxcWcxQS.mjs";
4
+ import { n as version, t as name } from "./deno-DFC3hdDk.mjs";
5
5
  import { i as validateAcceptSignature, n as fulfillAcceptSignature, r as parseAcceptSignature } from "./accept-Dd__NiUL.mjs";
6
- import { o as validateCryptoKey, r as fetchKeyDetailed } from "./key-CGx_dDkX.mjs";
6
+ import { o as validateCryptoKey, r as fetchKeyDetailed } from "./key-2MxqHz-F.mjs";
7
7
  import { CryptographicKey } from "@fedify/vocab";
8
8
  import { SpanStatusCode, trace } from "@opentelemetry/api";
9
9
  import { FetchError } from "@fedify/vocab-runtime";
@@ -11,7 +11,7 @@ let _opentelemetry_semantic_conventions = require("@opentelemetry/semantic-conve
11
11
  let byte_encodings_base64 = require("byte-encodings/base64");
12
12
  //#region deno.json
13
13
  var name = "@fedify/fedify";
14
- var version = "2.2.0-pr.695.16+7a782334";
14
+ var version = "2.2.0-pr.697.18+b776632f";
15
15
  //#endregion
16
16
  //#region src/sig/accept.ts
17
17
  /**
@@ -10,7 +10,7 @@ import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } fro
10
10
  import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
11
11
  //#region deno.json
12
12
  var name = "@fedify/fedify";
13
- var version = "2.2.0-pr.695.16+7a782334";
13
+ var version = "2.2.0-pr.697.18+b776632f";
14
14
  //#endregion
15
15
  //#region src/sig/accept.ts
16
16
  /**
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-vxcWcxQS.mjs";
4
+ import { n as version, t as name } from "./deno-DFC3hdDk.mjs";
5
5
  import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
6
6
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
7
7
  import { FetchError, getDocumentLoader } from "@fedify/vocab-runtime";
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { d as validateCryptoKey, t as doubleKnock } from "./http-D-MhhYUF.js";
3
+ import { d as validateCryptoKey, t as doubleKnock } from "./http-nVAbZPuI.js";
4
4
  import { getLogger } from "@logtape/logtape";
5
5
  import { curry } from "es-toolkit";
6
6
  import { UrlError, createActivityPubRequest, getRemoteDocument, logRequest, preloadedContexts, validatePublicUrl } from "@fedify/vocab-runtime";
@@ -1,7 +1,7 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  require("./chunk-DDcVe30Y.cjs");
4
- const require_http = require("./http-JxF7bG0o.cjs");
4
+ const require_http = require("./http-DDRsBRY5.cjs");
5
5
  let _logtape_logtape = require("@logtape/logtape");
6
6
  let es_toolkit = require("es-toolkit");
7
7
  let _fedify_vocab_runtime = require("@fedify/vocab-runtime");
@@ -1,8 +1,8 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-vxcWcxQS.mjs";
5
- import { n as fetchKey, o as validateCryptoKey } from "./key-CGx_dDkX.mjs";
4
+ import { n as version, t as name } from "./deno-DFC3hdDk.mjs";
5
+ import { n as fetchKey, o as validateCryptoKey } from "./key-2MxqHz-F.mjs";
6
6
  import { Activity, CryptographicKey, Object as Object$1, getTypeId } from "@fedify/vocab";
7
7
  import { SpanStatusCode, trace } from "@opentelemetry/api";
8
8
  import { getDocumentLoader } from "@fedify/vocab-runtime";
@@ -94,6 +94,29 @@ async function signJsonLd(jsonLd, privateKey, keyId, options) {
94
94
  });
95
95
  }
96
96
  /**
97
+ * Checks if the given JSON-LD document has a Linked Data Signature-like
98
+ * object, without restricting it to a single suite-specific shape.
99
+ * @param jsonLd The JSON-LD document to check.
100
+ * @returns `true` if the document has a signature-like object; `false`
101
+ * otherwise.
102
+ * @since 2.2.0
103
+ */
104
+ function hasSignatureLike(jsonLd) {
105
+ if (typeof jsonLd !== "object" || jsonLd == null) return false;
106
+ const signature = jsonLd.signature;
107
+ const hasReference = (value) => {
108
+ if (typeof value === "string") return true;
109
+ if (Array.isArray(value)) return value.some(hasReference);
110
+ return typeof value === "object" && value != null && ("id" in value && typeof value.id === "string" || "@id" in value && typeof value["@id"] === "string");
111
+ };
112
+ const hasSignatureObject = (value) => {
113
+ if (typeof value !== "object" || value == null) return false;
114
+ const signatureRecord = value;
115
+ return (typeof signatureRecord.type === "string" || Array.isArray(signatureRecord.type) && signatureRecord.type.some((item) => typeof item === "string")) && (hasReference(signatureRecord.creator) || hasReference(signatureRecord.verificationMethod)) && (typeof signatureRecord.signatureValue === "string" || typeof signatureRecord.jws === "string");
116
+ };
117
+ return Array.isArray(signature) ? signature.some(hasSignatureObject) : hasSignatureObject(signature);
118
+ }
119
+ /**
97
120
  * Checks if the given JSON-LD document has a Linked Data Signature.
98
121
  * @param jsonLd The JSON-LD document to check.
99
122
  * @returns `true` if the document has a signature; `false` otherwise.
@@ -253,4 +276,4 @@ async function hashJsonLd(jsonLd, contextLoader) {
253
276
  return encodeHex(await crypto.subtle.digest("SHA-256", encoder.encode(canon)));
254
277
  }
255
278
  //#endregion
256
- export { signJsonLd as a, hasSignature as i, createSignature as n, verifyJsonLd as o, detachSignature as r, verifySignature as s, attachSignature as t };
279
+ export { signJsonLd as a, hasSignatureLike as i, createSignature as n, verifyJsonLd as o, detachSignature as r, verifySignature as s, attachSignature as t };