@fedify/fedify 2.4.0-dev.1964 → 2.4.0-dev.1995

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 (94) hide show
  1. package/dist/{builder-B4zpKIFU.mjs → builder-D0DxgOV5.mjs} +2 -2
  2. package/dist/{client-CtxvmazV.mjs → client-DpnpgjyX.mjs} +78 -4
  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/compound-proof-CJnWc6c-.mjs +495 -0
  7. package/dist/{context-COLwHogJ.d.cts → context-BeDnDuF3.d.cts} +4 -3
  8. package/dist/{context-DiiCt4S7.d.ts → context-uyRUWoZQ.d.ts} +4 -3
  9. package/dist/{deno-CtG93ohj.mjs → deno-CABhzCb_.mjs} +1 -1
  10. package/dist/{docloader-dk_k3S8d.mjs → docloader-BbGSL0Xq.mjs} +2 -2
  11. package/dist/federation/builder.test.mjs +1 -1
  12. package/dist/federation/handler-compound-proof.test.d.mts +2 -0
  13. package/dist/federation/handler-compound-proof.test.mjs +152 -0
  14. package/dist/federation/handler.test.mjs +122 -4
  15. package/dist/federation/idempotency.test.mjs +2 -2
  16. package/dist/federation/keycache.test.mjs +52 -9
  17. package/dist/federation/metrics.test.mjs +1 -1
  18. package/dist/federation/middleware.test.mjs +111 -15
  19. package/dist/federation/mod.cjs +1 -1
  20. package/dist/federation/mod.d.cts +2 -2
  21. package/dist/federation/mod.d.ts +2 -2
  22. package/dist/federation/mod.js +1 -1
  23. package/dist/federation/send.test.mjs +139 -4
  24. package/dist/federation/tasks/enqueue.test.mjs +1 -1
  25. package/dist/federation/tasks/tasks.test.mjs +2 -2
  26. package/dist/federation/temporal.test.mjs +1 -1
  27. package/dist/federation/webfinger.test.mjs +1 -1
  28. package/dist/{federation-Drjlrrax.cjs → federation-DCEHQk4G.cjs} +632 -57
  29. package/dist/{http-6TI0tI03.d.cts → http-65PYi9jY.d.ts} +34 -2
  30. package/dist/{http-Dj4s1UQ0.js → http-9WyuldYh.js} +170 -8
  31. package/dist/{http-CdrSn2ip.d.ts → http-CP-7OdSq.d.cts} +34 -2
  32. package/dist/{http-B3skRvGo.cjs → http-CRFns-UE.cjs} +181 -7
  33. package/dist/{http-D7LX-BL9.mjs → http-D9urSO2D.mjs} +3 -3
  34. package/dist/{key-BVjgbs_9.mjs → key-Ccs8cnd7.mjs} +169 -7
  35. package/dist/{keycache-ZLqIfrkL.mjs → keycache-BUDHB5rY.mjs} +12 -4
  36. package/dist/{kv-cache-DtsjH_bY.cjs → kv-cache-DXT9vmIg.cjs} +2 -2
  37. package/dist/{kv-cache-tGNbvDCF.js → kv-cache-DtmXhPXG.js} +2 -2
  38. package/dist/{kv-cache-xRcC_xxP.mjs → kv-cache-lKyFn_Dn.mjs} +1 -1
  39. package/dist/{ld-OuCeQFny.mjs → ld-qup__MAW.mjs} +3 -3
  40. package/dist/map-local-context-conflict-DOYEEJ3u.mjs +204 -0
  41. package/dist/map-local-create-note-B0SeXJms.mjs +214 -0
  42. package/dist/{metrics-B9N27cCB.mjs → metrics-CISXCvB1.mjs} +1 -1
  43. package/dist/{middleware-TeLjzoxn.mjs → middleware-CzvJvPHK.mjs} +58 -15
  44. package/dist/{middleware-Cd_vPqDH.mjs → middleware-DkrU2WhY.mjs} +1 -1
  45. package/dist/{middleware-CPTDFMmJ.js → middleware-DsfWajaD.js} +593 -18
  46. package/dist/{mod-DypxPS9H.d.ts → mod-C0BYc0OU.d.ts} +1 -1
  47. package/dist/{mod-CnGLNoVw.d.cts → mod-CbKDOnCt.d.cts} +1 -1
  48. package/dist/{mod-CLHkCwLm.d.cts → mod-CyiSjRkk.d.cts} +1 -1
  49. package/dist/{mod-CSH1Ee-I.d.ts → mod-D882_Xsg.d.ts} +1 -1
  50. package/dist/{mod-DzRXACM5.d.ts → mod-UDwMjuHM.d.ts} +1 -1
  51. package/dist/{mod-BZldCEU0.d.cts → mod-x9W0d0Pk.d.cts} +1 -1
  52. package/dist/mod.cjs +20 -20
  53. package/dist/mod.d.cts +6 -6
  54. package/dist/mod.d.ts +6 -6
  55. package/dist/mod.js +5 -5
  56. package/dist/nodeinfo/client.test.mjs +28 -1
  57. package/dist/nodeinfo/handler.test.mjs +1 -1
  58. package/dist/nodeinfo/mod.cjs +1 -1
  59. package/dist/nodeinfo/mod.js +1 -1
  60. package/dist/{owner-DGSfntI-.d.ts → owner-BF0L9cMt.d.cts} +12 -1
  61. package/dist/{proof-BO_esQii.js → owner-BIPEZGiU.js} +1255 -1098
  62. package/dist/{owner-r_waTiQj.d.cts → owner-BSzr5-I8.d.ts} +12 -1
  63. package/dist/owner-CRoq8Spb.mjs +175 -0
  64. package/dist/{proof-Dua0d906.cjs → owner-CVA7L9MA.cjs} +1266 -1097
  65. package/dist/{proof-D5Ajk4DJ.mjs → proof-BDxNVZ3E.mjs} +186 -83
  66. package/dist/{send-DVXyUqhO.mjs → send-BzM5GLyn.mjs} +68 -11
  67. package/dist/sig/compound-proof-discovery.test.d.mts +2 -0
  68. package/dist/sig/compound-proof-discovery.test.mjs +331 -0
  69. package/dist/sig/compound-proof-verification.test.d.mts +2 -0
  70. package/dist/sig/compound-proof-verification.test.mjs +465 -0
  71. package/dist/sig/compound-proof.test.d.mts +2 -0
  72. package/dist/sig/compound-proof.test.mjs +324 -0
  73. package/dist/sig/http.test.mjs +2 -2
  74. package/dist/sig/key.test.mjs +169 -2
  75. package/dist/sig/ld.test.mjs +55 -2
  76. package/dist/sig/mod.cjs +17 -17
  77. package/dist/sig/mod.d.cts +3 -3
  78. package/dist/sig/mod.d.ts +3 -3
  79. package/dist/sig/mod.js +2 -2
  80. package/dist/sig/owner.test.mjs +103 -4
  81. package/dist/sig/proof.test.mjs +120 -1
  82. package/dist/{temporal-BoDw51A-.mjs → temporal-Dv6Qv-8k.mjs} +1 -1
  83. package/dist/testing/kv.test.mjs +1 -1
  84. package/dist/testing/mod.d.mts +2 -1
  85. package/dist/{types-RXm5YxpC.cjs → types-Be2zbyeG.cjs} +94 -2
  86. package/dist/{types-Dtyf8lVj.js → types-C_cNlNVK.js} +78 -4
  87. package/dist/utils/docloader.test.mjs +27 -3
  88. package/dist/utils/kv-cache.test.mjs +1 -1
  89. package/dist/utils/mod.cjs +1 -1
  90. package/dist/utils/mod.d.cts +1 -1
  91. package/dist/utils/mod.d.ts +1 -1
  92. package/dist/utils/mod.js +1 -1
  93. package/package.json +6 -6
  94. package/dist/owner-DTEqTzSr.mjs +0 -120
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/fedify",
3
- "version": "2.4.0-dev.1964+1d28dc03",
3
+ "version": "2.4.0-dev.1995+618fd4e7",
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/vocab": "2.4.0-dev.1964+1d28dc03",
155
- "@fedify/webfinger": "2.4.0-dev.1964+1d28dc03",
156
- "@fedify/uri-template": "2.4.0-dev.1964+1d28dc03",
157
- "@fedify/vocab-runtime": "2.4.0-dev.1964+1d28dc03"
154
+ "@fedify/vocab": "2.4.0-dev.1995+618fd4e7",
155
+ "@fedify/webfinger": "2.4.0-dev.1995+618fd4e7",
156
+ "@fedify/uri-template": "2.4.0-dev.1995+618fd4e7",
157
+ "@fedify/vocab-runtime": "2.4.0-dev.1995+618fd4e7"
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.1964+1d28dc03"
170
+ "@fedify/vocab-tools": "^2.4.0-dev.1995+618fd4e7"
171
171
  },
172
172
  "scripts": {
173
173
  "build:self": "tsdown",
@@ -1,120 +0,0 @@
1
- import "temporal-polyfill";
2
- import "urlpattern-polyfill";
3
- globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-CtG93ohj.mjs";
5
- import "./key-BVjgbs_9.mjs";
6
- import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
7
- import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
8
- import { getDocumentLoader } from "@fedify/vocab-runtime";
9
- //#region src/sig/owner.ts
10
- /**
11
- * Checks if the actor of the given activity owns the specified key.
12
- * @param activity The activity to check.
13
- * @param key The public key to check.
14
- * @param options Options for checking the key ownership.
15
- * @returns Whether the actor is the owner of the key.
16
- */
17
- async function doesActorOwnKey(activity, key, options) {
18
- return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("activitypub.verify_key_ownership", {
19
- kind: SpanKind.INTERNAL,
20
- attributes: {
21
- "activitypub.actor.id": activity.actorId?.href ?? "",
22
- "activitypub.key.id": key.id?.href ?? ""
23
- }
24
- }, async (span) => {
25
- try {
26
- if (key.ownerId != null) {
27
- const owns = key.ownerId.href === activity.actorId?.href;
28
- span.setAttribute("activitypub.key_ownership.verified", owns);
29
- span.setAttribute("activitypub.key_ownership.method", "owner_id");
30
- return owns;
31
- }
32
- const actor = await activity.getActor(options);
33
- if (actor == null || !isActor(actor)) {
34
- span.setAttribute("activitypub.key_ownership.verified", false);
35
- span.setAttribute("activitypub.key_ownership.method", "actor_fetch");
36
- return false;
37
- }
38
- for (const publicKeyId of actor.publicKeyIds) if (key.id != null && publicKeyId.href === key.id.href) {
39
- span.setAttribute("activitypub.key_ownership.verified", true);
40
- span.setAttribute("activitypub.key_ownership.method", "actor_fetch");
41
- return true;
42
- }
43
- span.setAttribute("activitypub.key_ownership.verified", false);
44
- span.setAttribute("activitypub.key_ownership.method", "actor_fetch");
45
- return false;
46
- } catch (error) {
47
- span.recordException(error);
48
- span.setStatus({
49
- code: SpanStatusCode.ERROR,
50
- message: String(error)
51
- });
52
- throw error;
53
- } finally {
54
- span.end();
55
- }
56
- });
57
- }
58
- /**
59
- * Gets the actor that owns the specified key. Returns `null` if the key has no
60
- * known owner.
61
- *
62
- * @param keyId The ID of the key to check, or the key itself.
63
- * @param options Options for getting the key owner.
64
- * @returns The actor that owns the key, or `null` if the key has no known
65
- * owner.
66
- * @since 0.7.0
67
- */
68
- async function getKeyOwner(keyId, options) {
69
- const tracerProvider = options.tracerProvider ?? trace.getTracerProvider();
70
- const documentLoader = options.documentLoader ?? getDocumentLoader();
71
- const contextLoader = options.contextLoader ?? getDocumentLoader();
72
- let object;
73
- if (keyId instanceof CryptographicKey) {
74
- object = keyId;
75
- if (object.id == null) return null;
76
- keyId = object.id;
77
- } else {
78
- let keyDoc;
79
- try {
80
- const { document } = await documentLoader(keyId.href);
81
- keyDoc = document;
82
- } catch (_) {
83
- return null;
84
- }
85
- try {
86
- object = await Object$1.fromJsonLd(keyDoc, {
87
- documentLoader,
88
- contextLoader,
89
- tracerProvider
90
- });
91
- } catch (e) {
92
- if (!(e instanceof TypeError)) throw e;
93
- try {
94
- object = await CryptographicKey.fromJsonLd(keyDoc, {
95
- documentLoader,
96
- contextLoader,
97
- tracerProvider
98
- });
99
- } catch (e) {
100
- if (e instanceof TypeError) return null;
101
- throw e;
102
- }
103
- }
104
- }
105
- let owner = null;
106
- if (object instanceof CryptographicKey) {
107
- if (object.ownerId == null) return null;
108
- owner = await object.getOwner({
109
- documentLoader,
110
- contextLoader,
111
- tracerProvider
112
- });
113
- } else if (isActor(object)) owner = object;
114
- else return null;
115
- if (owner == null) return null;
116
- for (const kid of owner.publicKeyIds) if (kid.href === keyId.href) return owner;
117
- return null;
118
- }
119
- //#endregion
120
- export { getKeyOwner as n, doesActorOwnKey as t };