@fedify/fedify 2.5.0-dev.2494 → 2.5.0-dev.2500

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 (102) hide show
  1. package/dist/{builder-Y3pokaG2.mjs → builder-SNy83ctF.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-BM7AINht.mjs → compound-proof-CuPaRl9U.mjs} +2 -2
  6. package/dist/{context-COHd1Rsh.mjs → context-A-Nde3u-.mjs} +1 -1
  7. package/dist/{context-DSuL3YWx.d.cts → context-De6_qvb7.d.cts} +12 -11
  8. package/dist/{context-DQJE9YfH.d.ts → context-TVf3fdlB.d.ts} +12 -11
  9. package/dist/{deno-D7blYLbb.mjs → deno-CsxrXtWa.mjs} +1 -1
  10. package/dist/{docloader-DbBbDaY-.mjs → docloader--D95F073.mjs} +2 -2
  11. package/dist/federation/builder.test.mjs +1 -1
  12. package/dist/federation/compound-fanout.test.mjs +3 -3
  13. package/dist/federation/handler-compound-proof.test.mjs +4 -4
  14. package/dist/federation/handler.test.mjs +10 -6
  15. package/dist/federation/hashlink-media.test.mjs +2 -2
  16. package/dist/federation/idempotency.test.mjs +2 -2
  17. package/dist/federation/inbox-actorless.test.mjs +55 -20
  18. package/dist/federation/inbox-authentication.test.mjs +112 -8
  19. package/dist/federation/inbox-report.test.mjs +13 -9
  20. package/dist/federation/inbox-view.test.mjs +1 -1
  21. package/dist/federation/inbox.test.mjs +1 -1
  22. package/dist/federation/metrics.test.mjs +1 -1
  23. package/dist/federation/middleware.test.mjs +8 -8
  24. package/dist/federation/mod.cjs +1 -1
  25. package/dist/federation/mod.d.cts +2 -2
  26. package/dist/federation/mod.d.ts +2 -2
  27. package/dist/federation/mod.js +1 -1
  28. package/dist/federation/mq.test.mjs +1 -1
  29. package/dist/federation/outgoing-proof.test.mjs +4 -4
  30. package/dist/federation/portable-actor.test.mjs +3 -3
  31. package/dist/federation/portable-chain.test.mjs +3 -3
  32. package/dist/federation/portable-collection.test.mjs +4 -4
  33. package/dist/federation/portable-delivery.test.mjs +2 -2
  34. package/dist/federation/portable-gateway-keys.test.mjs +6 -6
  35. package/dist/federation/portable-inbox.test.mjs +4 -4
  36. package/dist/federation/portable-parse-uri.test.mjs +1 -1
  37. package/dist/federation/portable-route-activity.test.mjs +2 -2
  38. package/dist/federation/portable.test.mjs +3 -3
  39. package/dist/federation/send.test.mjs +3 -3
  40. package/dist/federation/tasks/enqueue.test.mjs +2 -2
  41. package/dist/federation/tasks/tasks.test.mjs +3 -3
  42. package/dist/federation/temporal.test.mjs +1 -1
  43. package/dist/federation/webfinger.test.mjs +2 -2
  44. package/dist/{federation-CFaTsSMN.cjs → federation-B-rXYPHr.cjs} +61 -49
  45. package/dist/{http-CxKd10Lq.mjs → http-CVDBHMLY.mjs} +4 -4
  46. package/dist/{http-2SwIR4b-.cjs → http-DXinHD8N.cjs} +1 -1
  47. package/dist/{http-CrYxBKqG.js → http-pp-ezSve.js} +1 -1
  48. package/dist/{inbox-CM0UktG8.mjs → inbox-DiZdzcME.mjs} +3 -3
  49. package/dist/{inbox-authentication-DflPYlLL.mjs → inbox-authentication-CgonVRkg.mjs} +41 -14
  50. package/dist/{inbox-view-BJ5DBPFo.mjs → inbox-view-BV7f1seI.mjs} +1 -1
  51. package/dist/{kv-cache-CIdGATck.mjs → kv-cache-BxZh__fO.mjs} +1 -1
  52. package/dist/{kv-cache-DbgFe35y.js → kv-cache-C30xcebA.js} +1 -1
  53. package/dist/{kv-cache-Cd8xKv-x.cjs → kv-cache-DYgeImco.cjs} +1 -1
  54. package/dist/{ld-DUeBHFWH.mjs → ld-DjN0ClIo.mjs} +2 -2
  55. package/dist/{metrics-B7TvoAP7.mjs → metrics-CLY7puRu.mjs} +1 -1
  56. package/dist/{middleware-CId6efsJ.js → middleware-BkZ-V26C.js} +53 -41
  57. package/dist/{middleware-BE4JXx-U.mjs → middleware-CDgUvT3j.mjs} +1 -1
  58. package/dist/{middleware-BEaUojg7.mjs → middleware-CM2qToci.mjs} +26 -41
  59. package/dist/{mod-6TQ4UQZb.d.cts → mod-oYNzF2VJ.d.cts} +1 -1
  60. package/dist/{mod-CIeBgsOC.d.ts → mod-xr6CN9Vz.d.ts} +1 -1
  61. package/dist/mod.cjs +4 -4
  62. package/dist/mod.d.cts +2 -2
  63. package/dist/mod.d.ts +2 -2
  64. package/dist/mod.js +4 -4
  65. package/dist/nodeinfo/handler.test.mjs +2 -2
  66. package/dist/{owner-CwijV0c5.mjs → owner-CwIAw3J7.mjs} +3 -3
  67. package/dist/{portable-collection-2jn_4V7Y.js → portable-collection-CG03LGR1.js} +1 -1
  68. package/dist/{portable-collection-BeS88JJp.cjs → portable-collection-D8I6E3WW.cjs} +1 -1
  69. package/dist/{portable-collection-B023xqhZ.mjs → portable-collection-DL7UprdF.mjs} +2 -2
  70. package/dist/{portable-key-BpBucRfb.mjs → portable-key-CH5N_5yl.mjs} +1 -1
  71. package/dist/{proof-DQh2z9fx.mjs → proof-WYcq-_qG.mjs} +3 -3
  72. package/dist/{send-DN5HNBv-.mjs → send-DvoreDHu.mjs} +3 -3
  73. package/dist/sig/compound-proof-discovery.test.mjs +1 -1
  74. package/dist/sig/compound-proof-producer.test.mjs +1 -1
  75. package/dist/sig/compound-proof-verification.test.mjs +2 -2
  76. package/dist/sig/compound-proof.test.mjs +2 -2
  77. package/dist/sig/http.test.mjs +2 -2
  78. package/dist/sig/key.test.mjs +1 -1
  79. package/dist/sig/ld.test.mjs +1 -1
  80. package/dist/sig/mitra-receive-interop.test.mjs +4 -4
  81. package/dist/sig/mitra-send-interop.test.mjs +3 -3
  82. package/dist/sig/mod.cjs +2 -2
  83. package/dist/sig/mod.js +2 -2
  84. package/dist/sig/owner.test.mjs +1 -1
  85. package/dist/sig/portable-collection.test.mjs +1 -1
  86. package/dist/sig/portable-interop.test.mjs +3 -3
  87. package/dist/sig/portable-key.test.mjs +5 -5
  88. package/dist/sig/proof.test.mjs +3 -3
  89. package/dist/sig/tootik-request-interop.test.mjs +4 -4
  90. package/dist/sig/tootik-send-interop.test.mjs +3 -3
  91. package/dist/sig/verification.test.mjs +3 -3
  92. package/dist/{temporal-yl7Z7A6y.mjs → temporal-B4Y_8d0L.mjs} +1 -1
  93. package/dist/testing/kv.test.mjs +1 -1
  94. package/dist/testing/mod.d.mts +12 -11
  95. package/dist/testing/mod.mjs +2 -2
  96. package/dist/{testing-Dbr21vZk.mjs → testing-_9kJHvqh.mjs} +1 -1
  97. package/dist/utils/docloader.test.mjs +2 -2
  98. package/dist/utils/kv-cache.test.mjs +1 -1
  99. package/dist/utils/mod.cjs +1 -1
  100. package/dist/utils/mod.js +1 -1
  101. package/package.json +6 -6
  102. package/skills/fedify/SKILL.md +6 -1
@@ -1,12 +1,12 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { r as createRequestContext } from "../context-COHd1Rsh.mjs";
4
+ import { r as createRequestContext } from "../context-A-Nde3u-.mjs";
5
5
  import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
6
6
  import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
7
7
  import { t as assertNotEquals } from "../assert_not_equals-CpPK2t89.mjs";
8
8
  import "../std__assert-DvMDRPes.mjs";
9
- import { o as createFederation, s as handleWebFinger } from "../middleware-BEaUojg7.mjs";
9
+ import { o as createFederation, s as handleWebFinger } from "../middleware-CM2qToci.mjs";
10
10
  import { Image, Link, Person, Tombstone } from "@fedify/vocab";
11
11
  import { parseIri } from "@fedify/vocab-runtime";
12
12
  import { createTestMeterProvider, test } from "@fedify/fixture";
@@ -1,10 +1,10 @@
1
1
  const { URLPattern } = require("urlpattern-polyfill");
2
2
  const require_rolldown_runtime = require("./rolldown-runtime-Dmm3t92W.cjs");
3
3
  const require_transformers = require("./transformers-BalCrSsr.cjs");
4
- const require_http = require("./http-2SwIR4b-.cjs");
4
+ const require_http = require("./http-DXinHD8N.cjs");
5
5
  const require_types = require("./types-hKCCjii0.cjs");
6
- const require_portable_collection = require("./portable-collection-BeS88JJp.cjs");
7
- const require_kv_cache = require("./kv-cache-Cd8xKv-x.cjs");
6
+ const require_portable_collection = require("./portable-collection-D8I6E3WW.cjs");
7
+ const require_kv_cache = require("./kv-cache-DYgeImco.cjs");
8
8
  let _logtape_logtape = require("@logtape/logtape");
9
9
  let _fedify_uri_template = require("@fedify/uri-template");
10
10
  let _fedify_vocab = require("@fedify/vocab");
@@ -2859,7 +2859,7 @@ function normalizeActorId(id) {
2859
2859
  * @internal
2860
2860
  */
2861
2861
  function principalAuthenticates(principal, actorId) {
2862
- if (principal.kind === "portableAuthority") {
2862
+ if (principal.kind === "portable-authority") {
2863
2863
  if (!require_http.isPortableId(actorId)) return false;
2864
2864
  const did = require_http.getPortableDid(actorId);
2865
2865
  return did != null && did === require_http.getPortableDid(principal.id);
@@ -2897,11 +2897,45 @@ function principalAuthenticates(principal, actorId) {
2897
2897
  function isActorAuthenticated(evidence, actorId, options = {}) {
2898
2898
  return getEffectivePrincipals(evidence, options.scope).some((principal) => principalAuthenticates(principal, actorId));
2899
2899
  }
2900
+ const SERIALIZED_KINDS = {
2901
+ actor: "actor",
2902
+ "portable-authority": "portableAuthority"
2903
+ };
2904
+ const PUBLIC_KINDS = {
2905
+ actor: "actor",
2906
+ portableAuthority: "portable-authority"
2907
+ };
2908
+ const SERIALIZED_MECHANISMS = {
2909
+ "http-signatures": "httpSignatures",
2910
+ "linked-data-signatures": "linkedDataSignatures",
2911
+ "object-integrity-proofs": "objectIntegrityProofs",
2912
+ origin: "origin"
2913
+ };
2914
+ const PUBLIC_MECHANISMS = {
2915
+ httpSignatures: "http-signatures",
2916
+ linkedDataSignatures: "linked-data-signatures",
2917
+ objectIntegrityProofs: "object-integrity-proofs",
2918
+ origin: "origin"
2919
+ };
2920
+ /**
2921
+ * Converts an internal proof signer to the public authentication principal.
2922
+ * @param signer The authenticated signer.
2923
+ * @returns The public principal.
2924
+ * @internal
2925
+ */
2926
+ function toProofPrincipal(signer) {
2927
+ return {
2928
+ kind: PUBLIC_KINDS[signer.kind],
2929
+ id: signer.id,
2930
+ mechanism: "object-integrity-proofs",
2931
+ keyId: signer.keyId
2932
+ };
2933
+ }
2900
2934
  function serializePrincipal(principal) {
2901
2935
  return {
2902
- kind: principal.kind,
2936
+ kind: SERIALIZED_KINDS[principal.kind],
2903
2937
  id: principal.id.href,
2904
- mechanism: principal.mechanism,
2938
+ mechanism: SERIALIZED_MECHANISMS[principal.mechanism],
2905
2939
  keyId: principal.keyId?.href ?? null
2906
2940
  };
2907
2941
  }
@@ -2917,22 +2951,15 @@ function serializeAuthentication(evidence) {
2917
2951
  originAuthenticated: evidence.originAuthenticated.map(serializePrincipal)
2918
2952
  };
2919
2953
  }
2920
- const KINDS = /* @__PURE__ */ new Set(["actor", "portableAuthority"]);
2921
- const MECHANISMS = /* @__PURE__ */ new Set([
2922
- "httpSignatures",
2923
- "linkedDataSignatures",
2924
- "objectIntegrityProofs",
2925
- "origin"
2926
- ]);
2927
2954
  function deserializePrincipals(value) {
2928
2955
  if (!Array.isArray(value)) return null;
2929
2956
  const principals = [];
2930
2957
  for (const item of value) {
2931
- if (item == null || typeof item !== "object" || !KINDS.has(item.kind) || !MECHANISMS.has(item.mechanism) || typeof item.id !== "string" || !URL.canParse(item.id) || item.keyId != null && (typeof item.keyId !== "string" || !URL.canParse(item.keyId))) return null;
2958
+ if (item == null || typeof item !== "object" || !(typeof item.kind === "string" && Object.hasOwn(PUBLIC_KINDS, item.kind)) || !(typeof item.mechanism === "string" && Object.hasOwn(PUBLIC_MECHANISMS, item.mechanism)) || typeof item.id !== "string" || !URL.canParse(item.id) || item.keyId != null && (typeof item.keyId !== "string" || !URL.canParse(item.keyId))) return null;
2932
2959
  principals.push(Object.freeze({
2933
- kind: item.kind,
2960
+ kind: PUBLIC_KINDS[item.kind],
2934
2961
  id: new URL(item.id),
2935
- mechanism: item.mechanism,
2962
+ mechanism: PUBLIC_MECHANISMS[item.mechanism],
2936
2963
  keyId: item.keyId == null ? null : new URL(item.keyId)
2937
2964
  }));
2938
2965
  }
@@ -5567,13 +5594,13 @@ function recordCollectionMetrics(meterProvider, base, result, options = {}) {
5567
5594
  * @param parameters The parameters for handling the collection.
5568
5595
  * @returns A promise that resolves to an HTTP response.
5569
5596
  */
5570
- async function handleCollection(request, { name: name$2, identifier, uriGetter, filter, filterPredicate, context, collectionCallbacks, portable, tracerProvider, meterProvider, onUnauthorized, onNotFound }) {
5571
- const spanName = name$2.trim().replace(/\s+/g, "_");
5597
+ async function handleCollection(request, { name: name$1, identifier, uriGetter, filter, filterPredicate, context, collectionCallbacks, portable, tracerProvider, meterProvider, onUnauthorized, onNotFound }) {
5598
+ const spanName = name$1.trim().replace(/\s+/g, "_");
5572
5599
  tracerProvider = tracerProvider ?? _opentelemetry_api.trace.getTracerProvider();
5573
5600
  const tracer = tracerProvider.getTracer(require_http.name, require_http.version);
5574
5601
  const cursor = new URL(request.url).searchParams.get("cursor");
5575
5602
  const metricBase = {
5576
- kind: getCollectionMetricKind(name$2),
5603
+ kind: getCollectionMetricKind(name$1),
5577
5604
  page: cursor != null,
5578
5605
  dispatcher: "built_in"
5579
5606
  };
@@ -5619,7 +5646,7 @@ async function handleCollection(request, { name: name$2, identifier, uriGetter,
5619
5646
  span.setStatus({ code: _opentelemetry_api.SpanStatusCode.ERROR });
5620
5647
  return await onNotFound(request);
5621
5648
  }
5622
- const items = filterCollectionItems(page.items, name$2, filterPredicate);
5649
+ const items = filterCollectionItems(page.items, name$1, filterPredicate);
5623
5650
  itemCount = items.length;
5624
5651
  span.setAttribute("fedify.collection.items", itemCount);
5625
5652
  return items;
@@ -5661,7 +5688,7 @@ async function handleCollection(request, { name: name$2, identifier, uriGetter,
5661
5688
  } else {
5662
5689
  const uri = new URL(portable == null ? baseUri : pageBase);
5663
5690
  uri.searchParams.set("cursor", cursor);
5664
- const pageOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection_page ${name$2}`, {
5691
+ const pageOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection_page ${name$1}`, {
5665
5692
  kind: _opentelemetry_api.SpanKind.SERVER,
5666
5693
  attributes: {
5667
5694
  "activitypub.collection.id": uri.href,
@@ -5677,7 +5704,7 @@ async function handleCollection(request, { name: name$2, identifier, uriGetter,
5677
5704
  span.setStatus({ code: _opentelemetry_api.SpanStatusCode.ERROR });
5678
5705
  return await onNotFound(request);
5679
5706
  }
5680
- const items = filterCollectionItems(page.items, name$2, filterPredicate);
5707
+ const items = filterCollectionItems(page.items, name$1, filterPredicate);
5681
5708
  itemCount = items.length;
5682
5709
  span.setAttribute("fedify.collection.items", itemCount);
5683
5710
  return {
@@ -6503,7 +6530,7 @@ async function handleInboxInternal(request, parameters, span, snapshot) {
6503
6530
  if (ldSigKey?.ownerId != null) documentSigners = [{
6504
6531
  kind: "actor",
6505
6532
  id: ldSigKey.ownerId,
6506
- mechanism: "linkedDataSignatures",
6533
+ mechanism: "linked-data-signatures",
6507
6534
  keyId: ldSigKey.id
6508
6535
  }];
6509
6536
  if (await isActorlessCandidate(activity, viewSource)) {
@@ -6863,7 +6890,7 @@ async function handleInboxInternal(request, parameters, span, snapshot) {
6863
6890
  if (httpSigKey != null && !actorless && activity.actorId != null) requestSigners = [{
6864
6891
  kind: "actor",
6865
6892
  id: activity.actorId,
6866
- mechanism: "httpSignatures",
6893
+ mechanism: "http-signatures",
6867
6894
  keyId: httpSigKey.id
6868
6895
  }];
6869
6896
  if (actorless) {
@@ -6879,7 +6906,7 @@ async function handleInboxInternal(request, parameters, span, snapshot) {
6879
6906
  if (deferredLdSignatureError != null) throw deferredLdSignatureError;
6880
6907
  observation.authentication = {
6881
6908
  status: "rejected",
6882
- reason: { type: "noAuthenticatedPrincipal" }
6909
+ reason: { type: "no-authenticated-principal" }
6883
6910
  };
6884
6911
  logger.error("The activity {activityId} declares no actor, and no principal is authenticated for it.", {
6885
6912
  activity: json,
@@ -6899,7 +6926,7 @@ async function handleInboxInternal(request, parameters, span, snapshot) {
6899
6926
  observation.authentication = {
6900
6927
  status: "rejected",
6901
6928
  reason: {
6902
- type: "activityOriginMismatch",
6929
+ type: "activity-origin-mismatch",
6903
6930
  activityId: new URL(activity.id.href),
6904
6931
  actorIds: check.principals.map((principal) => principal.id)
6905
6932
  }
@@ -6983,7 +7010,7 @@ async function handleInboxInternal(request, parameters, span, snapshot) {
6983
7010
  observation.authentication = {
6984
7011
  status: "rejected",
6985
7012
  reason: {
6986
- type: "activityOriginMismatch",
7013
+ type: "activity-origin-mismatch",
6987
7014
  activityId: new URL(activity.id.href),
6988
7015
  actorIds: activity.actorIds.map((id) => new URL(id.href))
6989
7016
  }
@@ -7257,8 +7284,8 @@ var CustomCollectionHandler = class {
7257
7284
  * @param CollectionPage The CollectionPage constructor.
7258
7285
  * @param filterPredicate Optional filter predicate for items.
7259
7286
  */
7260
- constructor(name$1, values, context, callbacks, tracerProvider = _opentelemetry_api.trace.getTracerProvider(), meterProvider, Collection, CollectionPage, filterPredicate, portable) {
7261
- this.name = name$1;
7287
+ constructor(name$2, values, context, callbacks, tracerProvider = _opentelemetry_api.trace.getTracerProvider(), meterProvider, Collection, CollectionPage, filterPredicate, portable) {
7288
+ this.name = name$2;
7262
7289
  this.values = values;
7263
7290
  this.context = context;
7264
7291
  this.callbacks = callbacks;
@@ -7770,12 +7797,7 @@ const MIN_COMPONENTS = [
7770
7797
  * Turns the signers of verified Object Integrity Proofs into principals.
7771
7798
  */
7772
7799
  function toProofPrincipals(signers) {
7773
- return signers.map((signer) => ({
7774
- kind: signer.kind,
7775
- id: signer.id,
7776
- mechanism: "objectIntegrityProofs",
7777
- keyId: signer.keyId
7778
- }));
7800
+ return signers.map(toProofPrincipal);
7779
7801
  }
7780
7802
  /**
7781
7803
  * Gets the principal of an HTTP Signature key, whose owner was confirmed by
@@ -7788,7 +7810,7 @@ function getHttpKeyPrincipal(key) {
7788
7810
  return {
7789
7811
  kind: "actor",
7790
7812
  id: (0, _fedify_vocab_runtime.parseIri)(evidence.ownerId),
7791
- mechanism: "httpSignatures",
7813
+ mechanism: "http-signatures",
7792
7814
  keyId: key.id
7793
7815
  };
7794
7816
  } catch {
@@ -7798,7 +7820,7 @@ function getHttpKeyPrincipal(key) {
7798
7820
  return {
7799
7821
  kind: "actor",
7800
7822
  id: key.ownerId,
7801
- mechanism: "httpSignatures",
7823
+ mechanism: "http-signatures",
7802
7824
  keyId: key.id
7803
7825
  };
7804
7826
  }
@@ -12643,12 +12665,7 @@ var ContextImpl = class ContextImpl {
12643
12665
  const result = verifications.get(candidate.document);
12644
12666
  if (result?.verified === true && result.method === "proof") documentSigners = result.keys.flatMap((key) => {
12645
12667
  const signer = require_http.getProofSigner(key);
12646
- return signer == null ? [] : [{
12647
- kind: signer.kind,
12648
- id: signer.id,
12649
- mechanism: "objectIntegrityProofs",
12650
- keyId: signer.keyId
12651
- }];
12668
+ return signer == null ? [] : [toProofPrincipal(signer)];
12652
12669
  });
12653
12670
  } else originAuthenticated = fetched.actorIds.map((actorId) => ({
12654
12671
  kind: "actor",
@@ -12662,12 +12679,7 @@ var ContextImpl = class ContextImpl {
12662
12679
  activity: json
12663
12680
  });
12664
12681
  activity = verified.object;
12665
- documentSigners = verified.signers.map((signer) => ({
12666
- kind: signer.kind,
12667
- id: signer.id,
12668
- mechanism: "objectIntegrityProofs",
12669
- keyId: signer.keyId
12670
- }));
12682
+ documentSigners = verified.signers.map(toProofPrincipal);
12671
12683
  viewSource = {
12672
12684
  policy: "standard",
12673
12685
  source: "activity",
@@ -3,12 +3,12 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { m as parseKeyIdString } from "./portable-key-id-Ca30-hOa.mjs";
5
5
  import { a as verificationObservation, i as triedKey, n as observeCheck, t as observeAttempt } from "./verification-Dpfcw8ml.mjs";
6
- import { n as version, t as name } from "./deno-D7blYLbb.mjs";
7
- import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-B7TvoAP7.mjs";
6
+ import { n as version, t as name } from "./deno-CsxrXtWa.mjs";
7
+ import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-CLY7puRu.mjs";
8
8
  import { i as validateAcceptSignature, n as fulfillAcceptSignature, r as parseAcceptSignature } from "./accept-CPVqki78.mjs";
9
9
  import { a as promoteKeyOwnerEvidence } from "./key-owner-evidence-APB6NpSk.mjs";
10
- import { D as validateCryptoKey, b as bypassKeyCacheReads, w as fetchKeyDetailed } from "./ld-DUeBHFWH.mjs";
11
- import { n as resolvePortableActorKey, r as verifyPortableGatewayKeyDocument } from "./portable-key-BpBucRfb.mjs";
10
+ import { D as validateCryptoKey, b as bypassKeyCacheReads, w as fetchKeyDetailed } from "./ld-DjN0ClIo.mjs";
11
+ import { n as resolvePortableActorKey, r as verifyPortableGatewayKeyDocument } from "./portable-key-CH5N_5yl.mjs";
12
12
  import { getLogger } from "@logtape/logtape";
13
13
  import { CryptographicKey } from "@fedify/vocab";
14
14
  import { SpanStatusCode, trace } from "@opentelemetry/api";
@@ -17,7 +17,7 @@ json_canon = require_rolldown_runtime.__toESM(json_canon, 1);
17
17
  let _opentelemetry_semantic_conventions = require("@opentelemetry/semantic-conventions");
18
18
  //#region deno.json
19
19
  var name = "@fedify/fedify";
20
- var version = "2.5.0-dev.2494+f2e9b5d3";
20
+ var version = "2.5.0-dev.2500+0a9d005b";
21
21
  //#endregion
22
22
  //#region src/sig/portable-key-id.ts
23
23
  const COMPATIBLE_KEY_ID_PATH_PATTERN = /^\/\.well-known\/apgateway\/did(?::|%3A)/i;
@@ -15,7 +15,7 @@ import serialize from "json-canon";
15
15
  import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
16
16
  //#region deno.json
17
17
  var name = "@fedify/fedify";
18
- var version = "2.5.0-dev.2494+f2e9b5d3";
18
+ var version = "2.5.0-dev.2500+0a9d005b";
19
19
  //#endregion
20
20
  //#region src/sig/portable-key-id.ts
21
21
  const COMPATIBLE_KEY_ID_PATH_PATTERN = /^\/\.well-known\/apgateway\/did(?::|%3A)/i;
@@ -2,9 +2,9 @@ import { Temporal } from "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as getAuthenticationOrigin } from "./portable-key-id-Ca30-hOa.mjs";
5
- import { o as serializeAuthentication, r as getEffectivePrincipals } from "./inbox-authentication-DflPYlLL.mjs";
6
- import { n as version, t as name } from "./deno-D7blYLbb.mjs";
7
- import { g as recordInboxActivity, n as getDurationMs, r as getFederationMetrics } from "./metrics-B7TvoAP7.mjs";
5
+ import { o as serializeAuthentication, r as getEffectivePrincipals } from "./inbox-authentication-CgonVRkg.mjs";
6
+ import { n as version, t as name } from "./deno-CsxrXtWa.mjs";
7
+ import { g as recordInboxActivity, n as getDurationMs, r as getFederationMetrics } from "./metrics-CLY7puRu.mjs";
8
8
  import { getLogger } from "@logtape/logtape";
9
9
  import { getTypeId } from "@fedify/vocab";
10
10
  import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
@@ -49,7 +49,7 @@ function normalizeActorId(id) {
49
49
  * @internal
50
50
  */
51
51
  function principalAuthenticates(principal, actorId) {
52
- if (principal.kind === "portableAuthority") {
52
+ if (principal.kind === "portable-authority") {
53
53
  if (!isPortableId(actorId)) return false;
54
54
  const did = getPortableDid(actorId);
55
55
  return did != null && did === getPortableDid(principal.id);
@@ -87,11 +87,45 @@ function principalAuthenticates(principal, actorId) {
87
87
  function isActorAuthenticated(evidence, actorId, options = {}) {
88
88
  return getEffectivePrincipals(evidence, options.scope).some((principal) => principalAuthenticates(principal, actorId));
89
89
  }
90
+ const SERIALIZED_KINDS = {
91
+ actor: "actor",
92
+ "portable-authority": "portableAuthority"
93
+ };
94
+ const PUBLIC_KINDS = {
95
+ actor: "actor",
96
+ portableAuthority: "portable-authority"
97
+ };
98
+ const SERIALIZED_MECHANISMS = {
99
+ "http-signatures": "httpSignatures",
100
+ "linked-data-signatures": "linkedDataSignatures",
101
+ "object-integrity-proofs": "objectIntegrityProofs",
102
+ origin: "origin"
103
+ };
104
+ const PUBLIC_MECHANISMS = {
105
+ httpSignatures: "http-signatures",
106
+ linkedDataSignatures: "linked-data-signatures",
107
+ objectIntegrityProofs: "object-integrity-proofs",
108
+ origin: "origin"
109
+ };
110
+ /**
111
+ * Converts an internal proof signer to the public authentication principal.
112
+ * @param signer The authenticated signer.
113
+ * @returns The public principal.
114
+ * @internal
115
+ */
116
+ function toProofPrincipal(signer) {
117
+ return {
118
+ kind: PUBLIC_KINDS[signer.kind],
119
+ id: signer.id,
120
+ mechanism: "object-integrity-proofs",
121
+ keyId: signer.keyId
122
+ };
123
+ }
90
124
  function serializePrincipal(principal) {
91
125
  return {
92
- kind: principal.kind,
126
+ kind: SERIALIZED_KINDS[principal.kind],
93
127
  id: principal.id.href,
94
- mechanism: principal.mechanism,
128
+ mechanism: SERIALIZED_MECHANISMS[principal.mechanism],
95
129
  keyId: principal.keyId?.href ?? null
96
130
  };
97
131
  }
@@ -107,22 +141,15 @@ function serializeAuthentication(evidence) {
107
141
  originAuthenticated: evidence.originAuthenticated.map(serializePrincipal)
108
142
  };
109
143
  }
110
- const KINDS = /* @__PURE__ */ new Set(["actor", "portableAuthority"]);
111
- const MECHANISMS = /* @__PURE__ */ new Set([
112
- "httpSignatures",
113
- "linkedDataSignatures",
114
- "objectIntegrityProofs",
115
- "origin"
116
- ]);
117
144
  function deserializePrincipals(value) {
118
145
  if (!Array.isArray(value)) return null;
119
146
  const principals = [];
120
147
  for (const item of value) {
121
- if (item == null || typeof item !== "object" || !KINDS.has(item.kind) || !MECHANISMS.has(item.mechanism) || typeof item.id !== "string" || !URL.canParse(item.id) || item.keyId != null && (typeof item.keyId !== "string" || !URL.canParse(item.keyId))) return null;
148
+ if (item == null || typeof item !== "object" || !(typeof item.kind === "string" && Object.hasOwn(PUBLIC_KINDS, item.kind)) || !(typeof item.mechanism === "string" && Object.hasOwn(PUBLIC_MECHANISMS, item.mechanism)) || typeof item.id !== "string" || !URL.canParse(item.id) || item.keyId != null && (typeof item.keyId !== "string" || !URL.canParse(item.keyId))) return null;
122
149
  principals.push(Object.freeze({
123
- kind: item.kind,
150
+ kind: PUBLIC_KINDS[item.kind],
124
151
  id: new URL(item.id),
125
- mechanism: item.mechanism,
152
+ mechanism: PUBLIC_MECHANISMS[item.mechanism],
126
153
  keyId: item.keyId == null ? null : new URL(item.keyId)
127
154
  }));
128
155
  }
@@ -168,4 +195,4 @@ function createAuthenticationEvidence(evidence) {
168
195
  });
169
196
  }
170
197
  //#endregion
171
- export { isActorAuthenticated as a, getEmptyAuthenticationEvidence as i, deserializeAuthentication as n, serializeAuthentication as o, getEffectivePrincipals as r, createAuthenticationEvidence as t };
198
+ export { isActorAuthenticated as a, getEmptyAuthenticationEvidence as i, deserializeAuthentication as n, serializeAuthentication as o, getEffectivePrincipals as r, toProofPrincipal as s, createAuthenticationEvidence as t };
@@ -1,7 +1,7 @@
1
1
  import "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { c as getNormalizationContextLoader, p as markEffectiveContextLoader, s as detachSignature, y as wrapContextLoaderForJsonLd } from "./ld-DUeBHFWH.mjs";
4
+ import { c as getNormalizationContextLoader, p as markEffectiveContextLoader, s as detachSignature, y as wrapContextLoaderForJsonLd } from "./ld-DjN0ClIo.mjs";
5
5
  import { preloadedContexts } from "@fedify/vocab-runtime";
6
6
  import { encodeHex } from "byte-encodings/hex";
7
7
  import jsonld from "@fedify/vocab-runtime/jsonld";
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { p as recordDocumentCache } from "./metrics-B7TvoAP7.mjs";
4
+ import { p as recordDocumentCache } from "./metrics-CLY7puRu.mjs";
5
5
  import { getLogger } from "@logtape/logtape";
6
6
  import { preloadedContexts } from "@fedify/vocab-runtime";
7
7
  //#region src/utils/kv-cache.ts
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { X as validateCryptoKey, dt as recordDocumentCache, t as doubleKnockScoped } from "./http-CrYxBKqG.js";
3
+ import { X as validateCryptoKey, dt as recordDocumentCache, t as doubleKnockScoped } from "./http-pp-ezSve.js";
4
4
  import { getLogger } from "@logtape/logtape";
5
5
  import { FetchError, UrlError, createActivityPubRequest, getRemoteDocument, logRequest, preloadedContexts, resolveDocumentLoaderTimeout, withDocumentLoaderTimeout } from "@fedify/vocab-runtime";
6
6
  import { curry } from "es-toolkit";
@@ -1,5 +1,5 @@
1
1
  const { URLPattern } = require("urlpattern-polyfill");
2
- const require_http = require("./http-2SwIR4b-.cjs");
2
+ const require_http = require("./http-DXinHD8N.cjs");
3
3
  let _logtape_logtape = require("@logtape/logtape");
4
4
  let _fedify_vocab_runtime = require("@fedify/vocab-runtime");
5
5
  let es_toolkit = require("es-toolkit");
@@ -3,8 +3,8 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { c as isPortableActorDocument, d as isPortableUri, l as isPortableId, m as parseKeyIdString, s as isCompatibleKeyId } from "./portable-key-id-Ca30-hOa.mjs";
5
5
  import { a as verificationObservation, i as triedKey, n as observeCheck, t as observeAttempt } from "./verification-Dpfcw8ml.mjs";
6
- import { n as version, t as name } from "./deno-D7blYLbb.mjs";
7
- import { _ as recordKeyLookup, n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch, t as classifyFetchError } from "./metrics-B7TvoAP7.mjs";
6
+ import { n as version, t as name } from "./deno-CsxrXtWa.mjs";
7
+ import { _ as recordKeyLookup, n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch, t as classifyFetchError } from "./metrics-CLY7puRu.mjs";
8
8
  import { n as attachKeyOwnerEvidence, t as MAX_PORTABLE_KEY_TTL } from "./key-owner-evidence-APB6NpSk.mjs";
9
9
  import { getLogger } from "@logtape/logtape";
10
10
  import { Activity, CryptographicKey, Multikey, Object as Object$1, getTypeId, isActor } from "@fedify/vocab";
@@ -1,7 +1,7 @@
1
1
  import "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-D7blYLbb.mjs";
4
+ import { n as version, t as name } from "./deno-CsxrXtWa.mjs";
5
5
  import { metrics } from "@opentelemetry/api";
6
6
  import { FetchError } from "@fedify/vocab-runtime";
7
7
  //#region src/federation/metrics.ts