@fedify/fedify 1.9.0-pr.428.1588 → 1.9.0-pr.431.1597

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 (153) hide show
  1. package/dist/actor-CHOM_AN3.d.cts +128 -0
  2. package/dist/actor-CfaqWvJb.cjs +37783 -0
  3. package/dist/{actor-CdM_sJLC.js → actor-Detmisdi.js} +190 -190
  4. package/dist/{actor-ByOSf9n9.js → actor-Dw7av4Zk.js} +1 -1
  5. package/dist/{authdocloader-VVd0U8Qg.js → authdocloader-5UJ5Gme-.js} +6 -6
  6. package/dist/authdocloader-BVYv0Ct8.cjs +58 -0
  7. package/dist/{authdocloader-CfP6lfxM.js → authdocloader-ZlLoXSxM.js} +3 -3
  8. package/dist/{builder-mfXmda-W.js → builder-BbKfqPmR.js} +4 -4
  9. package/dist/chunk-DqRYRqnO.cjs +34 -0
  10. package/dist/{client-DB8N2RwI.js → client-DgRjF0ha.js} +1 -1
  11. package/dist/client-DjT_tegg.d.cts +294 -0
  12. package/dist/compat/mod.cjs +10 -0
  13. package/dist/compat/mod.d.cts +13 -0
  14. package/dist/compat/mod.js +5 -5
  15. package/dist/compat/transformers.test.js +16 -16
  16. package/dist/compat-DmDDELst.cjs +4 -0
  17. package/dist/compat-nxUqe4Z-.js +4 -0
  18. package/dist/context-KXVF2AhH.d.cts +2261 -0
  19. package/dist/{docloader-XJzCMWY-.js → docloader-BKf9RWX4.js} +4 -4
  20. package/dist/docloader-D-MrRyHl.d.cts +219 -0
  21. package/dist/docloader-eqgyMp7h.cjs +4682 -0
  22. package/dist/{esm-BVYQVacR.js → esm-B_ZjJ1sB.js} +1 -1
  23. package/dist/federation/builder.test.js +5 -5
  24. package/dist/federation/collection.test.js +3 -3
  25. package/dist/federation/handler.test.js +17 -17
  26. package/dist/federation/inbox.test.js +4 -4
  27. package/dist/federation/keycache.test.js +4 -4
  28. package/dist/federation/kv.test.js +3 -3
  29. package/dist/federation/middleware.test.js +18 -18
  30. package/dist/federation/mod.cjs +29 -0
  31. package/dist/federation/mod.d.cts +13 -0
  32. package/dist/federation/mod.js +15 -15
  33. package/dist/federation/mq.test.js +3 -3
  34. package/dist/federation/retry.test.js +3 -3
  35. package/dist/federation/router.test.js +3 -3
  36. package/dist/federation/send.test.js +10 -10
  37. package/dist/{federation-CMX7WzeL.js → federation-D1U8YY9t.js} +3 -3
  38. package/dist/federation-H2_En3j5.cjs +244 -0
  39. package/dist/http-B_zBcsai.d.cts +253 -0
  40. package/dist/{http-B_bBrm6N.js → http-C5XLveZw.js} +2 -2
  41. package/dist/{http-DYB4M8Pr.js → http-CwlUFNG4.js} +6 -6
  42. package/dist/http-_vjuGcXn.cjs +826 -0
  43. package/dist/{inbox-B4k2JQpE.js → inbox-sVXiVBbT.js} +1 -1
  44. package/dist/key-19P2dWvf.cjs +290 -0
  45. package/dist/{key-BdBFUTr5.js → key-BCWvPOkD.js} +5 -5
  46. package/dist/key-CsQ7J8-m.js +10 -0
  47. package/dist/key-Dt7qJaQT.cjs +10 -0
  48. package/dist/{key-feGm-IP3.js → key-Jrnr66vx.js} +2 -2
  49. package/dist/{key-BcVEPl--.js → key-lpATOAE4.js} +3 -3
  50. package/dist/{keycache-b7FYgzB9.js → keycache-ogQInQck.js} +1 -1
  51. package/dist/{keys-B7uX1KoX.js → keys-DcGsKtHW.js} +1 -1
  52. package/dist/kv-63Cil1MD.d.cts +81 -0
  53. package/dist/{ld-DJCemZO2.js → ld-BSE4jnyK.js} +2 -2
  54. package/dist/lookup-D96ipStp.cjs +137 -0
  55. package/dist/{lookup-CIsbr_Qi.js → lookup-D_-F1hLw.js} +4 -4
  56. package/dist/{lookup-CXaZBmuy.js → lookup-DdxOle8f.js} +1 -1
  57. package/dist/middleware-B0f850Ei.cjs +17 -0
  58. package/dist/middleware-B2DFqtJ-.cjs +4240 -0
  59. package/dist/middleware-COHAbwGs.js +17 -0
  60. package/dist/{middleware-D5JRdsEc.js → middleware-CuTcPjfP.js} +13 -13
  61. package/dist/middleware-Dt7C7qpw.js +26 -0
  62. package/dist/{middleware-e_Gw7sQy.js → middleware-T_y4Bnvw.js} +14 -14
  63. package/dist/mod-C2tOeRkN.d.cts +1 -0
  64. package/dist/mod-C3CGxYoF.d.cts +102 -0
  65. package/dist/mod-COw_caPC.d.cts +266 -0
  66. package/dist/mod-FZd39qVq.d.cts +1 -0
  67. package/dist/mod-NKH_G-IY.d.cts +289 -0
  68. package/dist/mod-YfAcrVbP.d.cts +80 -0
  69. package/dist/mod-jQ4OODsl.d.cts +113 -0
  70. package/dist/mod.cjs +152 -0
  71. package/dist/mod.d.cts +17 -0
  72. package/dist/mod.js +20 -20
  73. package/dist/mq-B7R1Q-M5.d.cts +140 -0
  74. package/dist/nodeinfo/client.test.js +5 -5
  75. package/dist/nodeinfo/handler.test.js +16 -16
  76. package/dist/nodeinfo/mod.cjs +13 -0
  77. package/dist/nodeinfo/mod.d.cts +5 -0
  78. package/dist/nodeinfo/mod.js +6 -6
  79. package/dist/nodeinfo/semver.test.js +3 -3
  80. package/dist/nodeinfo/types.test.js +3 -3
  81. package/dist/nodeinfo-Co9lJrWl.cjs +4 -0
  82. package/dist/nodeinfo-DfycQ8Wf.js +4 -0
  83. package/dist/owner-C9Ry0TOI.d.cts +67 -0
  84. package/dist/{owner-i9FkgZwa.js → owner-DJtc8evi.js} +2 -2
  85. package/dist/{proof-Bvtdd-Ul.js → proof-9OMp0o4n.js} +2 -2
  86. package/dist/{proof-DKGUTtBt.js → proof-BuPk23Er.js} +6 -6
  87. package/dist/proof-CRHppbRk.cjs +673 -0
  88. package/dist/runtime/authdocloader.test.js +9 -9
  89. package/dist/runtime/docloader.test.js +4 -4
  90. package/dist/runtime/key.test.js +5 -5
  91. package/dist/runtime/langstr.test.js +3 -3
  92. package/dist/runtime/mod.cjs +25 -0
  93. package/dist/runtime/mod.d.cts +6 -0
  94. package/dist/runtime/mod.js +10 -10
  95. package/dist/runtime/multibase/multibase.test.js +3 -3
  96. package/dist/runtime/url.test.js +3 -3
  97. package/dist/runtime-C58AJWSv.cjs +4 -0
  98. package/dist/runtime-DPYEDf-o.js +4 -0
  99. package/dist/{send-Cuw-wTCx.js → send-cXerEJm9.js} +2 -2
  100. package/dist/sig/http.test.js +8 -8
  101. package/dist/sig/key.test.js +6 -6
  102. package/dist/sig/ld.test.js +7 -7
  103. package/dist/sig/mod.cjs +30 -0
  104. package/dist/sig/mod.d.cts +8 -0
  105. package/dist/sig/mod.js +10 -10
  106. package/dist/sig/owner.test.js +7 -7
  107. package/dist/sig/proof.test.js +7 -7
  108. package/dist/sig-ByHXzqUi.cjs +4 -0
  109. package/dist/sig-Cj3tk-ig.js +4 -0
  110. package/dist/testing/docloader.test.js +3 -3
  111. package/dist/testing/mod.js +3 -3
  112. package/dist/{testing-DUFWSgSt.js → testing-BX6IA3LR.js} +2 -2
  113. package/dist/{transformers-Dna8Fg7k.js → transformers-BFT6d7J5.js} +3 -3
  114. package/dist/transformers-CoBS-oFG.cjs +116 -0
  115. package/dist/{type-DDwsy8fI.js → type-DF9yoIpt.js} +186 -186
  116. package/dist/types-DcKQIzdO.cjs +488 -0
  117. package/dist/{types-CuvNqe2X.js → types-Q17QxOOC.js} +4 -4
  118. package/dist/vocab/actor.test.js +5 -5
  119. package/dist/vocab/lookup.test.js +4 -4
  120. package/dist/vocab/mod.cjs +87 -0
  121. package/dist/vocab/mod.d.cts +6 -0
  122. package/dist/vocab/mod.js +7 -7
  123. package/dist/vocab/type.test.js +3 -3
  124. package/dist/vocab/vocab.test.js +4 -4
  125. package/dist/{vocab-CEXwobaS.js → vocab-BUc_4ZsW.js} +6 -6
  126. package/dist/vocab-BzGg7ltX.d.cts +14629 -0
  127. package/dist/vocab-Du8FV6H1.cjs +282 -0
  128. package/dist/webfinger/handler.test.js +16 -16
  129. package/dist/webfinger/lookup.test.js +4 -4
  130. package/dist/webfinger/mod.cjs +9 -0
  131. package/dist/webfinger/mod.d.cts +4 -0
  132. package/dist/webfinger/mod.js +6 -6
  133. package/dist/webfinger-BjOEdFPs.cjs +4 -0
  134. package/dist/webfinger-De_bU0iE.js +4 -0
  135. package/dist/x/cfworkers.cjs +100 -0
  136. package/dist/x/cfworkers.d.cts +59 -0
  137. package/dist/x/cfworkers.js +3 -3
  138. package/dist/x/cfworkers.test.js +3 -3
  139. package/dist/x/hono.cjs +61 -0
  140. package/dist/x/hono.d.cts +54 -0
  141. package/dist/x/hono.js +3 -3
  142. package/dist/x/sveltekit.cjs +69 -0
  143. package/dist/x/sveltekit.d.cts +46 -0
  144. package/dist/x/sveltekit.js +3 -3
  145. package/package.json +68 -12
  146. package/dist/compat-Bb5myD13.js +0 -4
  147. package/dist/key-0hFXQUQz.js +0 -10
  148. package/dist/middleware-BhQdOVAF.js +0 -17
  149. package/dist/middleware-DVy3ms0C.js +0 -26
  150. package/dist/nodeinfo-CyEbLjHs.js +0 -4
  151. package/dist/runtime-BSkOVUWM.js +0 -4
  152. package/dist/sig-BXJO--F9.js +0 -4
  153. package/dist/webfinger-C3GIyXIg.js +0 -4
@@ -0,0 +1,253 @@
1
+ import { DocumentLoader } from "./docloader-D-MrRyHl.cjs";
2
+ import { CryptographicKey, Multikey } from "./vocab-BzGg7ltX.cjs";
3
+ import { TracerProvider } from "@opentelemetry/api";
4
+
5
+ //#region src/sig/key.d.ts
6
+
7
+ /**
8
+ * Generates a key pair which is appropriate for Fedify.
9
+ * @param algorithm The algorithm to use. Currently only RSASSA-PKCS1-v1_5 and
10
+ * Ed25519 are supported.
11
+ * @returns The generated key pair.
12
+ * @throws {TypeError} If the algorithm is unsupported.
13
+ */
14
+ declare function generateCryptoKeyPair(algorithm?: "RSASSA-PKCS1-v1_5" | "Ed25519"): Promise<CryptoKeyPair>;
15
+ /**
16
+ * Exports a key in JWK format.
17
+ * @param key The key to export. Either public or private key.
18
+ * @returns The exported key in JWK format. The key is suitable for
19
+ * serialization and storage.
20
+ * @throws {TypeError} If the key is invalid or unsupported.
21
+ */
22
+ declare function exportJwk(key: CryptoKey): Promise<JsonWebKey>;
23
+ /**
24
+ * Imports a key from JWK format.
25
+ * @param jwk The key in JWK format.
26
+ * @param type Which type of key to import, either `"public"` or `"private"`.
27
+ * @returns The imported key.
28
+ * @throws {TypeError} If the key is invalid or unsupported.
29
+ */
30
+ declare function importJwk(jwk: JsonWebKey, type: "public" | "private"): Promise<CryptoKey>;
31
+ /**
32
+ * Options for {@link fetchKey}.
33
+ * @since 1.3.0
34
+ */
35
+ interface FetchKeyOptions {
36
+ /**
37
+ * The document loader for loading remote JSON-LD documents.
38
+ */
39
+ documentLoader?: DocumentLoader;
40
+ /**
41
+ * The context loader for loading remote JSON-LD contexts.
42
+ */
43
+ contextLoader?: DocumentLoader;
44
+ /**
45
+ * The key cache to use for caching public keys.
46
+ * @since 0.12.0
47
+ */
48
+ keyCache?: KeyCache;
49
+ /**
50
+ * The OpenTelemetry tracer provider to use for tracing. If omitted,
51
+ * the global tracer provider is used.
52
+ * @since 1.3.0
53
+ */
54
+ tracerProvider?: TracerProvider;
55
+ }
56
+ /**
57
+ * The result of {@link fetchKey}.
58
+ * @since 1.3.0
59
+ */
60
+ interface FetchKeyResult<T extends CryptographicKey | Multikey> {
61
+ /**
62
+ * The fetched (or cached) key.
63
+ */
64
+ readonly key: T & {
65
+ publicKey: CryptoKey;
66
+ } | null;
67
+ /**
68
+ * Whether the key is fetched from the cache.
69
+ */
70
+ readonly cached: boolean;
71
+ }
72
+ /**
73
+ * Fetches a {@link CryptographicKey} or {@link Multikey} from the given URL.
74
+ * If the given URL contains an {@link Actor} object, it tries to find
75
+ * the corresponding key in the `publicKey` or `assertionMethod` property.
76
+ * @template T The type of the key to fetch. Either {@link CryptographicKey}
77
+ * or {@link Multikey}.
78
+ * @param keyId The URL of the key.
79
+ * @param cls The class of the key to fetch. Either {@link CryptographicKey}
80
+ * or {@link Multikey}.
81
+ * @param options Options for fetching the key. See {@link FetchKeyOptions}.
82
+ * @returns The fetched key or `null` if the key is not found.
83
+ * @since 1.3.0
84
+ */
85
+ declare function fetchKey<T extends CryptographicKey | Multikey>(keyId: URL | string, cls: (new (...args: any[]) => T) & {
86
+ fromJsonLd(jsonLd: unknown, options: {
87
+ documentLoader?: DocumentLoader;
88
+ contextLoader?: DocumentLoader;
89
+ tracerProvider?: TracerProvider;
90
+ }): Promise<T>;
91
+ }, options?: FetchKeyOptions): Promise<FetchKeyResult<T>>;
92
+ /**
93
+ * A cache for storing cryptographic keys.
94
+ * @since 0.12.0
95
+ */
96
+ interface KeyCache {
97
+ /**
98
+ * Gets a key from the cache.
99
+ * @param keyId The key ID.
100
+ * @returns The key if found, `null` if the key is not available (e.g.,
101
+ * fetching the key was tried but failed), or `undefined`
102
+ * if the cache is not available.
103
+ */
104
+ get(keyId: URL): Promise<CryptographicKey | Multikey | null | undefined>;
105
+ /**
106
+ * Sets a key to the cache.
107
+ *
108
+ * Note that this caches unavailable keys (i.e., `null`) as well,
109
+ * and it is recommended to make unavailable keys expire after a short period.
110
+ * @param keyId The key ID.
111
+ * @param key The key to cache. `null` means the key is not available
112
+ * (e.g., fetching the key was tried but failed).
113
+ */
114
+ set(keyId: URL, key: CryptographicKey | Multikey | null): Promise<void>;
115
+ }
116
+ //#endregion
117
+ //#region src/sig/http.d.ts
118
+ /**
119
+ * The standard to use for signing and verifying HTTP signatures.
120
+ * @since 1.6.0
121
+ */
122
+ type HttpMessageSignaturesSpec =
123
+ /**
124
+ * The Signing HTTP Messages (draft-cavage-http-signatures-12) specification,
125
+ * which is widely adopted and used in the fediverse (as of May 2025).
126
+ */
127
+ "draft-cavage-http-signatures-12"
128
+ /**
129
+ * The HTTP Message Signatures (RFC 9421) specification, which is the
130
+ * finalized standard but not widely adopted yet (as of May 2025).
131
+ */ | "rfc9421";
132
+ /**
133
+ * Options for {@link signRequest}.
134
+ * @since 1.3.0
135
+ */
136
+ interface SignRequestOptions {
137
+ /**
138
+ * The HTTP message signatures specification to use for signing.
139
+ * @default `"draft-cavage-http-signatures-12"`
140
+ * @since 1.6.0
141
+ */
142
+ spec?: HttpMessageSignaturesSpec;
143
+ /**
144
+ * The current time. If not specified, the current time is used. This is
145
+ * useful for testing.
146
+ * @since 1.6.0
147
+ */
148
+ currentTime?: Temporal.Instant;
149
+ /**
150
+ * The request body as ArrayBuffer. If provided, avoids cloning the request body.
151
+ * @since 1.7.7
152
+ */
153
+ body?: ArrayBuffer | null;
154
+ /**
155
+ * The OpenTelemetry tracer provider. If omitted, the global tracer provider
156
+ * is used.
157
+ */
158
+ tracerProvider?: TracerProvider;
159
+ }
160
+ /**
161
+ * Signs a request using the given private key.
162
+ * @param request The request to sign.
163
+ * @param privateKey The private key to use for signing.
164
+ * @param keyId The key ID to use for the signature. It will be used by the
165
+ * verifier.
166
+ * @returns The signed request.
167
+ * @throws {TypeError} If the private key is invalid or unsupported.
168
+ */
169
+ declare function signRequest(request: Request, privateKey: CryptoKey, keyId: URL, options?: SignRequestOptions): Promise<Request>;
170
+ /**
171
+ * Options for {@link verifyRequest}.
172
+ */
173
+ interface VerifyRequestOptions {
174
+ /**
175
+ * The document loader to use for fetching the public key.
176
+ */
177
+ documentLoader?: DocumentLoader;
178
+ /**
179
+ * The context loader to use for JSON-LD context retrieval.
180
+ */
181
+ contextLoader?: DocumentLoader;
182
+ /**
183
+ * The time window to allow for the request date. The actual time window is
184
+ * twice the value of this option, with the current time as the center.
185
+ * Or if it is `false`, no time check is performed.
186
+ *
187
+ * An hour by default.
188
+ */
189
+ timeWindow?: Temporal.Duration | Temporal.DurationLike | false;
190
+ /**
191
+ * The current time. If not specified, the current time is used. This is
192
+ * useful for testing.
193
+ */
194
+ currentTime?: Temporal.Instant;
195
+ /**
196
+ * The key cache to use for caching public keys.
197
+ * @since 0.12.0
198
+ */
199
+ keyCache?: KeyCache;
200
+ /**
201
+ * The HTTP message signatures specification to use for verifying.
202
+ * @default `"draft-cavage-http-signatures-12"`
203
+ * @since 1.6.0
204
+ */
205
+ spec?: HttpMessageSignaturesSpec;
206
+ /**
207
+ * The OpenTelemetry tracer provider. If omitted, the global tracer provider
208
+ * is used.
209
+ * @since 1.3.0
210
+ */
211
+ tracerProvider?: TracerProvider;
212
+ }
213
+ /**
214
+ * Verifies the signature of a request.
215
+ *
216
+ * Note that this function consumes the request body, so it should not be used
217
+ * if the request body is already consumed. Consuming the request body after
218
+ * calling this function is okay, since this function clones the request
219
+ * under the hood.
220
+ *
221
+ * @param request The request to verify.
222
+ * @param options Options for verifying the request.
223
+ * @returns The public key of the verified signature, or `null` if the signature
224
+ * could not be verified.
225
+ */
226
+ declare function verifyRequest(request: Request, options?: VerifyRequestOptions): Promise<CryptographicKey | null>;
227
+ /**
228
+ * A spec determiner for HTTP Message Signatures.
229
+ * It determines the spec to use for signing requests.
230
+ * It is used for double-knocking
231
+ * (see <https://swicg.github.io/activitypub-http-signature/#how-to-upgrade-supported-versions>).
232
+ * @since 1.6.0
233
+ */
234
+ interface HttpMessageSignaturesSpecDeterminer {
235
+ /**
236
+ * Determines the spec to use for signing requests.
237
+ * @param origin The origin of the URL to make the request to.
238
+ * @returns The spec to use for signing requests.
239
+ */
240
+ determineSpec(origin: string): HttpMessageSignaturesSpec | Promise<HttpMessageSignaturesSpec>;
241
+ /**
242
+ * Remembers the successfully used spec for the given origin.
243
+ * @param origin The origin of the URL that was requested.
244
+ * @param spec The spec to remember.
245
+ */
246
+ rememberSpec(origin: string, spec: HttpMessageSignaturesSpec): void | Promise<void>;
247
+ }
248
+ /**
249
+ * The options for double-knock requests.
250
+ * @since 1.6.0
251
+ */
252
+ //#endregion
253
+ export { FetchKeyOptions, FetchKeyResult, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, SignRequestOptions, VerifyRequestOptions, exportJwk, fetchKey, generateCryptoKeyPair, importJwk, signRequest, verifyRequest };
@@ -3,8 +3,8 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { CryptographicKey, deno_default } from "./type-DDwsy8fI.js";
7
- import { fetchKey, validateCryptoKey } from "./key-feGm-IP3.js";
6
+ import { CryptographicKey, deno_default } from "./type-DF9yoIpt.js";
7
+ import { fetchKey, validateCryptoKey } from "./key-Jrnr66vx.js";
8
8
  import { getLogger } from "@logtape/logtape";
9
9
  import { SpanStatusCode, trace } from "@opentelemetry/api";
10
10
  import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
@@ -1,10 +1,10 @@
1
1
 
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
-
5
- import { deno_default } from "./docloader-XJzCMWY-.js";
6
- import { CryptographicKey } from "./actor-CdM_sJLC.js";
7
- import { fetchKey, validateCryptoKey } from "./key-BdBFUTr5.js";
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ import { URLPattern } from "urlpattern-polyfill";
4
+
5
+ import { deno_default } from "./docloader-BKf9RWX4.js";
6
+ import { CryptographicKey } from "./actor-Detmisdi.js";
7
+ import { fetchKey, validateCryptoKey } from "./key-BCWvPOkD.js";
8
8
  import { getLogger } from "@logtape/logtape";
9
9
  import { SpanStatusCode, trace } from "@opentelemetry/api";
10
10
  import { decodeBase64, encodeBase64 } from "byte-encodings/base64";