@fedify/fedify 2.4.0-dev.2127 → 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.
- package/dist/{builder-B2bgGYbP.mjs → builder-C0bxZDL0.mjs} +3 -3
- package/dist/compat/mod.d.cts +1 -1
- package/dist/compat/mod.d.ts +1 -1
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{compound-proof-SVlHSzV7.mjs → compound-proof-D9Kljk_7.mjs} +3 -3
- package/dist/{context-Ci5vuUr_.d.ts → context-Cz1w5Krc.d.ts} +1 -1
- package/dist/{context-Bm6ldGvx.d.cts → context-Dvec_D_h.d.cts} +1 -1
- package/dist/{deno-Be9xoxps.mjs → deno-_o3lkDlG.mjs} +1 -1
- package/dist/{docloader-Dtuyb0ps.mjs → docloader-BbS0rO-Y.mjs} +2 -2
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/compound-fanout.test.mjs +3 -3
- package/dist/federation/handler-compound-proof.test.mjs +3 -3
- package/dist/federation/handler.test.mjs +5 -5
- package/dist/federation/hashlink-media.test.mjs +2 -2
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +7 -7
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.d.cts +2 -2
- package/dist/federation/mod.d.ts +2 -2
- package/dist/federation/mod.js +1 -1
- package/dist/federation/outgoing-proof.test.mjs +6 -6
- package/dist/federation/portable-actor.test.mjs +3 -3
- package/dist/federation/portable-chain.test.mjs +3 -3
- package/dist/federation/portable-gateway-keys.test.mjs +76 -5
- package/dist/federation/portable-inbox.test.mjs +9 -4
- package/dist/federation/portable.test.mjs +3 -3
- package/dist/federation/send.test.mjs +3 -3
- package/dist/federation/tasks/enqueue.test.mjs +1 -1
- package/dist/federation/tasks/tasks.test.mjs +2 -2
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{federation-B6IHuS6n.cjs → federation-DRY8KrkB.cjs} +12 -12
- package/dist/{http-o8l4QeUY.cjs → http-B1J6E-bT.cjs} +384 -33
- package/dist/{http-BFeK9sBg.mjs → http-BpOiZE09.mjs} +18 -12
- package/dist/{http-D76Py0M4.d.cts → http-C-x_OLSp.d.ts} +57 -14
- package/dist/{http-Rmbiu-5S.js → http-C2M6wcs8.js} +374 -35
- package/dist/{http-BrQgkJay.d.ts → http-CjezPjFX.d.cts} +57 -14
- package/dist/{key-Cc1b6pW9.mjs → key-DolJjJab.mjs} +103 -16
- package/dist/{kv-cache-tLKBfxHc.mjs → kv-cache-Bq2cah0c.mjs} +1 -1
- package/dist/{kv-cache-BweDce2I.js → kv-cache-D7TiyMxv.js} +1 -1
- package/dist/{kv-cache-BUkgZAcX.cjs → kv-cache-D9nRbG2Q.cjs} +1 -1
- package/dist/{ld-DQNTIrAe.mjs → ld-Dwc176V4.mjs} +3 -3
- package/dist/{metrics-DDE9S63Q.mjs → metrics-CDaHfBXY.mjs} +1 -1
- package/dist/{middleware-CsQorLC_.mjs → middleware-CmB1FD8A.mjs} +1 -1
- package/dist/{middleware-K9aLnf57.js → middleware-CylX-pvI.js} +12 -12
- package/dist/{middleware-BdhvduR9.mjs → middleware-DN3MdTDg.mjs} +24 -24
- package/dist/{mod-Co53r-VP.d.ts → mod-Bz9tFXI2.d.ts} +1 -1
- package/dist/{mod-Cwdt_CWU.d.ts → mod-CZetqT5h.d.ts} +1 -1
- package/dist/{mod-Cr79cQlc.d.cts → mod-D4g9ffEn.d.cts} +1 -1
- package/dist/{mod-AVir5nVI.d.cts → mod-DGOIxEfb.d.cts} +1 -1
- package/dist/{mod-Byt5tvAS.d.cts → mod-S--JxYjo.d.cts} +1 -1
- package/dist/{mod-eVOUPbQE.d.ts → mod-owwElvpw.d.ts} +1 -1
- package/dist/mod.cjs +4 -4
- package/dist/mod.d.cts +5 -5
- package/dist/mod.d.ts +5 -5
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/{owner-CCfdL83M.mjs → owner-BNHhwjNu.mjs} +37 -4
- package/dist/{portable-collection-WXaHkNqC.mjs → portable-collection-CRpTUHCY.mjs} +2 -2
- package/dist/{portable-collection-DdXsKBg4.js → portable-collection-CgglAI9B.js} +34 -1
- package/dist/{portable-collection-DXogVs__.cjs → portable-collection-PTGD0q70.cjs} +34 -1
- package/dist/portable-key-DqX2emHQ.mjs +395 -0
- package/dist/{portable-key-id-T7lecIbt.mjs → portable-key-id-Bg259c4Z.mjs} +69 -2
- package/dist/{proof-CW8k0R1G.mjs → proof-B4_0E-KU.mjs} +5 -5
- package/dist/{send--FORaIc4.mjs → send-Dpu5qbP5.mjs} +3 -3
- package/dist/sig/compound-proof-discovery.test.mjs +1 -1
- package/dist/sig/compound-proof-producer.test.mjs +1 -1
- package/dist/sig/compound-proof-verification.test.mjs +2 -2
- package/dist/sig/compound-proof.test.mjs +2 -2
- package/dist/sig/http.test.mjs +2 -2
- package/dist/sig/key.test.mjs +1 -1
- package/dist/sig/ld.test.mjs +2 -2
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.d.cts +2 -2
- package/dist/sig/mod.d.ts +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/portable-collection.test.mjs +1 -1
- package/dist/sig/portable-key.test.mjs +479 -5
- package/dist/sig/proof.test.mjs +3 -3
- package/dist/{temporal-CffY_XOJ.mjs → temporal-78JVR3GK.mjs} +1 -1
- package/dist/testing/kv.test.mjs +1 -1
- package/dist/utils/docloader.test.mjs +2 -2
- package/dist/utils/kv-cache.test.mjs +1 -1
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.d.cts +1 -1
- package/dist/utils/mod.d.ts +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +6 -6
- package/dist/portable-key-C-fPq_Yf.mjs +0 -214
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
-
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-
|
|
4
|
+
import { n as version, t as name } from "./deno-_o3lkDlG.mjs";
|
|
5
|
+
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-CDaHfBXY.mjs";
|
|
6
6
|
import { i as validateAcceptSignature, n as fulfillAcceptSignature, r as parseAcceptSignature } from "./accept-CPVqki78.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { f as parseKeyIdString } from "./portable-key-id-Bg259c4Z.mjs";
|
|
8
|
+
import { a as fetchKeyDetailed, c as validateCryptoKey, t as bypassKeyCacheReads } from "./key-DolJjJab.mjs";
|
|
9
|
+
import { n as resolvePortableActorKey, r as verifyPortableGatewayKeyDocument } from "./portable-key-DqX2emHQ.mjs";
|
|
9
10
|
import { getLogger } from "@logtape/logtape";
|
|
10
11
|
import { CryptographicKey } from "@fedify/vocab";
|
|
11
12
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
@@ -383,13 +384,18 @@ function keyFetchErrorResult(keyId, result) {
|
|
|
383
384
|
}
|
|
384
385
|
};
|
|
385
386
|
}
|
|
387
|
+
/**
|
|
388
|
+
* Creates the resolvers of keys of FEP-ef61 portable actors, which HTTP
|
|
389
|
+
* Signature verification alone passes to key lookups.
|
|
390
|
+
*/
|
|
391
|
+
function createPortableKeyResolvers(options) {
|
|
392
|
+
return {
|
|
393
|
+
gatewayKey: (document, actor, keyId) => verifyPortableGatewayKeyDocument(document, actor, keyId, options),
|
|
394
|
+
actorKey: (keyId) => resolvePortableActorKey(keyId, options)
|
|
395
|
+
};
|
|
396
|
+
}
|
|
386
397
|
function parseKeyId(value) {
|
|
387
|
-
|
|
388
|
-
try {
|
|
389
|
-
return new URL(value);
|
|
390
|
-
} catch {
|
|
391
|
-
return null;
|
|
392
|
-
}
|
|
398
|
+
return value == null ? null : parseKeyIdString(value);
|
|
393
399
|
}
|
|
394
400
|
function getKeyFetchErrorName(error) {
|
|
395
401
|
return error.name || error.constructor.name || "Error";
|
|
@@ -647,7 +653,7 @@ async function verifyRequestDraft(request, span, metricsContext, { documentLoade
|
|
|
647
653
|
keyCache,
|
|
648
654
|
tracerProvider,
|
|
649
655
|
meterProvider,
|
|
650
|
-
|
|
656
|
+
portableKeyResolvers: createPortableKeyResolvers({
|
|
651
657
|
documentLoader,
|
|
652
658
|
contextLoader,
|
|
653
659
|
keyCache,
|
|
@@ -867,7 +873,7 @@ async function verifyRequestRfc9421(request, span, metricsContext, { documentLoa
|
|
|
867
873
|
keyCache,
|
|
868
874
|
tracerProvider,
|
|
869
875
|
meterProvider,
|
|
870
|
-
|
|
876
|
+
portableKeyResolvers: createPortableKeyResolvers({
|
|
871
877
|
documentLoader,
|
|
872
878
|
contextLoader,
|
|
873
879
|
keyCache,
|
|
@@ -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
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
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
|
-
|
|
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.
|
|
186
|
-
*
|
|
187
|
-
*
|
|
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.
|
|
208
|
-
*
|
|
209
|
-
*
|
|
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
|
*
|