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

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 (98) hide show
  1. package/dist/{builder-BCXywsZF.mjs → builder-C0bxZDL0.mjs} +3 -3
  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-Fxd45Oy5.mjs → compound-proof-D9Kljk_7.mjs} +3 -3
  6. package/dist/{context-tOiJfBoD.d.ts → context-Cz1w5Krc.d.ts} +31 -5
  7. package/dist/{context-CoNRxGYp.mjs → context-DfSVPcJ8.mjs} +6 -3
  8. package/dist/{context-SMNOiiY6.d.cts → context-Dvec_D_h.d.cts} +31 -5
  9. package/dist/{deno-BZrnW0Qz.mjs → deno-_o3lkDlG.mjs} +1 -1
  10. package/dist/{docloader-3BHaS20Z.mjs → docloader-BbS0rO-Y.mjs} +7 -7
  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 +6 -6
  15. package/dist/federation/hashlink-media.test.mjs +2 -2
  16. package/dist/federation/idempotency.test.mjs +2 -2
  17. package/dist/federation/metrics.test.mjs +1 -1
  18. package/dist/federation/middleware.test.mjs +8 -8
  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/outgoing-proof.test.mjs +6 -6
  24. package/dist/federation/portable-actor.test.mjs +3 -3
  25. package/dist/federation/portable-chain.test.d.mts +2 -0
  26. package/dist/federation/portable-chain.test.mjs +358 -0
  27. package/dist/federation/portable-gateway-keys.test.mjs +77 -6
  28. package/dist/federation/portable-inbox.test.mjs +9 -4
  29. package/dist/federation/portable.test.mjs +3 -3
  30. package/dist/federation/send.test.mjs +3 -3
  31. package/dist/federation/tasks/enqueue.test.mjs +2 -2
  32. package/dist/federation/tasks/tasks.test.mjs +3 -3
  33. package/dist/federation/temporal.test.mjs +1 -1
  34. package/dist/federation/webfinger.test.mjs +2 -2
  35. package/dist/{federation-Ml6NrgRV.cjs → federation-DRY8KrkB.cjs} +46 -22
  36. package/dist/{http-4bmgw-mA.cjs → http-B1J6E-bT.cjs} +384 -33
  37. package/dist/{http-B9BQDNIy.mjs → http-BpOiZE09.mjs} +18 -12
  38. package/dist/{http-D76Py0M4.d.cts → http-C-x_OLSp.d.ts} +57 -14
  39. package/dist/{http-BETASGl0.js → http-C2M6wcs8.js} +374 -35
  40. package/dist/{http-BrQgkJay.d.ts → http-CjezPjFX.d.cts} +57 -14
  41. package/dist/{key-PyYvun0F.mjs → key-DolJjJab.mjs} +103 -16
  42. package/dist/{kv-cache-CPqUxRL3.mjs → kv-cache-Bq2cah0c.mjs} +1 -1
  43. package/dist/{kv-cache-C4mv2ZFQ.js → kv-cache-D7TiyMxv.js} +6 -6
  44. package/dist/{kv-cache-D2Bz6t_c.cjs → kv-cache-D9nRbG2Q.cjs} +6 -6
  45. package/dist/{ld-u4JOD4iO.mjs → ld-Dwc176V4.mjs} +3 -3
  46. package/dist/{metrics-DCLoLvLz.mjs → metrics-CDaHfBXY.mjs} +1 -1
  47. package/dist/{middleware-B7bmtONC.mjs → middleware-CmB1FD8A.mjs} +1 -1
  48. package/dist/{middleware-DWlAGlyP.js → middleware-CylX-pvI.js} +52 -28
  49. package/dist/{middleware-CgOqRkK-.mjs → middleware-DN3MdTDg.mjs} +64 -39
  50. package/dist/{mod-CTh7ijx5.d.ts → mod-Bz9tFXI2.d.ts} +14 -3
  51. package/dist/{mod-Cwdt_CWU.d.ts → mod-CZetqT5h.d.ts} +1 -1
  52. package/dist/{mod-Cr79cQlc.d.cts → mod-D4g9ffEn.d.cts} +1 -1
  53. package/dist/{mod-DnElMslb.d.cts → mod-DGOIxEfb.d.cts} +1 -1
  54. package/dist/{mod-DMdGFMEl.d.cts → mod-S--JxYjo.d.cts} +14 -3
  55. package/dist/{mod-COWgSo2v.d.ts → mod-owwElvpw.d.ts} +1 -1
  56. package/dist/mod.cjs +8 -8
  57. package/dist/mod.d.cts +5 -5
  58. package/dist/mod.d.ts +5 -5
  59. package/dist/mod.js +5 -5
  60. package/dist/nodeinfo/handler.test.mjs +2 -2
  61. package/dist/{owner-CPFM-sqo.mjs → owner-BNHhwjNu.mjs} +37 -4
  62. package/dist/{sig-C1xOA4ml.js → portable-collection-CRpTUHCY.mjs} +5 -4
  63. package/dist/portable-collection-CgglAI9B.js +656 -0
  64. package/dist/{sig-Cb9VSeiF.cjs → portable-collection-PTGD0q70.cjs} +253 -2
  65. package/dist/portable-key-DqX2emHQ.mjs +395 -0
  66. package/dist/{portable-key-id-T7lecIbt.mjs → portable-key-id-Bg259c4Z.mjs} +69 -2
  67. package/dist/{proof-BCOg7Njv.mjs → proof-B4_0E-KU.mjs} +5 -5
  68. package/dist/{send-C8eOPat3.mjs → send-Dpu5qbP5.mjs} +3 -3
  69. package/dist/sig/compound-proof-discovery.test.mjs +1 -1
  70. package/dist/sig/compound-proof-producer.test.mjs +1 -1
  71. package/dist/sig/compound-proof-verification.test.mjs +2 -2
  72. package/dist/sig/compound-proof.test.mjs +2 -2
  73. package/dist/sig/http.test.mjs +2 -2
  74. package/dist/sig/key.test.mjs +1 -1
  75. package/dist/sig/ld.test.mjs +2 -2
  76. package/dist/sig/mod.cjs +5 -6
  77. package/dist/sig/mod.d.cts +2 -2
  78. package/dist/sig/mod.d.ts +2 -2
  79. package/dist/sig/mod.js +2 -3
  80. package/dist/sig/owner.test.mjs +1 -1
  81. package/dist/sig/portable-collection.test.mjs +20 -431
  82. package/dist/sig/portable-key.test.mjs +479 -5
  83. package/dist/sig/proof.test.mjs +3 -3
  84. package/dist/{temporal-vjHOhBpy.mjs → temporal-78JVR3GK.mjs} +1 -1
  85. package/dist/testing/kv.test.mjs +1 -1
  86. package/dist/testing/mod.d.mts +30 -4
  87. package/dist/testing/mod.mjs +2 -2
  88. package/dist/{testing-BWq1dCzx.mjs → testing-otQhu4aD.mjs} +1 -1
  89. package/dist/utils/docloader.test.mjs +81 -2
  90. package/dist/utils/kv-cache.test.mjs +1 -1
  91. package/dist/utils/mod.cjs +1 -1
  92. package/dist/utils/mod.d.cts +1 -1
  93. package/dist/utils/mod.d.ts +1 -1
  94. package/dist/utils/mod.js +1 -1
  95. package/package.json +7 -7
  96. package/dist/owner-DkA0Lz7v.cjs +0 -225
  97. package/dist/owner-wNinn7RK.js +0 -215
  98. package/dist/portable-key-DyylakVV.mjs +0 -214
@@ -1,7 +1,7 @@
1
1
  /// <reference lib="esnext.temporal" />
2
2
  import { Actor, CryptographicKey, Multikey } from "@fedify/vocab";
3
- import { DocumentLoader } from "@fedify/vocab-runtime";
4
3
  import { MeterProvider, TracerProvider } from "@opentelemetry/api";
4
+ import { DocumentLoader } from "@fedify/vocab-runtime";
5
5
 
6
6
  //#region src/sig/portable-key.d.ts
7
7
  /**
@@ -29,6 +29,28 @@ type PortableGatewayKeyResolution = {
29
29
  */
30
30
  readonly expires?: Temporal.Instant;
31
31
  };
32
+ /**
33
+ * The result of resolving a key of a portable actor at an `ap:` or
34
+ * `ap+ef61:` key ID.
35
+ * @internal
36
+ */
37
+ type PortableActorKeyResolution = Exclude<PortableGatewayKeyResolution, {
38
+ readonly type: "legacy";
39
+ }> | {
40
+ /**
41
+ * Whether the actor's document vouches for the key could not be
42
+ * determined, e.g., because no gateway could be reached.
43
+ */
44
+ readonly type: "unavailable";
45
+ readonly error: unknown;
46
+ /**
47
+ * Whether the failure can be cached as a failure to fetch the key, i.e.,
48
+ * every gateway failed to serve the actor's document at all. A failure
49
+ * that is not cacheable comes with an error that has no HTTP status,
50
+ * since none of the statuses describes the lookup as a whole.
51
+ */
52
+ readonly cacheable: boolean;
53
+ };
32
54
  //#endregion
33
55
  //#region src/sig/key.d.ts
34
56
  /**
@@ -119,17 +141,34 @@ interface FetchKeyOptions {
119
141
  */
120
142
  keyIdBoundByCaller?: boolean;
121
143
  /**
122
- * Resolves a gateway key of an [FEP-ef61] portable actor, i.e., a key whose
123
- * ID is a compatible identifier and dereferences to a portable actor's
124
- * document. Such a key is resolved only through this function, and is
125
- * rejected if it is omitted, so that only HTTP Signature verification,
126
- * which passes it, accepts gateway keys. Object Integrity Proofs and
127
- * Linked Data Signatures never do.
144
+ * Resolves keys of [FEP-ef61] portable actors, which only HTTP Signature
145
+ * verification passes, so that only it accepts them. Object Integrity
146
+ * Proofs and Linked Data Signatures never do: such a key is rejected if
147
+ * this is omitted.
128
148
  *
129
149
  * [FEP-ef61]: https://w3id.org/fep/ef61
130
150
  * @internal
131
151
  */
132
- portableGatewayKeyResolver?: (document: unknown, actor: Actor, keyId: URL) => Promise<PortableGatewayKeyResolution>;
152
+ portableKeyResolvers?: PortableKeyResolvers;
153
+ }
154
+ /**
155
+ * Resolves keys of [FEP-ef61] portable actors for HTTP Signature
156
+ * verification. See {@link FetchKeyOptions.portableKeyResolvers}.
157
+ *
158
+ * [FEP-ef61]: https://w3id.org/fep/ef61
159
+ * @internal
160
+ */
161
+ interface PortableKeyResolvers {
162
+ /**
163
+ * Resolves a gateway key, i.e., a key whose ID is a compatible identifier
164
+ * and dereferences to a portable actor's document.
165
+ */
166
+ gatewayKey(document: unknown, actor: Actor, keyId: URL): Promise<PortableGatewayKeyResolution>;
167
+ /**
168
+ * Resolves a key of a portable actor itself, i.e., a key whose ID is an
169
+ * `ap:` or `ap+ef61:` URI.
170
+ */
171
+ actorKey(keyId: URL): Promise<PortableActorKeyResolution>;
133
172
  }
134
173
  /**
135
174
  * The result of {@link fetchKey}.
@@ -182,9 +221,11 @@ type FetchableKeyClass<T extends CryptographicKey | Multikey> = (new (...args: a
182
221
  * Gateway keys of [FEP-ef61] portable actors, i.e., keys whose IDs are
183
222
  * compatible identifiers that dereference to portable actor documents, are
184
223
  * not resolved by this function, as they only authenticate HTTP requests;
185
- * use `verifyRequest()` or `getKeyOwner()` for them instead. Keys whose IDs
186
- * are compatible identifiers are never read from or written to the key
187
- * cache under their IDs, except for failures to fetch them.
224
+ * use `verifyRequest()` or `getKeyOwner()` for them instead. Nor are keys
225
+ * of portable actors whose IDs are `ap:` or `ap+ef61:` URIs, for the same
226
+ * reason. Keys whose IDs are compatible identifiers or `ap:` or `ap+ef61:`
227
+ * URIs are never read from or written to the key cache under their IDs,
228
+ * except for failures to fetch them.
188
229
  *
189
230
  * [FEP-ef61]: https://w3id.org/fep/ef61
190
231
  * @template T The type of the key to fetch. Either {@link CryptographicKey}
@@ -204,9 +245,11 @@ declare function fetchKey<T extends CryptographicKey | Multikey>(keyId: URL | st
204
245
  * Gateway keys of [FEP-ef61] portable actors, i.e., keys whose IDs are
205
246
  * compatible identifiers that dereference to portable actor documents, are
206
247
  * not resolved by this function, as they only authenticate HTTP requests;
207
- * use `verifyRequest()` or `getKeyOwner()` for them instead. Keys whose IDs
208
- * are compatible identifiers are never read from or written to the key
209
- * cache under their IDs, except for failures to fetch them.
248
+ * use `verifyRequest()` or `getKeyOwner()` for them instead. Nor are keys
249
+ * of portable actors whose IDs are `ap:` or `ap+ef61:` URIs, for the same
250
+ * reason. Keys whose IDs are compatible identifiers or `ap:` or `ap+ef61:`
251
+ * URIs are never read from or written to the key cache under their IDs,
252
+ * except for failures to fetch them.
210
253
  *
211
254
  * [FEP-ef61]: https://w3id.org/fep/ef61
212
255
  *