@fedify/fedify 2.1.0-dev.503 → 2.1.0-dev.513
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-BHUnSQtB.js → builder-DSYM2n7q.js} +9 -3
- package/dist/compat/mod.d.cts +3 -3
- package/dist/compat/mod.d.ts +3 -3
- package/dist/compat/transformers.test.js +12 -12
- package/dist/{context-DZJhUmzF.d.ts → context--RwChtri.d.ts} +54 -2
- package/dist/{context-D3QkEtZd.d.cts → context-DL0cPpPV.d.cts} +54 -2
- package/dist/{deno-BYerLnry.js → deno-aj03PJW6.js} +1 -1
- package/dist/{docloader-MSkogD2T.js → docloader-tMQxWuTM.js} +2 -2
- package/dist/federation/builder.test.js +14 -3
- package/dist/federation/handler.test.js +97 -13
- package/dist/federation/idempotency.test.js +12 -12
- package/dist/federation/inbox.test.js +2 -2
- package/dist/federation/keycache.test.js +46 -2
- package/dist/federation/middleware.test.js +206 -12
- package/dist/federation/mod.cjs +4 -4
- package/dist/federation/mod.d.cts +4 -4
- package/dist/federation/mod.d.ts +4 -4
- package/dist/federation/mod.js +4 -4
- package/dist/federation/send.test.js +5 -5
- package/dist/federation/webfinger.test.js +12 -12
- package/dist/{http-DkHdFfrc.d.ts → http-BbfOqHGG.d.ts} +80 -8
- package/dist/{http-CSX1-Mgi.js → http-CoM8qFZV.js} +295 -101
- package/dist/{http-Cz3MlXAZ.d.cts → http-DsqqmkXi.d.cts} +80 -8
- package/dist/{http-DJT6NciB.cjs → http-_l2XRk4S.cjs} +305 -99
- package/dist/{http-S2U3qDwN.js → http-pa5yLKK7.js} +153 -57
- package/dist/{inbox-BaA0g5I_.js → inbox-EI2EtQri.js} +1 -1
- package/dist/{key-DCdTVZiK.js → key-j1AjF3HL.js} +145 -47
- package/dist/keycache-C7k8s1Bk.js +102 -0
- package/dist/{kv-cache-CQPL_aGY.js → kv-cache-CMk-kfWp.js} +1 -1
- package/dist/{kv-cache-Vtxhbo1W.cjs → kv-cache-D0IkOVYm.cjs} +1 -1
- package/dist/{ld-CrX7pQda.js → ld-CD48Tb3_.js} +2 -2
- package/dist/middleware-BQhgZunR.cjs +12 -0
- package/dist/{middleware-MlO5iUeZ.js → middleware-BRIM_AL5.js} +158 -22
- package/dist/{middleware-C8PKuPrm.js → middleware-CWMuqleA.js} +4 -4
- package/dist/{middleware-D4S6i4A_.cjs → middleware-D1Awtgcf.cjs} +158 -22
- package/dist/{middleware-BelSJK7m.js → middleware-DbmQ5-Ph.js} +100 -24
- package/dist/{middleware-CfI9C9Xy.js → middleware-b9jiK13s.js} +12 -12
- package/dist/{mod-CwZXZJ9d.d.ts → mod-BugwI0JN.d.ts} +1 -1
- package/dist/{mod-DPkRU3EK.d.cts → mod-CFBU2OT3.d.cts} +1 -1
- package/dist/{mod-DUWcVv49.d.ts → mod-CvxylbuV.d.ts} +1 -1
- package/dist/{mod-DVwHUI_x.d.cts → mod-DE8MYisy.d.cts} +1 -1
- package/dist/{mod-DXsQakeS.d.cts → mod-DKG0ovjR.d.cts} +1 -1
- package/dist/{mod-DnSsduJF.d.ts → mod-DcfFNgYf.d.ts} +1 -1
- package/dist/{mod-Di3W5OdP.d.cts → mod-Dp0kK0hO.d.cts} +1 -1
- package/dist/{mod-DosD6NsG.d.ts → mod-Z7lIaCfo.d.ts} +1 -1
- package/dist/mod.cjs +8 -4
- package/dist/mod.d.cts +8 -8
- package/dist/mod.d.ts +8 -8
- package/dist/mod.js +7 -5
- package/dist/nodeinfo/handler.test.js +12 -12
- package/dist/otel/exporter.test.js +43 -2
- package/dist/otel/mod.cjs +7 -1
- package/dist/otel/mod.d.cts +12 -0
- package/dist/otel/mod.d.ts +12 -0
- package/dist/otel/mod.js +7 -1
- package/dist/{owner-BAlnLKMO.js → owner-ZjRdCtVA.js} +1 -1
- package/dist/{proof-BgUVmaJz.js → proof-CQfh4S5r.js} +1 -1
- package/dist/{proof-CR5RUAmy.cjs → proof-D2auLGZD.cjs} +1 -1
- package/dist/{proof-DMgHaXNJ.js → proof-gmdzyEsv.js} +2 -2
- package/dist/{send-B2aZYf9A.js → send-1lNwij0f.js} +2 -2
- package/dist/sig/http.test.js +85 -5
- package/dist/sig/key.test.js +70 -3
- package/dist/sig/ld.test.js +3 -3
- package/dist/sig/mod.cjs +4 -2
- package/dist/sig/mod.d.cts +3 -3
- package/dist/sig/mod.d.ts +3 -3
- package/dist/sig/mod.js +3 -3
- package/dist/sig/owner.test.js +3 -3
- package/dist/sig/proof.test.js +3 -3
- package/dist/testing/mod.d.ts +92 -0
- package/dist/utils/docloader.test.js +4 -4
- package/dist/utils/mod.cjs +2 -2
- package/dist/utils/mod.d.cts +2 -2
- package/dist/utils/mod.d.ts +2 -2
- package/dist/utils/mod.js +2 -2
- package/package.json +5 -5
- package/dist/keycache-DRxpZ5r9.js +0 -48
- package/dist/middleware-D4XcpSBG.cjs +0 -12
|
@@ -70,6 +70,34 @@ interface FetchKeyResult<T extends CryptographicKey | Multikey> {
|
|
|
70
70
|
readonly cached: boolean;
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
|
+
* Detailed fetch failure information from {@link fetchKeyDetailed}.
|
|
74
|
+
* @since 2.1.0
|
|
75
|
+
*/
|
|
76
|
+
type FetchKeyErrorResult = {
|
|
77
|
+
readonly status: number;
|
|
78
|
+
readonly response: Response;
|
|
79
|
+
} | {
|
|
80
|
+
readonly error: Error;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* The result of {@link fetchKeyDetailed}.
|
|
84
|
+
* @since 2.1.0
|
|
85
|
+
*/
|
|
86
|
+
interface FetchKeyDetailedResult<T extends CryptographicKey | Multikey> extends FetchKeyResult<T> {
|
|
87
|
+
/**
|
|
88
|
+
* The error that occurred while fetching the key, if fetching failed before
|
|
89
|
+
* a document could be parsed.
|
|
90
|
+
*/
|
|
91
|
+
readonly fetchError?: FetchKeyErrorResult;
|
|
92
|
+
}
|
|
93
|
+
type FetchableKeyClass<T extends CryptographicKey | Multikey> = (new (...args: any[]) => T) & {
|
|
94
|
+
fromJsonLd(jsonLd: unknown, options: {
|
|
95
|
+
documentLoader?: DocumentLoader;
|
|
96
|
+
contextLoader?: DocumentLoader;
|
|
97
|
+
tracerProvider?: TracerProvider;
|
|
98
|
+
}): Promise<T>;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
73
101
|
* Fetches a {@link CryptographicKey} or {@link Multikey} from the given URL.
|
|
74
102
|
* If the given URL contains an {@link Actor} object, it tries to find
|
|
75
103
|
* the corresponding key in the `publicKey` or `assertionMethod` property.
|
|
@@ -82,13 +110,22 @@ interface FetchKeyResult<T extends CryptographicKey | Multikey> {
|
|
|
82
110
|
* @returns The fetched key or `null` if the key is not found.
|
|
83
111
|
* @since 1.3.0
|
|
84
112
|
*/
|
|
85
|
-
declare function fetchKey<T extends CryptographicKey | Multikey>(keyId: URL | string, cls:
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
113
|
+
declare function fetchKey<T extends CryptographicKey | Multikey>(keyId: URL | string, cls: FetchableKeyClass<T>, options?: FetchKeyOptions): Promise<FetchKeyResult<T>>;
|
|
114
|
+
/**
|
|
115
|
+
* Fetches a {@link CryptographicKey} or {@link Multikey} from the given URL,
|
|
116
|
+
* preserving transport-level fetch failures for callers that need to inspect
|
|
117
|
+
* why the key could not be loaded.
|
|
118
|
+
*
|
|
119
|
+
* @template T The type of the key to fetch. Either {@link CryptographicKey}
|
|
120
|
+
* or {@link Multikey}.
|
|
121
|
+
* @param keyId The URL of the key.
|
|
122
|
+
* @param cls The class of the key to fetch. Either {@link CryptographicKey}
|
|
123
|
+
* or {@link Multikey}.
|
|
124
|
+
* @param options Options for fetching the key.
|
|
125
|
+
* @returns The fetched key, or detailed fetch failure information.
|
|
126
|
+
* @since 2.1.0
|
|
127
|
+
*/
|
|
128
|
+
declare function fetchKeyDetailed<T extends CryptographicKey | Multikey>(keyId: URL | string, cls: FetchableKeyClass<T>, options?: FetchKeyOptions): Promise<FetchKeyDetailedResult<T>>;
|
|
92
129
|
/**
|
|
93
130
|
* A cache for storing cryptographic keys.
|
|
94
131
|
* @since 0.12.0
|
|
@@ -202,6 +239,31 @@ interface VerifyRequestOptions {
|
|
|
202
239
|
tracerProvider?: TracerProvider;
|
|
203
240
|
}
|
|
204
241
|
/**
|
|
242
|
+
* The reason why {@link verifyRequestDetailed} could not verify a request.
|
|
243
|
+
* @since 2.1.0
|
|
244
|
+
*/
|
|
245
|
+
type VerifyRequestFailureReason = {
|
|
246
|
+
readonly type: "keyFetchError";
|
|
247
|
+
readonly keyId: URL;
|
|
248
|
+
readonly result: FetchKeyErrorResult;
|
|
249
|
+
} | {
|
|
250
|
+
readonly type: "invalidSignature";
|
|
251
|
+
readonly keyId?: URL;
|
|
252
|
+
} | {
|
|
253
|
+
readonly type: "noSignature";
|
|
254
|
+
};
|
|
255
|
+
/**
|
|
256
|
+
* The detailed result of {@link verifyRequestDetailed}.
|
|
257
|
+
* @since 2.1.0
|
|
258
|
+
*/
|
|
259
|
+
type VerifyRequestDetailedResult = {
|
|
260
|
+
readonly verified: true;
|
|
261
|
+
readonly key: CryptographicKey;
|
|
262
|
+
} | {
|
|
263
|
+
readonly verified: false;
|
|
264
|
+
readonly reason: VerifyRequestFailureReason;
|
|
265
|
+
};
|
|
266
|
+
/**
|
|
205
267
|
* Verifies the signature of a request.
|
|
206
268
|
*
|
|
207
269
|
* Note that this function consumes the request body, so it should not be used
|
|
@@ -216,6 +278,16 @@ interface VerifyRequestOptions {
|
|
|
216
278
|
*/
|
|
217
279
|
declare function verifyRequest(request: Request, options?: VerifyRequestOptions): Promise<CryptographicKey | null>;
|
|
218
280
|
/**
|
|
281
|
+
* Verifies the signature of a request and returns a structured failure reason
|
|
282
|
+
* when verification does not succeed.
|
|
283
|
+
*
|
|
284
|
+
* @param request The request to verify.
|
|
285
|
+
* @param options Options for verifying the request.
|
|
286
|
+
* @returns The verified public key, or a structured verification failure.
|
|
287
|
+
* @since 2.1.0
|
|
288
|
+
*/
|
|
289
|
+
declare function verifyRequestDetailed(request: Request, options?: VerifyRequestOptions): Promise<VerifyRequestDetailedResult>;
|
|
290
|
+
/**
|
|
219
291
|
* A spec determiner for HTTP Message Signatures.
|
|
220
292
|
* It determines the spec to use for signing requests.
|
|
221
293
|
* It is used for double-knocking
|
|
@@ -241,4 +313,4 @@ interface HttpMessageSignaturesSpecDeterminer {
|
|
|
241
313
|
* @since 1.6.0
|
|
242
314
|
*/
|
|
243
315
|
//#endregion
|
|
244
|
-
export { FetchKeyOptions, FetchKeyResult, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, SignRequestOptions, VerifyRequestOptions, exportJwk, fetchKey, generateCryptoKeyPair, importJwk, signRequest, verifyRequest };
|
|
316
|
+
export { FetchKeyDetailedResult, FetchKeyErrorResult, FetchKeyOptions, FetchKeyResult, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, SignRequestOptions, VerifyRequestDetailedResult, VerifyRequestFailureReason, VerifyRequestOptions, exportJwk, fetchKey, fetchKeyDetailed, generateCryptoKeyPair, importJwk, signRequest, verifyRequest, verifyRequestDetailed };
|