@fedify/fedify 2.4.0-dev.2065 → 2.4.0-dev.2073

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-CMkrnYbY.mjs → builder-CVHpPAjK.mjs} +6 -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-Dj3DCsoj.mjs → compound-proof-B5Skp-vE.mjs} +1 -1
  6. package/dist/{context-D_gg4M0n.d.ts → context-BSywYspi.d.ts} +153 -2
  7. package/dist/{context-b36TpPoG.d.cts → context-CZjZYXFC.d.cts} +153 -2
  8. package/dist/{context-DG5QeQ8W.mjs → context-DlZhxdFT.mjs} +2 -1
  9. package/dist/{deno-BuRFI7wk.mjs → deno-LYTbBhYV.mjs} +1 -1
  10. package/dist/{docloader-_aSNLA90.mjs → docloader-C0SWQylk.mjs} +2 -2
  11. package/dist/federation/builder.test.mjs +1 -1
  12. package/dist/federation/compound-fanout.test.mjs +4 -4
  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 +9 -9
  19. package/dist/federation/mod.cjs +1 -1
  20. package/dist/federation/mod.d.cts +3 -3
  21. package/dist/federation/mod.d.ts +3 -3
  22. package/dist/federation/mod.js +1 -1
  23. package/dist/federation/outgoing-proof.test.mjs +6 -6
  24. package/dist/federation/portable-gateway-keys.test.d.mts +2 -0
  25. package/dist/federation/portable-gateway-keys.test.mjs +363 -0
  26. package/dist/federation/portable-inbox.test.d.mts +2 -0
  27. package/dist/federation/portable-inbox.test.mjs +546 -0
  28. package/dist/federation/portable.test.mjs +3 -3
  29. package/dist/federation/send.test.mjs +3 -3
  30. package/dist/federation/tasks/enqueue.test.mjs +2 -2
  31. package/dist/federation/tasks/tasks.test.mjs +3 -3
  32. package/dist/federation/temporal.test.mjs +1 -1
  33. package/dist/federation/webfinger.test.mjs +2 -2
  34. package/dist/{federation-Coi_bg12.cjs → federation-B1aeTKKN.cjs} +631 -145
  35. package/dist/{http-f1qaBtOh.mjs → http-C7qHlv-b.mjs} +20 -5
  36. package/dist/{http-BGShIsd6.cjs → http-DGk8XI38.cjs} +2684 -48
  37. package/dist/{http-65PYi9jY.d.ts → http-n2v6DPxu.d.ts} +52 -2
  38. package/dist/http-vfTpzGEq.js +5087 -0
  39. package/dist/{http-CP-7OdSq.d.cts → http-xlG-jRdB.d.cts} +52 -2
  40. package/dist/{key-BxHsA1s9.mjs → key-BYXnTGro.mjs} +147 -7
  41. package/dist/{kv-cache-Cgj-kpQS.js → kv-cache-DCJuwdnB.js} +1 -1
  42. package/dist/{kv-cache-C9IY-FMN.mjs → kv-cache-DEH5jyND.mjs} +1 -1
  43. package/dist/{kv-cache-CY6pDNoS.cjs → kv-cache-DvqkKNIj.cjs} +1 -1
  44. package/dist/{ld-CqJq5erX.mjs → ld-DT3e2hOv.mjs} +3 -3
  45. package/dist/{metrics-DOqknlZd.mjs → metrics-DvlvYpq_.mjs} +1 -1
  46. package/dist/{middleware-VOCZN3SO.mjs → middleware-BJcez_E3.mjs} +1 -1
  47. package/dist/{middleware-1h_LgwXC.js → middleware-CCbyUF4c.js} +547 -62
  48. package/dist/{middleware-s-AZzx4r.mjs → middleware-CpyCNOW_.mjs} +549 -72
  49. package/dist/{mod-BhMvsgdF.d.ts → mod-B2h2KY0q.d.ts} +1 -1
  50. package/dist/{mod-Dhm7SqyE.d.ts → mod-C9WSpZWm.d.ts} +1 -1
  51. package/dist/{mod-C0BYc0OU.d.ts → mod-CVZrXSdm.d.ts} +1 -1
  52. package/dist/{mod-pLbeNwcC.d.cts → mod-HDSvS-ww.d.cts} +1 -1
  53. package/dist/{mod-Bfenkg_c.d.cts → mod-JzkaEXsi.d.cts} +1 -1
  54. package/dist/{mod-CyiSjRkk.d.cts → mod-xGFCHqq_.d.cts} +1 -1
  55. package/dist/mod.cjs +18 -18
  56. package/dist/mod.d.cts +7 -7
  57. package/dist/mod.d.ts +7 -7
  58. package/dist/mod.js +5 -5
  59. package/dist/nodeinfo/handler.test.mjs +2 -2
  60. package/dist/{owner-D_F22lfM.mjs → owner-CDsVeZI7.mjs} +45 -2
  61. package/dist/owner-DCIH7Iq0.cjs +225 -0
  62. package/dist/owner-DfGz0cXm.js +215 -0
  63. package/dist/portable-key-DCyKGCQd.mjs +194 -0
  64. package/dist/{proof-B03JXhrk.mjs → proof-CxsVG6vM.mjs} +5 -5
  65. package/dist/{send-NNkfKtVN.mjs → send-BZJ7NsVV.mjs} +8 -4
  66. package/dist/sig/compound-proof-discovery.test.mjs +1 -1
  67. package/dist/sig/compound-proof-producer.test.mjs +1 -1
  68. package/dist/sig/compound-proof-verification.test.mjs +2 -2
  69. package/dist/sig/compound-proof.test.mjs +3 -3
  70. package/dist/sig/http.test.mjs +2 -2
  71. package/dist/sig/key.test.mjs +1 -1
  72. package/dist/sig/ld.test.mjs +2 -2
  73. package/dist/sig/mod.cjs +16 -16
  74. package/dist/sig/mod.d.cts +2 -2
  75. package/dist/sig/mod.d.ts +2 -2
  76. package/dist/sig/mod.js +3 -3
  77. package/dist/sig/owner.test.mjs +1 -1
  78. package/dist/sig/portable-collection.test.mjs +3 -3
  79. package/dist/sig/portable-key.test.d.mts +2 -0
  80. package/dist/sig/portable-key.test.mjs +275 -0
  81. package/dist/sig/proof.test.mjs +4 -4
  82. package/dist/{sig-B1E2uyhQ.cjs → sig-C6TnADze.cjs} +4 -4
  83. package/dist/{sig-Bb20Pyrd.js → sig-Cs9_ecdh.js} +2 -2
  84. package/dist/{temporal-VVVSuruq.mjs → temporal-CLzSfIOV.mjs} +1 -1
  85. package/dist/testing/kv.test.mjs +1 -1
  86. package/dist/testing/mod.d.mts +151 -0
  87. package/dist/testing/mod.mjs +2 -2
  88. package/dist/{testing-By1YYsIK.mjs → testing-CO_cEvQc.mjs} +1 -1
  89. package/dist/utils/docloader.test.mjs +2 -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 +6 -6
  96. package/dist/http-z5n7chWw.js +0 -2647
  97. package/dist/owner-BLBWXCNt.js +0 -2276
  98. package/dist/owner-D8ZpRusc.cjs +0 -2446
@@ -3,6 +3,28 @@ import { Actor, CryptographicKey, Multikey } from "@fedify/vocab";
3
3
  import { MeterProvider, TracerProvider } from "@opentelemetry/api";
4
4
  import { DocumentLoader } from "@fedify/vocab-runtime";
5
5
 
6
+ //#region src/sig/portable-key.d.ts
7
+ /**
8
+ * The result of resolving a gateway key of a portable actor.
9
+ * @internal
10
+ */
11
+ type PortableGatewayKeyResolution = {
12
+ /**
13
+ * The document at the key ID is not a portable actor, so the key is
14
+ * resolved as usual.
15
+ */
16
+ readonly type: "legacy";
17
+ } | {
18
+ /** The document is a portable actor, but it does not vouch for the key. */readonly type: "rejected";
19
+ readonly reason: string;
20
+ } | {
21
+ /** The portable actor's signed document vouches for the key. */readonly type: "verified";
22
+ readonly actor: Actor;
23
+ readonly key: CryptographicKey & {
24
+ publicKey: CryptoKey;
25
+ };
26
+ };
27
+ //#endregion
6
28
  //#region src/sig/key.d.ts
7
29
  /**
8
30
  * Generates a key pair which is appropriate for Fedify.
@@ -91,6 +113,18 @@ interface FetchKeyOptions {
91
113
  * @internal
92
114
  */
93
115
  keyIdBoundByCaller?: boolean;
116
+ /**
117
+ * Resolves a gateway key of an [FEP-ef61] portable actor, i.e., a key whose
118
+ * ID is a compatible identifier and dereferences to a portable actor's
119
+ * document. Such a key is resolved only through this function, and is
120
+ * rejected if it is omitted, so that only HTTP Signature verification,
121
+ * which passes it, accepts gateway keys. Object Integrity Proofs and
122
+ * Linked Data Signatures never do.
123
+ *
124
+ * [FEP-ef61]: https://w3id.org/fep/ef61
125
+ * @internal
126
+ */
127
+ portableGatewayKeyResolver?: (document: unknown, actor: Actor, keyId: URL) => Promise<PortableGatewayKeyResolution>;
94
128
  }
95
129
  /**
96
130
  * The result of {@link fetchKey}.
@@ -139,7 +173,15 @@ type FetchableKeyClass<T extends CryptographicKey | Multikey> = (new (...args: a
139
173
  /**
140
174
  * Fetches a {@link CryptographicKey} or {@link Multikey} from the given URL.
141
175
  * If the given URL contains an {@link Actor} object, it tries to find
142
- * the corresponding key in the `publicKey` or `assertionMethod` property.
176
+ * the corresponding key in the `publicKey` or `assertionMethod` property. *
177
+ * Gateway keys of [FEP-ef61] portable actors, i.e., keys whose IDs are
178
+ * compatible identifiers that dereference to portable actor documents, are
179
+ * not resolved by this function, as they only authenticate HTTP requests;
180
+ * use `verifyRequest()` or `getKeyOwner()` for them instead. Keys
181
+ * whose IDs are compatible identifiers are never read from or written to
182
+ * the key cache.
183
+ *
184
+ * [FEP-ef61]: https://w3id.org/fep/ef61
143
185
  * @template T The type of the key to fetch. Either {@link CryptographicKey}
144
186
  * or {@link Multikey}.
145
187
  * @param keyId The URL of the key.
@@ -153,7 +195,15 @@ declare function fetchKey<T extends CryptographicKey | Multikey>(keyId: URL | st
153
195
  /**
154
196
  * Fetches a {@link CryptographicKey} or {@link Multikey} from the given URL,
155
197
  * preserving transport-level fetch failures for callers that need to inspect
156
- * why the key could not be loaded.
198
+ * why the key could not be loaded. *
199
+ * Gateway keys of [FEP-ef61] portable actors, i.e., keys whose IDs are
200
+ * compatible identifiers that dereference to portable actor documents, are
201
+ * not resolved by this function, as they only authenticate HTTP requests;
202
+ * use `verifyRequest()` or `getKeyOwner()` for them instead. Keys
203
+ * whose IDs are compatible identifiers are never read from or written to
204
+ * the key cache.
205
+ *
206
+ * [FEP-ef61]: https://w3id.org/fep/ef61
157
207
  *
158
208
  * @template T The type of the key to fetch. Either {@link CryptographicKey}
159
209
  * or {@link Multikey}.