@fedify/fedify 2.5.0-dev.2332 → 2.5.0-dev.2355

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 (82) hide show
  1. package/dist/{builder-B5FCQEIY.mjs → builder-CQLrtVXj.mjs} +2 -2
  2. package/dist/compat/transformers.test.mjs +1 -1
  3. package/dist/{compound-proof-BOfX5ZI_.mjs → compound-proof-BVVJ7l69.mjs} +2 -2
  4. package/dist/{deno-BAG_1fYL.mjs → deno-ocYJ306k.mjs} +1 -1
  5. package/dist/{docloader-RGQuuAB3.mjs → docloader-kq9Chx_S.mjs} +2 -2
  6. package/dist/exporter-DThFfe7P.mjs +257 -0
  7. package/dist/federation/builder.test.mjs +1 -1
  8. package/dist/federation/compound-fanout.test.mjs +3 -3
  9. package/dist/federation/handler-compound-proof.test.mjs +3 -3
  10. package/dist/federation/handler.test.mjs +224 -5
  11. package/dist/federation/hashlink-media.test.mjs +2 -2
  12. package/dist/federation/idempotency.test.mjs +2 -2
  13. package/dist/federation/inbox-report.test.mjs +5 -5
  14. package/dist/federation/metrics.test.mjs +1 -1
  15. package/dist/federation/middleware.test.mjs +101 -8
  16. package/dist/federation/mod.cjs +1 -1
  17. package/dist/federation/mod.js +1 -1
  18. package/dist/federation/outgoing-proof.test.mjs +5 -5
  19. package/dist/federation/portable-actor.test.mjs +3 -3
  20. package/dist/federation/portable-chain.test.mjs +3 -3
  21. package/dist/federation/portable-collection.test.mjs +4 -4
  22. package/dist/federation/portable-delivery.test.mjs +2 -2
  23. package/dist/federation/portable-gateway-keys.test.mjs +4 -4
  24. package/dist/federation/portable-inbox.test.mjs +4 -4
  25. package/dist/federation/portable-parse-uri.test.mjs +1 -1
  26. package/dist/federation/portable-route-activity.test.mjs +2 -2
  27. package/dist/federation/portable.test.mjs +3 -3
  28. package/dist/federation/send.test.mjs +199 -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-B-XVudLj.cjs → federation-B6F8dIFG.cjs} +22 -14
  34. package/dist/{http-CV-U1gzt.mjs → http-C5xWwbV0.mjs} +4 -4
  35. package/dist/{http-BuLngk1F.cjs → http-C9T0cjbd.cjs} +1 -1
  36. package/dist/{http-DWdmr99_.js → http-Dxp3npYk.js} +1 -1
  37. package/dist/{key-eelLmVSs.mjs → key-DAA9n2ms.mjs} +2 -2
  38. package/dist/{kv-cache-DcyE1x0o.js → kv-cache-CKyL3Ut3.js} +1 -1
  39. package/dist/{kv-cache-BrkL2HsF.cjs → kv-cache-CrFiG0QG.cjs} +1 -1
  40. package/dist/{kv-cache-B92sMeCi.mjs → kv-cache-D1Ch4Ju7.mjs} +1 -1
  41. package/dist/{ld-xCF3uib3.mjs → ld-BV-KJnt5.mjs} +3 -3
  42. package/dist/{metrics-T82E15nn.mjs → metrics-B18PswRN.mjs} +1 -1
  43. package/dist/{middleware-BSr1-eGB.mjs → middleware-B1BK4Z48.mjs} +1 -1
  44. package/dist/{middleware-CZ3h4285.mjs → middleware-BYr3Msfi.mjs} +27 -23
  45. package/dist/{middleware-DcZ2-tQo.js → middleware-By5J1vr9.js} +22 -14
  46. package/dist/mod.cjs +4 -4
  47. package/dist/mod.js +4 -4
  48. package/dist/nodeinfo/handler.test.mjs +1 -1
  49. package/dist/otel/exporter.test.mjs +1 -253
  50. package/dist/{owner-CWP8TJYf.mjs → owner-nshRE6qk.mjs} +3 -3
  51. package/dist/{portable-collection-CyWhsaoF.js → portable-collection-BBURTikf.js} +1 -1
  52. package/dist/{portable-collection-7KpElui5.cjs → portable-collection-CpKPNP9k.cjs} +1 -1
  53. package/dist/{portable-collection-D0IFtR34.mjs → portable-collection-DNXfqNoX.mjs} +2 -2
  54. package/dist/{portable-key-D2OWixay.mjs → portable-key-DfeemJ18.mjs} +1 -1
  55. package/dist/{proof-DJEy_0Hi.mjs → proof-DaG_j0Bu.mjs} +4 -4
  56. package/dist/{send-LUMcW-S0.mjs → send-CQ_EZEOl.mjs} +10 -6
  57. package/dist/sig/compound-proof-discovery.test.mjs +1 -1
  58. package/dist/sig/compound-proof-producer.test.mjs +1 -1
  59. package/dist/sig/compound-proof-verification.test.mjs +2 -2
  60. package/dist/sig/compound-proof.test.mjs +2 -2
  61. package/dist/sig/http.test.mjs +2 -2
  62. package/dist/sig/key.test.mjs +1 -1
  63. package/dist/sig/ld.test.mjs +2 -2
  64. package/dist/sig/mitra-receive-interop.test.mjs +4 -4
  65. package/dist/sig/mitra-send-interop.test.mjs +3 -3
  66. package/dist/sig/mod.cjs +2 -2
  67. package/dist/sig/mod.js +2 -2
  68. package/dist/sig/owner.test.mjs +1 -1
  69. package/dist/sig/portable-collection.test.mjs +1 -1
  70. package/dist/sig/portable-interop.test.mjs +3 -3
  71. package/dist/sig/portable-key.test.mjs +6 -6
  72. package/dist/sig/proof.test.mjs +82 -3
  73. package/dist/sig/tootik-request-interop.test.mjs +4 -4
  74. package/dist/sig/tootik-send-interop.test.mjs +3 -3
  75. package/dist/sig/verification.test.mjs +3 -3
  76. package/dist/{temporal-DfSP6Egi.mjs → temporal-B2lL-04X.mjs} +1 -1
  77. package/dist/testing/kv.test.mjs +1 -1
  78. package/dist/utils/docloader.test.mjs +2 -2
  79. package/dist/utils/kv-cache.test.mjs +1 -1
  80. package/dist/utils/mod.cjs +1 -1
  81. package/dist/utils/mod.js +1 -1
  82. package/package.json +7 -7
@@ -4,261 +4,9 @@ globalThis.addEventListener = () => {};
4
4
  import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
6
6
  import "../std__assert-DvMDRPes.mjs";
7
- import { getLogger } from "@logtape/logtape";
8
- import { ExportResultCode } from "@opentelemetry/core";
7
+ import { t as FedifySpanExporter } from "../exporter-DThFfe7P.mjs";
9
8
  import { SpanKind, SpanStatusCode, TraceFlags } from "@opentelemetry/api";
10
9
  import { test } from "@fedify/fixture";
11
- //#region src/otel/exporter.ts
12
- /**
13
- * A SpanExporter that persists ActivityPub activity traces to a
14
- * {@link KvStore}. This enables distributed tracing across multiple
15
- * nodes in a Fedify deployment.
16
- *
17
- * The exporter captures activity data from OpenTelemetry span events
18
- * (`activitypub.activity.received` and `activitypub.activity.sent`)
19
- * and stores them in the KvStore with trace context preserved.
20
- *
21
- * @example Basic usage with MemoryKvStore
22
- * ```typescript ignore
23
- * import { MemoryKvStore } from "@fedify/fedify";
24
- * import { FedifySpanExporter } from "@fedify/fedify/otel";
25
- * import {
26
- * BasicTracerProvider,
27
- * SimpleSpanProcessor,
28
- * } from "@opentelemetry/sdk-trace-base";
29
- *
30
- * const kv = new MemoryKvStore();
31
- * const exporter = new FedifySpanExporter(kv, {
32
- * ttl: Temporal.Duration.from({ hours: 1 }),
33
- * });
34
- *
35
- * const provider = new BasicTracerProvider({
36
- * spanProcessors: [new SimpleSpanProcessor(exporter)],
37
- * });
38
- * ```
39
- *
40
- * @example Querying stored traces
41
- * ```typescript ignore
42
- * import { MemoryKvStore } from "@fedify/fedify";
43
- * import { FedifySpanExporter } from "@fedify/fedify/otel";
44
- *
45
- * const kv = new MemoryKvStore();
46
- * const exporter = new FedifySpanExporter(kv);
47
- * const traceId = "abc123";
48
- *
49
- * // Get all activities for a specific trace
50
- * const activities = await exporter.getActivitiesByTraceId(traceId);
51
- *
52
- * // Get recent traces
53
- * const recentTraces = await exporter.getRecentTraces({ limit: 100 });
54
- * ```
55
- *
56
- * @since 1.10.0
57
- */
58
- var FedifySpanExporter = class {
59
- #kv;
60
- #ttl;
61
- #keyPrefix;
62
- /**
63
- * Creates a new FedifySpanExporter.
64
- *
65
- * @param kv The KvStore to persist trace data to.
66
- * @param options Configuration options.
67
- */
68
- constructor(kv, options) {
69
- this.#kv = kv;
70
- this.#ttl = options?.ttl;
71
- this.#keyPrefix = options?.keyPrefix ?? ["fedify", "traces"];
72
- }
73
- /**
74
- * Exports spans to the KvStore.
75
- *
76
- * @param spans The spans to export.
77
- * @param resultCallback Callback to invoke with the export result.
78
- */
79
- export(spans, resultCallback) {
80
- this.#exportAsync(spans).then(() => resultCallback({ code: ExportResultCode.SUCCESS })).catch((error) => {
81
- getLogger([
82
- "fedify",
83
- "otel",
84
- "exporter"
85
- ]).error("Failed to export spans to KvStore: {error}", { error });
86
- resultCallback({ code: ExportResultCode.FAILED });
87
- });
88
- }
89
- async #exportAsync(spans) {
90
- const storeOperations = [];
91
- for (const span of spans) {
92
- const records = this.#extractRecords(span);
93
- for (const record of records) storeOperations.push(this.#storeRecord(record));
94
- }
95
- const rejected = (await Promise.allSettled(storeOperations)).filter((r) => r.status === "rejected");
96
- if (rejected.length > 0) throw new AggregateError(rejected.map((r) => r.reason), "Failed to store one or more trace activity records.");
97
- }
98
- #extractRecords(span) {
99
- const records = [];
100
- const spanContext = span.spanContext();
101
- const traceId = spanContext.traceId;
102
- const spanId = spanContext.spanId;
103
- const parentSpanId = span.parentSpanContext?.spanId;
104
- for (const event of span.events) if (event.name === "activitypub.activity.received") {
105
- const record = this.#extractInboundRecord(event, traceId, spanId, parentSpanId);
106
- if (record != null) records.push(record);
107
- } else if (event.name === "activitypub.activity.sent") {
108
- const record = this.#extractOutboundRecord(event, traceId, spanId, parentSpanId);
109
- if (record != null) records.push(record);
110
- }
111
- return records;
112
- }
113
- #extractInboundRecord(event, traceId, spanId, parentSpanId) {
114
- const attrs = event.attributes;
115
- if (attrs == null) return null;
116
- const activityJson = attrs["activitypub.activity.json"];
117
- if (typeof activityJson !== "string") return null;
118
- let activityType = "Unknown";
119
- let activityId;
120
- let actorId;
121
- try {
122
- const activity = JSON.parse(activityJson);
123
- activityType = activity.type ?? "Unknown";
124
- activityId = activity.id;
125
- if (typeof activity.actor === "string") actorId = activity.actor;
126
- else if (activity.actor != null && typeof activity.actor.id === "string") actorId = activity.actor.id;
127
- } catch {}
128
- const verified = attrs["activitypub.activity.verified"];
129
- const httpSigVerified = attrs["http_signatures.verified"];
130
- const httpSigKeyId = attrs["http_signatures.key_id"];
131
- const httpSigFailureReason = attrs["http_signatures.failure_reason"];
132
- const httpSigKeyFetchStatus = attrs["http_signatures.key_fetch_status"];
133
- const httpSigKeyFetchError = attrs["http_signatures.key_fetch_error"];
134
- const ldSigVerified = attrs["ld_signatures.verified"];
135
- let signatureDetails;
136
- if (typeof httpSigVerified === "boolean" || typeof ldSigVerified === "boolean" || typeof httpSigFailureReason === "string") signatureDetails = {
137
- httpSignaturesVerified: httpSigVerified === true,
138
- httpSignaturesKeyId: typeof httpSigKeyId === "string" && httpSigKeyId !== "" ? httpSigKeyId : void 0,
139
- httpSignaturesFailureReason: typeof httpSigFailureReason === "string" && httpSigFailureReason !== "" ? httpSigFailureReason : void 0,
140
- httpSignaturesKeyFetchStatus: typeof httpSigKeyFetchStatus === "number" ? httpSigKeyFetchStatus : void 0,
141
- httpSignaturesKeyFetchError: typeof httpSigKeyFetchError === "string" && httpSigKeyFetchError !== "" ? httpSigKeyFetchError : void 0,
142
- ldSignaturesVerified: ldSigVerified === true
143
- };
144
- return {
145
- traceId,
146
- spanId,
147
- parentSpanId,
148
- direction: "inbound",
149
- activityType,
150
- activityId,
151
- actorId,
152
- activityJson,
153
- verified: typeof verified === "boolean" ? verified : void 0,
154
- signatureDetails,
155
- timestamp: (/* @__PURE__ */ new Date(event.time[0] * 1e3 + event.time[1] / 1e6)).toISOString()
156
- };
157
- }
158
- #extractOutboundRecord(event, traceId, spanId, parentSpanId) {
159
- const attrs = event.attributes;
160
- if (attrs == null) return null;
161
- const activityJson = attrs["activitypub.activity.json"];
162
- let activityType = "Unknown";
163
- let activityId;
164
- let actorId;
165
- if (typeof activityJson === "string") try {
166
- const activity = JSON.parse(activityJson);
167
- activityType = activity.type ?? "Unknown";
168
- activityId = activity.id;
169
- if (typeof activity.actor === "string") actorId = activity.actor;
170
- else if (activity.actor != null && typeof activity.actor.id === "string") actorId = activity.actor.id;
171
- } catch {}
172
- const inboxUrl = attrs["activitypub.inbox.url"];
173
- const explicitActivityId = attrs["activitypub.activity.id"];
174
- const explicitActivityType = attrs["activitypub.activity.type"];
175
- const explicitActorId = attrs["activitypub.actor.id"];
176
- return {
177
- traceId,
178
- spanId,
179
- parentSpanId,
180
- direction: "outbound",
181
- activityType: typeof explicitActivityType === "string" && explicitActivityType !== "" ? explicitActivityType : activityType,
182
- activityId: activityId ?? (typeof explicitActivityId === "string" && explicitActivityId !== "" ? explicitActivityId : void 0),
183
- actorId: typeof explicitActorId === "string" && explicitActorId !== "" ? explicitActorId : actorId,
184
- ...typeof activityJson === "string" ? { activityJson } : {},
185
- timestamp: (/* @__PURE__ */ new Date(event.time[0] * 1e3 + event.time[1] / 1e6)).toISOString(),
186
- inboxUrl: typeof inboxUrl === "string" ? inboxUrl : void 0
187
- };
188
- }
189
- async #storeRecord(record) {
190
- const options = this.#ttl != null ? { ttl: this.#ttl } : void 0;
191
- const key = [
192
- ...this.#keyPrefix,
193
- record.traceId,
194
- record.spanId
195
- ];
196
- await this.#kv.set(key, record, options);
197
- await this.#updateTraceSummary(record, options);
198
- }
199
- async #setWithCasRetry(key, transform, options) {
200
- if (this.#kv.cas != null) for (let attempt = 0; attempt < 3; attempt++) {
201
- const existing = await this.#kv.get(key);
202
- const newValue = transform(existing);
203
- if (await this.#kv.cas(key, existing, newValue, options)) return;
204
- }
205
- const newValue = transform(await this.#kv.get(key));
206
- await this.#kv.set(key, newValue, options);
207
- }
208
- async #updateTraceSummary(record, options) {
209
- const summaryKey = [
210
- ...this.#keyPrefix,
211
- "_summaries",
212
- record.traceId
213
- ];
214
- await this.#setWithCasRetry(summaryKey, (existing) => {
215
- const activityCount = existing != null ? existing.activityCount + 1 : 1;
216
- const activityTypes = existing != null ? existing.activityTypes.includes(record.activityType) ? existing.activityTypes : [...existing.activityTypes, record.activityType] : [record.activityType];
217
- return {
218
- traceId: existing?.traceId ?? record.traceId,
219
- timestamp: existing?.timestamp ?? record.timestamp,
220
- activityCount,
221
- activityTypes
222
- };
223
- }, options);
224
- }
225
- /**
226
- * Gets all activity records for a specific trace ID.
227
- *
228
- * @param traceId The trace ID to query.
229
- * @returns An array of activity records belonging to the trace.
230
- */
231
- async getActivitiesByTraceId(traceId) {
232
- const prefix = [...this.#keyPrefix, traceId];
233
- const records = [];
234
- for await (const entry of this.#kv.list(prefix)) records.push(entry.value);
235
- return records;
236
- }
237
- /**
238
- * Gets recent traces with summary information.
239
- *
240
- * @param options Options for the query.
241
- * @returns An array of trace summaries.
242
- */
243
- async getRecentTraces(options) {
244
- const summaryPrefix = [...this.#keyPrefix, "_summaries"];
245
- const summaries = [];
246
- for await (const entry of this.#kv.list(summaryPrefix)) summaries.push(entry.value);
247
- summaries.sort((a, b) => b.timestamp.localeCompare(a.timestamp));
248
- if (options?.limit != null) return summaries.slice(0, options.limit);
249
- return summaries;
250
- }
251
- /**
252
- * Forces the exporter to flush any buffered data.
253
- * This is a no-op because we write directly to the KvStore without buffering.
254
- */
255
- async forceFlush() {}
256
- /**
257
- * Shuts down the exporter.
258
- */
259
- async shutdown() {}
260
- };
261
- //#endregion
262
10
  //#region src/otel/exporter.test.ts
263
11
  function createMockSpan(options) {
264
12
  const traceId = options.traceId ?? "0123456789abcdef0123456789abcdef";
@@ -2,10 +2,10 @@ import "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { d as isPortableUri, l as isPortableId, n as getCanonicalPortableId, p as isSamePublicKey$1, s as isCompatibleKeyId } from "./portable-key-id-Ca30-hOa.mjs";
5
- import { n as version, t as name } from "./deno-BAG_1fYL.mjs";
5
+ import { n as version, t as name } from "./deno-ocYJ306k.mjs";
6
6
  import { i as parseKeyOwnerEvidence, r as getVerifiedKeyOwnerEvidence } from "./key-owner-evidence-APB6NpSk.mjs";
7
- import { l as verifyKeyOwnership, n as exportJwk, r as fetchActorDocument } from "./key-eelLmVSs.mjs";
8
- import { n as resolvePortableActorKey, t as fetchPortableGatewayKey } from "./portable-key-D2OWixay.mjs";
7
+ import { l as verifyKeyOwnership, n as exportJwk, r as fetchActorDocument } from "./key-DAA9n2ms.mjs";
8
+ import { n as resolvePortableActorKey, t as fetchPortableGatewayKey } from "./portable-key-DfeemJ18.mjs";
9
9
  import { getLogger } from "@logtape/logtape";
10
10
  import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
11
11
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { At as isPortableUri, B as fetchActorDocument, Dt as isCompatibleKeyId, J as getVerifiedKeyOwnerEvidence, K as verifyKeyOwnership, Mt as isSamePublicKey$1, Nt as name, Ot as isPortableId, Pt as version, St as getCanonicalPortableId, Y as parseKeyOwnerEvidence, b as verifyPortableObjectProofWithRoot, l as fetchPortableGatewayKey, u as resolvePortableActorKey, v as verifyPortableObjectProof, z as exportJwk } from "./http-DWdmr99_.js";
3
+ import { At as isPortableUri, B as fetchActorDocument, Dt as isCompatibleKeyId, J as getVerifiedKeyOwnerEvidence, K as verifyKeyOwnership, Mt as isSamePublicKey$1, Nt as name, Ot as isPortableId, Pt as version, St as getCanonicalPortableId, Y as parseKeyOwnerEvidence, b as verifyPortableObjectProofWithRoot, l as fetchPortableGatewayKey, u as resolvePortableActorKey, v as verifyPortableObjectProof, z as exportJwk } from "./http-Dxp3npYk.js";
4
4
  import { getLogger } from "@logtape/logtape";
5
5
  import { CollectionPage, CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
6
6
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
@@ -1,5 +1,5 @@
1
1
  const { URLPattern } = require("urlpattern-polyfill");
2
- const require_http = require("./http-BuLngk1F.cjs");
2
+ const require_http = require("./http-C9T0cjbd.cjs");
3
3
  let _logtape_logtape = require("@logtape/logtape");
4
4
  let _fedify_vocab = require("@fedify/vocab");
5
5
  let _opentelemetry_api = require("@opentelemetry/api");
@@ -1,8 +1,8 @@
1
1
  import "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-BAG_1fYL.mjs";
5
- import { c as verifyPortableObjectProof, u as verifyPortableObjectProofWithRoot } from "./proof-DJEy_0Hi.mjs";
4
+ import { n as version, t as name } from "./deno-ocYJ306k.mjs";
5
+ import { c as verifyPortableObjectProof, u as verifyPortableObjectProofWithRoot } from "./proof-DaG_j0Bu.mjs";
6
6
  import { getLogger } from "@logtape/logtape";
7
7
  import { CollectionPage, Object as Object$1, isActor } from "@fedify/vocab";
8
8
  import { trace } from "@opentelemetry/api";
@@ -2,7 +2,7 @@ import "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { a as getRawCanonicalPortableId, c as isPortableActorDocument, d as isPortableUri, n as getCanonicalPortableId, p as isSamePublicKey } from "./portable-key-id-Ca30-hOa.mjs";
5
- import { u as verifyPortableObjectProofWithRoot } from "./proof-DJEy_0Hi.mjs";
5
+ import { u as verifyPortableObjectProofWithRoot } from "./proof-DaG_j0Bu.mjs";
6
6
  import { getLogger } from "@logtape/logtape";
7
7
  import { CryptographicKey, Multikey, Object as Object$1 } from "@fedify/vocab";
8
8
  import { FetchError, formatIri, getDocumentLoader, isGatewayUrl, parseIri, toCompatibleEf61Id } from "@fedify/vocab-runtime";
@@ -3,12 +3,12 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { i as getPortableDid, l as isPortableId } 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-BAG_1fYL.mjs";
7
- import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-T82E15nn.mjs";
8
- import { c as validateCryptoKey, i as fetchKey, t as bypassKeyCacheReads } from "./key-eelLmVSs.mjs";
6
+ import { n as version, t as name } from "./deno-ocYJ306k.mjs";
7
+ import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-B18PswRN.mjs";
8
+ import { c as validateCryptoKey, i as fetchKey, t as bypassKeyCacheReads } from "./key-DAA9n2ms.mjs";
9
9
  import { n as preloadedOnlyDocumentLoader } from "./public-audience--klBIOk1.mjs";
10
10
  import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-4IJqPYos.mjs";
11
- import { c as getNormalizationContextLoader } from "./ld-xCF3uib3.mjs";
11
+ import { c as getNormalizationContextLoader } from "./ld-BV-KJnt5.mjs";
12
12
  import { getLogger } from "@logtape/logtape";
13
13
  import { Activity, DataIntegrityProof, Multikey, getTypeId } from "@fedify/vocab";
14
14
  import { SpanStatusCode, trace } from "@opentelemetry/api";
@@ -2,10 +2,10 @@ import "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { d as isPortableUri } from "./portable-key-id-Ca30-hOa.mjs";
5
- import { n as version, t as name } from "./deno-BAG_1fYL.mjs";
6
- import { n as getDurationMs, r as getFederationMetrics } from "./metrics-T82E15nn.mjs";
7
- import { n as doubleKnock } from "./http-CV-U1gzt.mjs";
8
- import { getLogger } from "@logtape/logtape";
5
+ import { n as version, t as name } from "./deno-ocYJ306k.mjs";
6
+ import { n as getDurationMs, r as getFederationMetrics } from "./metrics-B18PswRN.mjs";
7
+ import { n as doubleKnock } from "./http-C5xWwbV0.mjs";
8
+ import { getLogger, withContext } from "@logtape/logtape";
9
9
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
10
10
  import { FetchError, UrlError, canonicalizePortableUri, getFe34Origin, isGatewayUrl, toCompatibleEf61Id, validatePublicUrl } from "@fedify/vocab-runtime";
11
11
  import { getPortableGatewayCandidates } from "@fedify/vocab-runtime/internal/portable-dereference";
@@ -198,11 +198,15 @@ function sendActivity(options) {
198
198
  }, async (span) => {
199
199
  if (options.activityId != null) span.setAttribute("activitypub.activity.id", options.activityId);
200
200
  if (options.activityType != null) span.setAttribute("activitypub.activity.type", options.activityType);
201
+ const spanContext = span.spanContext();
201
202
  try {
202
- await sendActivityInternal({
203
+ await withContext({
204
+ traceId: spanContext.traceId,
205
+ spanId: spanContext.spanId
206
+ }, () => sendActivityInternal({
203
207
  ...options,
204
208
  tracerProvider
205
- }, span);
209
+ }, span));
206
210
  } catch (e) {
207
211
  span.setStatus({
208
212
  code: SpanStatusCode.ERROR,
@@ -3,7 +3,7 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
5
5
  import "../std__assert-DvMDRPes.mjs";
6
- import { a as inspectCompoundPortableObjectApplicability, n as discoverCompoundProofDocuments } from "../compound-proof-BOfX5ZI_.mjs";
6
+ import { a as inspectCompoundPortableObjectApplicability, n as discoverCompoundProofDocuments } from "../compound-proof-BVVJ7l69.mjs";
7
7
  import { t as map_local_create_note_default } from "../map-local-create-note-B0SeXJms.mjs";
8
8
  import { test } from "@fedify/fixture";
9
9
  //#region src/sig/compound-proof-discovery.test.ts
@@ -3,7 +3,7 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
5
5
  import "../std__assert-DvMDRPes.mjs";
6
- import { a as inspectCompoundPortableObjectApplicability, i as findUnsupportedCompoundProofShape, t as containsCompoundPortableObject } from "../compound-proof-BOfX5ZI_.mjs";
6
+ import { a as inspectCompoundPortableObjectApplicability, i as findUnsupportedCompoundProofShape, t as containsCompoundPortableObject } from "../compound-proof-BVVJ7l69.mjs";
7
7
  import { test } from "@fedify/fixture";
8
8
  //#region src/sig/compound-proof-producer.test.ts
9
9
  const portableId = "ap+ef61://did:key:z6MkAlice/objects/1";
@@ -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 { l as verifyPortableObjectProofPolicy, o as verifyMapLocalProof } from "../proof-DJEy_0Hi.mjs";
7
+ import { l as verifyPortableObjectProofPolicy, o as verifyMapLocalProof } from "../proof-DaG_j0Bu.mjs";
8
8
  import { n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
9
- import { a as inspectCompoundPortableObjectApplicability, o as verifyCompoundPortableObjectProofs, s as verifyCompoundProofDocuments, t as containsCompoundPortableObject } from "../compound-proof-BOfX5ZI_.mjs";
9
+ import { a as inspectCompoundPortableObjectApplicability, o as verifyCompoundPortableObjectProofs, s as verifyCompoundProofDocuments, t as containsCompoundPortableObject } from "../compound-proof-BVVJ7l69.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";
@@ -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 { a as signObject, d as verifyProof } from "../proof-DJEy_0Hi.mjs";
9
+ import { a as signObject, d as verifyProof } from "../proof-DaG_j0Bu.mjs";
10
10
  import { n as ed25519PrivateKey, r as ed25519PublicKey } from "../keys-DIJNHW-Y.mjs";
11
- import { s as verifyCompoundProofDocuments } from "../compound-proof-BOfX5ZI_.mjs";
11
+ import { s as verifyCompoundProofDocuments } from "../compound-proof-BVVJ7l69.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";
@@ -12,8 +12,8 @@ import { t as assertThrows } from "../assert_throws-BYITOvPO.mjs";
12
12
  import "../std__assert-DvMDRPes.mjs";
13
13
  import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
14
14
  import { t as assert } from "../assert-D1Eafmd_.mjs";
15
- import { n as exportJwk } from "../key-eelLmVSs.mjs";
16
- import { a as listRequestSignatures, c as selectRequestSignature, f as verifyRequest, i as formatRfc9421SignatureParameters, l as signRequest, n as doubleKnock, o as parseRfc9421Signature, p as verifyRequestDetailed, r as formatRfc9421Signature, s as parseRfc9421SignatureInput, t as createRfc9421SignatureBase, u as timingSafeEqual } from "../http-CV-U1gzt.mjs";
15
+ import { n as exportJwk } from "../key-DAA9n2ms.mjs";
16
+ import { a as listRequestSignatures, c as selectRequestSignature, f as verifyRequest, i as formatRfc9421SignatureParameters, l as signRequest, n as doubleKnock, o as parseRfc9421Signature, p as verifyRequestDetailed, r as formatRfc9421Signature, s as parseRfc9421SignatureInput, t as createRfc9421SignatureBase, u as timingSafeEqual } from "../http-C5xWwbV0.mjs";
17
17
  import { a as rsaPrivateKey3, i as rsaPrivateKey2, l as rsaPublicKey5, n as ed25519PrivateKey, o as rsaPublicKey1, r as ed25519PublicKey, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
18
18
  import { t as KvKeyCache } from "../keycache-D-MNltOk.mjs";
19
19
  import { FetchError, UrlError, exportSpki, getDocumentLoader } 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-eelLmVSs.mjs";
9
+ import { a as fetchKeyDetailed, c as validateCryptoKey, i as fetchKey, n as exportJwk, o as generateCryptoKeyPair, s as importJwk } from "../key-DAA9n2ms.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 { FetchError, exportDidKey } from "@fedify/vocab-runtime";
@@ -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-eelLmVSs.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-xCF3uib3.mjs";
11
+ import { o as generateCryptoKeyPair } from "../key-DAA9n2ms.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-BV-KJnt5.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";
@@ -5,10 +5,10 @@ import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
6
6
  import "../std__assert-DvMDRPes.mjs";
7
7
  import { t as assert } from "../assert-D1Eafmd_.mjs";
8
- import { c as verifyPortableObjectProof } from "../proof-DJEy_0Hi.mjs";
9
- import { p as verifyRequestDetailed } from "../http-CV-U1gzt.mjs";
10
- import { o as createFederation } from "../middleware-CZ3h4285.mjs";
11
- import { t as doesActorOwnKey } from "../owner-CWP8TJYf.mjs";
8
+ import { c as verifyPortableObjectProof } from "../proof-DaG_j0Bu.mjs";
9
+ import { p as verifyRequestDetailed } from "../http-C5xWwbV0.mjs";
10
+ import { o as createFederation } from "../middleware-BYr3Msfi.mjs";
11
+ import { t as doesActorOwnKey } from "../owner-nshRE6qk.mjs";
12
12
  import { Create, Person } from "@fedify/vocab";
13
13
  import { canonicalizePortableUri, decodeMultibase, importDidKey } from "@fedify/vocab-runtime";
14
14
  import { mockDocumentLoader, test } from "@fedify/fixture";
@@ -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 { c as verifyPortableObjectProof } from "../proof-DJEy_0Hi.mjs";
8
- import { p as verifyRequestDetailed } from "../http-CV-U1gzt.mjs";
9
- import { t as doesActorOwnKey } from "../owner-CWP8TJYf.mjs";
7
+ import { c as verifyPortableObjectProof } from "../proof-DaG_j0Bu.mjs";
8
+ import { p as verifyRequestDetailed } from "../http-C5xWwbV0.mjs";
9
+ import { t as doesActorOwnKey } from "../owner-nshRE6qk.mjs";
10
10
  import { Create } from "@fedify/vocab";
11
11
  import { canonicalizePortableUri, decodeMultibase, fromCompatibleEf61Id, importDidKey } from "@fedify/vocab-runtime";
12
12
  import { 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-BuLngk1F.cjs");
4
- const require_portable_collection = require("../portable-collection-7KpElui5.cjs");
3
+ const require_http = require("../http-C9T0cjbd.cjs");
4
+ const require_portable_collection = require("../portable-collection-CpKPNP9k.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 { D as createSignature, H as fetchKeyDetailed, I as verifyJsonLd, L as verifySignature, O as detachSignature, P as signJsonLd, T as attachSignature, U as generateCryptoKeyPair, V as fetchKey, W as importJwk, _ as verifyObject, _t as validateAcceptSignature, a as signRequest, c as verifyRequestDetailed, gt as parseAcceptSignature, h as signObject, ht as fulfillAcceptSignature, j as hasSignatureLike, m as hasProofLike, mt as formatAcceptSignature, p as createProof, s as verifyRequest, v as verifyPortableObjectProof, x as verifyProof, z as exportJwk } from "../http-DWdmr99_.js";
4
- import { n as doesActorOwnKey, r as getKeyOwner, t as verifyPortableObject } from "../portable-collection-CyWhsaoF.js";
3
+ import { D as createSignature, H as fetchKeyDetailed, I as verifyJsonLd, L as verifySignature, O as detachSignature, P as signJsonLd, T as attachSignature, U as generateCryptoKeyPair, V as fetchKey, W as importJwk, _ as verifyObject, _t as validateAcceptSignature, a as signRequest, c as verifyRequestDetailed, gt as parseAcceptSignature, h as signObject, ht as fulfillAcceptSignature, j as hasSignatureLike, m as hasProofLike, mt as formatAcceptSignature, p as createProof, s as verifyRequest, v as verifyPortableObjectProof, x as verifyProof, z as exportJwk } from "../http-Dxp3npYk.js";
4
+ import { n as doesActorOwnKey, r as getKeyOwner, t as verifyPortableObject } from "../portable-collection-BBURTikf.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-CWP8TJYf.mjs";
9
+ import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-nshRE6qk.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-D0IFtR34.mjs";
5
+ import { t as verifyPortableObject } from "../portable-collection-DNXfqNoX.mjs";
6
6
  import { Collection, CollectionPage, Note, OrderedCollection, Person, traverseCollection } from "@fedify/vocab";
7
7
  import { FetchError, encodeMultibase, exportDidKey, preloadedContexts } from "@fedify/vocab-runtime";
8
8
  import { test } from "@fedify/fixture";
@@ -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 { c as verifyPortableObjectProof, d as verifyProof } from "../proof-DJEy_0Hi.mjs";
8
- import { n as getKeyOwner } from "../owner-CWP8TJYf.mjs";
9
- import { t as verifyPortableObject } from "../portable-collection-D0IFtR34.mjs";
7
+ import { c as verifyPortableObjectProof, d as verifyProof } from "../proof-DaG_j0Bu.mjs";
8
+ import { n as getKeyOwner } from "../owner-nshRE6qk.mjs";
9
+ import { t as verifyPortableObject } from "../portable-collection-DNXfqNoX.mjs";
10
10
  import { Application, DataIntegrityProof, lookupObject } from "@fedify/vocab";
11
11
  import { mockDocumentLoader, test } from "@fedify/fixture";
12
12
  //#region test-vectors/fep-ef61/tootik-v0.25.4/actor.json
@@ -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-eelLmVSs.mjs";
6
- import { h as verifyJsonLd, p as signJsonLd } from "../ld-xCF3uib3.mjs";
7
- import { d as verifyProof, r as createProof } from "../proof-DJEy_0Hi.mjs";
8
- import { n as resolvePortableActorKey } from "../portable-key-D2OWixay.mjs";
9
- import { f as verifyRequest, l as signRequest, p as verifyRequestDetailed } from "../http-CV-U1gzt.mjs";
5
+ import { a as fetchKeyDetailed, i as fetchKey } from "../key-DAA9n2ms.mjs";
6
+ import { h as verifyJsonLd, p as signJsonLd } from "../ld-BV-KJnt5.mjs";
7
+ import { d as verifyProof, r as createProof } from "../proof-DaG_j0Bu.mjs";
8
+ import { n as resolvePortableActorKey } from "../portable-key-DfeemJ18.mjs";
9
+ import { f as verifyRequest, l as signRequest, p as verifyRequestDetailed } from "../http-C5xWwbV0.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-CWP8TJYf.mjs";
11
+ import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-nshRE6qk.mjs";
12
12
  import { t as KvKeyCache } from "../keycache-D-MNltOk.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";