@fedify/fedify 0.9.0-dev.174 → 0.9.0-dev.176
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of @fedify/fedify might be problematic. Click here for more details.
- package/CHANGES.md +17 -0
- package/esm/deps/jsr.io/@std/encoding/{0.224.1 → 0.224.2}/base64.js +3 -3
- package/esm/federation/collection.js +1 -1
- package/esm/federation/handler.js +6 -3
- package/esm/federation/middleware.js +49 -7
- package/esm/httpsig/mod.js +8 -9
- package/esm/runtime/key.js +1 -1
- package/esm/webfinger/handler.js +6 -2
- package/package.json +1 -1
- package/types/deps/jsr.io/@std/async/0.224.1/delay.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/encoding/{0.224.1 → 0.224.2}/_util.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/encoding/{0.224.1 → 0.224.2}/base64.d.ts +2 -2
- package/types/deps/jsr.io/@std/encoding/{0.224.1 → 0.224.2}/base64.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/encoding/{0.224.1 → 0.224.2}/hex.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/http/{0.224.0 → 0.224.1}/_negotiation/common.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/http/{0.224.0 → 0.224.1}/_negotiation/encoding.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/http/{0.224.0 → 0.224.1}/_negotiation/language.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/http/{0.224.0 → 0.224.1}/_negotiation/media_type.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/http/{0.224.0 → 0.224.1}/negotiation.d.ts.map +1 -1
- package/types/federation/context.d.ts +58 -0
- package/types/federation/context.d.ts.map +1 -1
- package/types/federation/handler.d.ts +3 -1
- package/types/federation/handler.d.ts.map +1 -1
- package/types/federation/middleware.d.ts +9 -1
- package/types/federation/middleware.d.ts.map +1 -1
- package/types/httpsig/mod.d.ts +29 -5
- package/types/httpsig/mod.d.ts.map +1 -1
- package/types/testing/context.d.ts.map +1 -1
- package/types/webfinger/handler.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/async/0.224.0/delay.d.ts.map +0 -1
- /package/esm/deps/jsr.io/@std/encoding/{0.224.1 → 0.224.2}/_util.js +0 -0
- /package/esm/deps/jsr.io/@std/encoding/{0.224.1 → 0.224.2}/hex.js +0 -0
- /package/esm/deps/jsr.io/@std/http/{0.224.0 → 0.224.1}/_negotiation/common.js +0 -0
- /package/esm/deps/jsr.io/@std/http/{0.224.0 → 0.224.1}/_negotiation/encoding.js +0 -0
- /package/esm/deps/jsr.io/@std/http/{0.224.0 → 0.224.1}/_negotiation/language.js +0 -0
- /package/esm/deps/jsr.io/@std/http/{0.224.0 → 0.224.1}/_negotiation/media_type.js +0 -0
- /package/esm/deps/jsr.io/@std/http/{0.224.0 → 0.224.1}/negotiation.js +0 -0
- /package/types/deps/jsr.io/@std/encoding/{0.224.1 → 0.224.2}/_util.d.ts +0 -0
- /package/types/deps/jsr.io/@std/encoding/{0.224.1 → 0.224.2}/hex.d.ts +0 -0
- /package/types/deps/jsr.io/@std/http/{0.224.0 → 0.224.1}/_negotiation/common.d.ts +0 -0
- /package/types/deps/jsr.io/@std/http/{0.224.0 → 0.224.1}/_negotiation/encoding.d.ts +0 -0
- /package/types/deps/jsr.io/@std/http/{0.224.0 → 0.224.1}/_negotiation/language.d.ts +0 -0
- /package/types/deps/jsr.io/@std/http/{0.224.0 → 0.224.1}/_negotiation/media_type.d.ts +0 -0
- /package/types/deps/jsr.io/@std/http/{0.224.0 → 0.224.1}/negotiation.d.ts +0 -0
package/CHANGES.md
CHANGED
@@ -29,6 +29,22 @@ To be released.
|
|
29
29
|
- Added `SendActivityOptions.excludeBaseUris` property.
|
30
30
|
- Added `ExtractInboxesParameters.excludeBaseUris` property.
|
31
31
|
|
32
|
+
- The `Context` now can parse URIs of objects, inboxes, and collections as
|
33
|
+
well as actors.
|
34
|
+
|
35
|
+
- Added `Context.parseUri()` method.
|
36
|
+
- Added `ParseUriResult` type.
|
37
|
+
- Deprecated `Context.getHandleFromActorUri()` method.
|
38
|
+
|
39
|
+
- The time window for signature verification is now configurable. [[#52]]
|
40
|
+
|
41
|
+
- The default time window for signature verification is now a minute (was
|
42
|
+
30 seconds).
|
43
|
+
- Added `signatureTimeWindow` option to `FederationParameters` interface.
|
44
|
+
- Added `VerifyOptions` interface.
|
45
|
+
- The signature of the `verify()` function is revamped; it now optionally
|
46
|
+
takes a `VerifyOptions` object as the second parameter.
|
47
|
+
|
32
48
|
- Added more log messages using the [LogTape] library. Currently the below
|
33
49
|
logger categories are used:
|
34
50
|
|
@@ -36,6 +52,7 @@ To be released.
|
|
36
52
|
- `["fedify", "federation", "http"]`
|
37
53
|
|
38
54
|
[#48]: https://github.com/dahlia/fedify/issues/48
|
55
|
+
[#52]: https://github.com/dahlia/fedify/issues/52
|
39
56
|
|
40
57
|
|
41
58
|
Version 0.8.0
|
@@ -2,7 +2,7 @@
|
|
2
2
|
// This module is browser compatible.
|
3
3
|
/**
|
4
4
|
* Utilities for
|
5
|
-
* {@link https://
|
5
|
+
* {@link https://www.rfc-editor.org/rfc/rfc4648.html#section-4 | base64}
|
6
6
|
* encoding and decoding.
|
7
7
|
*
|
8
8
|
* This module is browser compatible.
|
@@ -90,7 +90,7 @@ const base64abc = [
|
|
90
90
|
/**
|
91
91
|
* Converts data into a base64-encoded string.
|
92
92
|
*
|
93
|
-
* @see {@link https://
|
93
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc4648.html#section-4}
|
94
94
|
*
|
95
95
|
* @param data The data to encode.
|
96
96
|
* @returns The base64-encoded string.
|
@@ -135,7 +135,7 @@ export function encodeBase64(data) {
|
|
135
135
|
/**
|
136
136
|
* Decodes a base64-encoded string.
|
137
137
|
*
|
138
|
-
* @see {@link https://
|
138
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc4648.html#section-4}
|
139
139
|
*
|
140
140
|
* @param b64 The base64-encoded string to decode.
|
141
141
|
* @returns The decoded data.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as dntShim from "../_dnt.shims.js";
|
2
2
|
import { getLogger } from "@logtape/logtape";
|
3
|
-
import { accepts } from "../deps/jsr.io/@std/http/0.224.
|
3
|
+
import { accepts } from "../deps/jsr.io/@std/http/0.224.1/negotiation.js";
|
4
4
|
import { doesActorOwnKey, verify } from "../httpsig/mod.js";
|
5
5
|
import { Activity, Link, Object, OrderedCollection, OrderedCollectionPage, } from "../vocab/vocab.js";
|
6
6
|
export function acceptsJsonLd(request) {
|
@@ -162,7 +162,7 @@ function filterCollectionItems(items, collectionName, filterPredicate) {
|
|
162
162
|
}
|
163
163
|
return result;
|
164
164
|
}
|
165
|
-
export async function handleInbox(request, { handle, context, kv, kvPrefix, actorDispatcher, inboxListeners, inboxErrorHandler, onNotFound, }) {
|
165
|
+
export async function handleInbox(request, { handle, context, kv, kvPrefix, actorDispatcher, inboxListeners, inboxErrorHandler, onNotFound, signatureTimeWindow, }) {
|
166
166
|
const logger = getLogger(["fedify", "federation", "inbox"]);
|
167
167
|
if (actorDispatcher == null) {
|
168
168
|
logger.error("Actor dispatcher is not set.", { handle });
|
@@ -176,7 +176,10 @@ export async function handleInbox(request, { handle, context, kv, kvPrefix, acto
|
|
176
176
|
return await onNotFound(request);
|
177
177
|
}
|
178
178
|
}
|
179
|
-
const key = await verify(request,
|
179
|
+
const key = await verify(request, {
|
180
|
+
...context,
|
181
|
+
timeWindow: signatureTimeWindow,
|
182
|
+
});
|
180
183
|
if (key == null) {
|
181
184
|
logger.error("Failed to verify the request signature.", { handle });
|
182
185
|
const response = new Response("Failed to verify the request signature.", {
|
@@ -26,6 +26,7 @@ export class Federation {
|
|
26
26
|
#nodeInfoDispatcher;
|
27
27
|
#actorCallbacks;
|
28
28
|
#objectCallbacks;
|
29
|
+
#objectTypeIds;
|
29
30
|
#outboxCallbacks;
|
30
31
|
#followingCallbacks;
|
31
32
|
#followersCallbacks;
|
@@ -36,12 +37,13 @@ export class Federation {
|
|
36
37
|
#authenticatedDocumentLoaderFactory;
|
37
38
|
#treatHttps;
|
38
39
|
#onOutboxError;
|
40
|
+
#signatureTimeWindow;
|
39
41
|
#backoffSchedule;
|
40
42
|
/**
|
41
43
|
* Create a new {@link Federation} instance.
|
42
44
|
* @param parameters Parameters for initializing the instance.
|
43
45
|
*/
|
44
|
-
constructor({ kv, kvPrefixes, queue, documentLoader, contextLoader, authenticatedDocumentLoaderFactory, treatHttps, onOutboxError, backoffSchedule, }) {
|
46
|
+
constructor({ kv, kvPrefixes, queue, documentLoader, contextLoader, authenticatedDocumentLoaderFactory, treatHttps, onOutboxError, signatureTimeWindow, backoffSchedule, }) {
|
45
47
|
this.#kv = kv;
|
46
48
|
this.#kvPrefixes = {
|
47
49
|
...({
|
@@ -57,6 +59,7 @@ export class Federation {
|
|
57
59
|
this.#router.add("/.well-known/nodeinfo", "nodeInfoJrd");
|
58
60
|
this.#inboxListeners = new Map();
|
59
61
|
this.#objectCallbacks = {};
|
62
|
+
this.#objectTypeIds = {};
|
60
63
|
this.#documentLoader = documentLoader ?? kvCache({
|
61
64
|
loader: fetchDocumentLoader,
|
62
65
|
kv: kv,
|
@@ -68,6 +71,7 @@ export class Federation {
|
|
68
71
|
getAuthenticatedDocumentLoader;
|
69
72
|
this.#onOutboxError = onOutboxError;
|
70
73
|
this.#treatHttps = treatHttps ?? false;
|
74
|
+
this.#signatureTimeWindow = signatureTimeWindow ?? { minutes: 1 };
|
71
75
|
this.#backoffSchedule = backoffSchedule ?? [
|
72
76
|
3000,
|
73
77
|
15000,
|
@@ -240,13 +244,48 @@ export class Federation {
|
|
240
244
|
}
|
241
245
|
return new URL(path, url);
|
242
246
|
},
|
243
|
-
|
244
|
-
if (
|
247
|
+
parseUri: (uri) => {
|
248
|
+
if (uri.origin !== url.origin)
|
245
249
|
return null;
|
246
|
-
const route = this.#router.route(
|
247
|
-
if (route
|
250
|
+
const route = this.#router.route(uri.pathname);
|
251
|
+
if (route == null)
|
248
252
|
return null;
|
249
|
-
|
253
|
+
else if (route.name === "actor") {
|
254
|
+
return { type: "actor", handle: route.values.handle };
|
255
|
+
}
|
256
|
+
else if (route.name.startsWith("object:")) {
|
257
|
+
const typeId = route.name.replace(/^object:/, "");
|
258
|
+
return {
|
259
|
+
type: "object",
|
260
|
+
class: this.#objectTypeIds[typeId],
|
261
|
+
typeId: new URL(typeId),
|
262
|
+
values: route.values,
|
263
|
+
};
|
264
|
+
}
|
265
|
+
else if (route.name === "inbox") {
|
266
|
+
return { type: "inbox", handle: route.values.handle };
|
267
|
+
}
|
268
|
+
else if (route.name === "sharedInbox") {
|
269
|
+
return { type: "inbox" };
|
270
|
+
}
|
271
|
+
else if (route.name === "outbox") {
|
272
|
+
return { type: "outbox", handle: route.values.handle };
|
273
|
+
}
|
274
|
+
else if (route.name === "following") {
|
275
|
+
return { type: "following", handle: route.values.handle };
|
276
|
+
}
|
277
|
+
else if (route.name === "followers") {
|
278
|
+
return { type: "followers", handle: route.values.handle };
|
279
|
+
}
|
280
|
+
return null;
|
281
|
+
},
|
282
|
+
getHandleFromActorUri(actorUri) {
|
283
|
+
getLogger(["fedify", "federation"]).warn("Context.getHandleFromActorUri() is deprecated; " +
|
284
|
+
"use Context.parseUri() instead.");
|
285
|
+
const result = this.parseUri(actorUri);
|
286
|
+
if (result?.type === "actor")
|
287
|
+
return result.handle;
|
288
|
+
return null;
|
250
289
|
},
|
251
290
|
getActorKey: async (handle) => {
|
252
291
|
let keyPair = this.#actorCallbacks?.keyPairDispatcher?.(contextData, handle);
|
@@ -293,6 +332,7 @@ export class Federation {
|
|
293
332
|
return context;
|
294
333
|
let signedKey = undefined;
|
295
334
|
let signedKeyOwner = undefined;
|
335
|
+
const timeWindow = this.#signatureTimeWindow;
|
296
336
|
const reqCtx = {
|
297
337
|
...context,
|
298
338
|
request,
|
@@ -341,7 +381,7 @@ export class Federation {
|
|
341
381
|
async getSignedKey() {
|
342
382
|
if (signedKey !== undefined)
|
343
383
|
return signedKey;
|
344
|
-
return signedKey = await verify(request, context
|
384
|
+
return signedKey = await verify(request, { ...context, timeWindow });
|
345
385
|
},
|
346
386
|
async getSignedKeyOwner() {
|
347
387
|
if (signedKeyOwner !== undefined)
|
@@ -506,6 +546,7 @@ export class Federation {
|
|
506
546
|
parameters: variables,
|
507
547
|
};
|
508
548
|
this.#objectCallbacks[cls.typeId.href] = callbacks;
|
549
|
+
this.#objectTypeIds[cls.typeId.href] = cls;
|
509
550
|
const setters = {
|
510
551
|
authorize(predicate) {
|
511
552
|
callbacks.authorizePredicate = predicate;
|
@@ -939,6 +980,7 @@ export class Federation {
|
|
939
980
|
inboxListeners: this.#inboxListeners,
|
940
981
|
inboxErrorHandler: this.#inboxErrorHandler,
|
941
982
|
onNotFound,
|
983
|
+
signatureTimeWindow: this.#signatureTimeWindow,
|
942
984
|
});
|
943
985
|
case "following":
|
944
986
|
return await handleCollection(request, {
|
package/esm/httpsig/mod.js
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
import * as dntShim from "../_dnt.shims.js";
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
9
9
|
import { equals } from "../deps/jsr.io/@std/bytes/0.224.0/mod.js";
|
10
|
-
import { decodeBase64, encodeBase64 } from "../deps/jsr.io/@std/encoding/0.224.
|
10
|
+
import { decodeBase64, encodeBase64 } from "../deps/jsr.io/@std/encoding/0.224.2/base64.js";
|
11
11
|
import { fetchDocumentLoader, } from "../runtime/docloader.js";
|
12
12
|
import { isActor } from "../vocab/actor.js";
|
13
13
|
import { CryptographicKey, Object as ASObject, } from "../vocab/vocab.js";
|
@@ -67,15 +67,13 @@ const supportedHashAlgorithms = {
|
|
67
67
|
* if the request body is already consumed. Consuming the request body after
|
68
68
|
* calling this function is okay, since this function clones the request
|
69
69
|
* under the hood.
|
70
|
+
*
|
70
71
|
* @param request The request to verify.
|
71
|
-
* @param
|
72
|
-
* @param contextLoader The context loader to use for JSON-LD context retrieval.
|
73
|
-
* @param currentTime The current time. If not specified, the current time is
|
74
|
-
* used. This is useful for testing.
|
72
|
+
* @param options Options for verifying the request.
|
75
73
|
* @returns The public key of the verified signature, or `null` if the signature
|
76
74
|
* could not be verified.
|
77
75
|
*/
|
78
|
-
export async function verify(request, documentLoader, contextLoader, currentTime) {
|
76
|
+
export async function verify(request, { documentLoader, contextLoader, timeWindow, currentTime } = {}) {
|
79
77
|
const logger = getLogger(["fedify", "httpsig", "verify"]);
|
80
78
|
request = request.clone();
|
81
79
|
const dateHeader = request.headers.get("Date");
|
@@ -127,11 +125,12 @@ export async function verify(request, documentLoader, contextLoader, currentTime
|
|
127
125
|
}
|
128
126
|
const date = dntShim.Temporal.Instant.from(new Date(dateHeader).toISOString());
|
129
127
|
const now = currentTime ?? dntShim.Temporal.Now.instant();
|
130
|
-
|
128
|
+
const tw = timeWindow ?? { minutes: 1 };
|
129
|
+
if (dntShim.Temporal.Instant.compare(date, now.add(tw)) > 0) {
|
131
130
|
logger.debug("Failed to verify; Date is too far in the future.", { date: date.toString(), now: now.toString() });
|
132
131
|
return null;
|
133
132
|
}
|
134
|
-
else if (dntShim.Temporal.Instant.compare(date, now.subtract(
|
133
|
+
else if (dntShim.Temporal.Instant.compare(date, now.subtract(tw)) < 0) {
|
135
134
|
logger.debug("Failed to verify; Date is too far in the past.", { date: date.toString(), now: now.toString() });
|
136
135
|
return null;
|
137
136
|
}
|
@@ -152,7 +151,7 @@ export async function verify(request, documentLoader, contextLoader, currentTime
|
|
152
151
|
logger.debug("Fetching key {keyId} to verify signature...", { keyId });
|
153
152
|
let document;
|
154
153
|
try {
|
155
|
-
const remoteDocument = await documentLoader(keyId);
|
154
|
+
const remoteDocument = await (documentLoader ?? fetchDocumentLoader)(keyId);
|
156
155
|
document = remoteDocument.document;
|
157
156
|
}
|
158
157
|
catch (_) {
|
package/esm/runtime/key.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as dntShim from "../_dnt.shims.js";
|
2
|
-
import { decodeBase64, encodeBase64 } from "../deps/jsr.io/@std/encoding/0.224.
|
2
|
+
import { decodeBase64, encodeBase64 } from "../deps/jsr.io/@std/encoding/0.224.2/base64.js";
|
3
3
|
/**
|
4
4
|
* Imports a PEM-SPKI formatted public key.
|
5
5
|
* @param pem The PEM-SPKI formatted public key.
|
package/esm/webfinger/handler.js
CHANGED
@@ -25,8 +25,9 @@ export async function handleWebFinger(request, { context, actorDispatcher, onNot
|
|
25
25
|
}
|
26
26
|
throw new e();
|
27
27
|
}
|
28
|
-
let handle
|
29
|
-
|
28
|
+
let handle;
|
29
|
+
const uriParsed = context.parseUri(resourceUrl);
|
30
|
+
if (uriParsed?.type != "actor") {
|
30
31
|
const match = /^acct:([^@]+)@([^@]+)$/.exec(resource);
|
31
32
|
if (match == null || match[2] != context.url.host) {
|
32
33
|
const response = onNotFound(request);
|
@@ -34,6 +35,9 @@ export async function handleWebFinger(request, { context, actorDispatcher, onNot
|
|
34
35
|
}
|
35
36
|
handle = match[1];
|
36
37
|
}
|
38
|
+
else {
|
39
|
+
handle = uriParsed.handle;
|
40
|
+
}
|
37
41
|
const key = await context.getActorKey(handle);
|
38
42
|
const actor = await actorDispatcher(context, handle, key);
|
39
43
|
if (actor == null) {
|
package/package.json
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"delay.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/async/0.224.1/delay.ts"],"names":[],"mappings":";AAMA,MAAM,WAAW,YAAY;IAC3B,sCAAsC;IACtC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA0B3E"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"_util.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/encoding/0.224.
|
1
|
+
{"version":3,"file":"_util.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/encoding/0.224.2/_util.ts"],"names":[],"mappings":"AAeA,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,GAAG,UAAU,CAa9D"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* Converts data into a base64-encoded string.
|
3
3
|
*
|
4
|
-
* @see {@link https://
|
4
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc4648.html#section-4}
|
5
5
|
*
|
6
6
|
* @param data The data to encode.
|
7
7
|
* @returns The base64-encoded string.
|
@@ -17,7 +17,7 @@ export declare function encodeBase64(data: ArrayBuffer | Uint8Array | string): s
|
|
17
17
|
/**
|
18
18
|
* Decodes a base64-encoded string.
|
19
19
|
*
|
20
|
-
* @see {@link https://
|
20
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc4648.html#section-4}
|
21
21
|
*
|
22
22
|
* @param b64 The base64-encoded string to decode.
|
23
23
|
* @returns The decoded data.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/encoding/0.224.
|
1
|
+
{"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/encoding/0.224.2/base64.ts"],"names":[],"mappings":"AA6FA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAmC5E;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAQpD"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"hex.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/encoding/0.224.
|
1
|
+
{"version":3,"file":"hex.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/encoding/0.224.2/hex.ts"],"names":[],"mappings":"AAoDA;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,MAAM,CAUxE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAiBjD"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/http/0.224.
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/http/0.224.1/_negotiation/common.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,MAAM,WAAW,WAAW;IAC1B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,CAAC,EAAE,MAAM,CAAC;CACZ;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,WAAW,GAAG,MAAM,CAQnE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAEpD"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/http/0.224.
|
1
|
+
{"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/http/0.224.1/_negotiation/encoding.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AA4GH;;qCAEqC;AACrC,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,MAAM,EAAE,GAClB,MAAM,EAAE,CAkBV"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"language.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/http/0.224.
|
1
|
+
{"version":3,"file":"language.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/http/0.224.1/_negotiation/language.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAkGH,wBAAgB,kBAAkB,CAChC,MAAM,SAAM,EACZ,QAAQ,CAAC,EAAE,MAAM,EAAE,GAClB,MAAM,EAAE,CAiBV"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"media_type.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/http/0.224.
|
1
|
+
{"version":3,"file":"media_type.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/http/0.224.1/_negotiation/media_type.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAiJH,wBAAgB,mBAAmB,CACjC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,EACtB,QAAQ,CAAC,EAAE,MAAM,EAAE,GAClB,MAAM,EAAE,CAkBV"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"negotiation.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/http/0.224.
|
1
|
+
{"version":3,"file":"negotiation.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/http/0.224.1/negotiation.ts"],"names":[],"mappings":"AAcA,yCAAyC;AACzC,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,EAAE;QACP,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;KACjC,CAAC;CACH,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,CAAC;AACpD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,OAAO,CACrB,OAAO,EAAE,OAAO,EAChB,GAAG,KAAK,EAAE,MAAM,EAAE,GACjB,MAAM,GAAG,SAAS,CAAC;AAatB;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,CAAC;AAC7D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,OAAO,EAChB,GAAG,SAAS,EAAE,MAAM,EAAE,GACrB,MAAM,GAAG,SAAS,CAAC;AAetB;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,CAAC;AAC7D;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,OAAO,EAChB,GAAG,KAAK,EAAE,MAAM,EAAE,GACjB,MAAM,GAAG,SAAS,CAAC"}
|
@@ -80,10 +80,17 @@ export interface Context<TContextData> {
|
|
80
80
|
* @throws {RouterError} If no followers collection is available.
|
81
81
|
*/
|
82
82
|
getFollowersUri(handle: string): URL;
|
83
|
+
/**
|
84
|
+
* Determines the type of the URI and extracts the associated data.
|
85
|
+
* @param uri The URI to parse.
|
86
|
+
* @since 0.9.0
|
87
|
+
*/
|
88
|
+
parseUri(uri: URL): ParseUriResult | null;
|
83
89
|
/**
|
84
90
|
* Extracts the actor's handle from an actor URI, if it is a valid actor URI.
|
85
91
|
* @param actorUri The actor's URI.
|
86
92
|
* @returns The actor's handle, or `null` if the URI is not a valid actor URI.
|
93
|
+
* @deprecated Use {@link parseUri} instead.
|
87
94
|
*/
|
88
95
|
getHandleFromActorUri(actorUri: URL): string | null;
|
89
96
|
/**
|
@@ -220,6 +227,57 @@ export interface RequestContext<TContextData> extends Context<TContextData> {
|
|
220
227
|
handle: string;
|
221
228
|
}, recipients: "followers", activity: Activity, options?: SendActivityOptions): Promise<void>;
|
222
229
|
}
|
230
|
+
/**
|
231
|
+
* A result of parsing an URI.
|
232
|
+
*/
|
233
|
+
export type ParseUriResult =
|
234
|
+
/**
|
235
|
+
* The case of an actor URI.
|
236
|
+
*/
|
237
|
+
{
|
238
|
+
type: "actor";
|
239
|
+
handle: string;
|
240
|
+
}
|
241
|
+
/**
|
242
|
+
* The case of an object URI.
|
243
|
+
*/
|
244
|
+
| {
|
245
|
+
type: "object";
|
246
|
+
class: (new (...args: any[]) => Object) & {
|
247
|
+
typeId: URL;
|
248
|
+
};
|
249
|
+
typeId: URL;
|
250
|
+
values: Record<string, string>;
|
251
|
+
}
|
252
|
+
/**
|
253
|
+
* The case of an inbox URI. If `handle` is `undefined`,
|
254
|
+
* it is a shared inbox.
|
255
|
+
*/
|
256
|
+
| {
|
257
|
+
type: "inbox";
|
258
|
+
handle?: string;
|
259
|
+
}
|
260
|
+
/**
|
261
|
+
* The case of an outbox collection URI.
|
262
|
+
*/
|
263
|
+
| {
|
264
|
+
type: "outbox";
|
265
|
+
handle: string;
|
266
|
+
}
|
267
|
+
/**
|
268
|
+
* The case of a following collection URI.
|
269
|
+
*/
|
270
|
+
| {
|
271
|
+
type: "following";
|
272
|
+
handle: string;
|
273
|
+
}
|
274
|
+
/**
|
275
|
+
* The case of a followers collection URI.
|
276
|
+
*/
|
277
|
+
| {
|
278
|
+
type: "followers";
|
279
|
+
handle: string;
|
280
|
+
};
|
223
281
|
/**
|
224
282
|
* Options for {@link Context.sendActivity} method and
|
225
283
|
* {@link Federation.sendActivity} method.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/federation/context.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE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;;;;OAMG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,GAAG,EAAE,CAAC;CACzB"}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
/// <reference types="node" />
|
3
|
+
import * as dntShim from "../_dnt.shims.js";
|
3
4
|
import type { DocumentLoader } from "../runtime/docloader.js";
|
4
5
|
import type { Recipient } from "../vocab/actor.js";
|
5
6
|
import { Activity, Link, Object } from "../vocab/vocab.js";
|
@@ -73,8 +74,9 @@ export interface InboxHandlerParameters<TContextData> {
|
|
73
74
|
inboxListeners: Map<new (...args: unknown[]) => Activity, InboxListener<TContextData, Activity>>;
|
74
75
|
inboxErrorHandler?: InboxErrorHandler<TContextData>;
|
75
76
|
onNotFound(request: Request): Response | Promise<Response>;
|
77
|
+
signatureTimeWindow: dntShim.Temporal.DurationLike;
|
76
78
|
}
|
77
|
-
export declare function handleInbox<TContextData>(request: Request, { handle, context, kv, kvPrefix, actorDispatcher, inboxListeners, inboxErrorHandler, onNotFound, }: InboxHandlerParameters<TContextData>): Promise<Response>;
|
79
|
+
export declare function handleInbox<TContextData>(request: Request, { handle, context, kv, kvPrefix, actorDispatcher, inboxListeners, inboxErrorHandler, onNotFound, signatureTimeWindow, }: InboxHandlerParameters<TContextData>): Promise<Response>;
|
78
80
|
/**
|
79
81
|
* Options for the {@link respondWithObject} and
|
80
82
|
* {@link respondWithObjectIfAcceptable} functions.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/federation/handler.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/federation/handler.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAI5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,SA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AAI,EAAE,OAAO,EAAE,KAAK,QAAQ,EACpC,aAAa,CAAC,YAAY,EAAE,QAAQ,CAAC,CACtC,CAAC;IACF,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC;IACpD,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3D,mBAAmB,EAAE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;CACpD;AAED,wBAAsB,WAAW,CAAC,YAAY,EAC5C,OAAO,EAAE,OAAO,EAChB,EACE,MAAM,EACN,OAAO,EACP,EAAE,EACF,QAAQ,EACR,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,UAAU,EACV,mBAAmB,GACpB,EAAE,sBAAsB,CAAC,YAAY,CAAC,GACtC,OAAO,CAAC,QAAQ,CAAC,CAgInB;AAED;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,aAAa,EAAE,cAAc,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,QAAQ,CAAC,CAOnB;AAED;;;;;;;;GAQG;AACH,wBAAsB,6BAA6B,CACjD,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAK1B"}
|
@@ -63,6 +63,14 @@ export interface FederationParameters {
|
|
63
63
|
* @since 0.6.0
|
64
64
|
*/
|
65
65
|
onOutboxError?: OutboxErrorHandler;
|
66
|
+
/**
|
67
|
+
* The time window for verifying the signature of incoming requests. If the
|
68
|
+
* request is older or newer than this window, it is rejected. By default,
|
69
|
+
* the window is a minute.
|
70
|
+
*
|
71
|
+
* @since 0.9.0
|
72
|
+
*/
|
73
|
+
signatureTimeWindow?: dntShim.Temporal.DurationLike;
|
66
74
|
backoffSchedule?: dntShim.Temporal.Duration[];
|
67
75
|
}
|
68
76
|
/**
|
@@ -93,7 +101,7 @@ export declare class Federation<TContextData> {
|
|
93
101
|
* Create a new {@link Federation} instance.
|
94
102
|
* @param parameters Parameters for initializing the instance.
|
95
103
|
*/
|
96
|
-
constructor({ kv, kvPrefixes, queue, documentLoader, contextLoader, authenticatedDocumentLoaderFactory, treatHttps, onOutboxError, backoffSchedule, }: FederationParameters);
|
104
|
+
constructor({ kv, kvPrefixes, queue, documentLoader, contextLoader, authenticatedDocumentLoaderFactory, treatHttps, onOutboxError, signatureTimeWindow, backoffSchedule, }: FederationParameters);
|
97
105
|
/**
|
98
106
|
* Create a new context.
|
99
107
|
* @param baseUrl The base URL of the server. The `pathname` remains root,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/federation/middleware.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAK5C,OAAO,EACL,KAAK,kCAAkC,EACvC,KAAK,cAAc,EAIpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAoB,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE1E,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EACV,OAAO,
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/federation/middleware.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAK5C,OAAO,EACL,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YAAY,EAAE,OAAO,CAAC,CAAC;IAEpD;;;;OAIG;IACH,cAAc,CACZ,MAAM,EAAE,gBAAgB,CAAC,YAAY,EAAE,OAAO,CAAC,GAC9C,yBAAyB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAEpD;;;;OAIG;IACH,aAAa,CACX,MAAM,EAAE,gBAAgB,CAAC,YAAY,EAAE,OAAO,CAAC,GAC9C,yBAAyB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAEpD;;;;;OAKG;IACH,SAAS,CACP,SAAS,EAAE,kBAAkB,CAAC,YAAY,CAAC,GAC1C,yBAAyB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;CACrD;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB,CAAC,YAAY;IAC/C;;;;;;OAMG;IACH,EAAE,CAAC,SAAS,SAAS,QAAQ,EAE3B,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,SAAS,EACvC,QAAQ,EAAE,aAAa,CAAC,YAAY,EAAE,SAAS,CAAC,GAC/C,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAErC;;;;;;OAMG;IACH,OAAO,CACL,OAAO,EAAE,iBAAiB,CAAC,YAAY,CAAC,GACvC,mBAAmB,CAAC,YAAY,CAAC,CAAC;CACtC;AAED,UAAU,2BAA4B,SAAQ,mBAAmB;IAC/D,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB"}
|
package/types/httpsig/mod.d.ts
CHANGED
@@ -21,6 +21,32 @@ export { exportJwk, generateCryptoKeyPair, importJwk } from "./key.js";
|
|
21
21
|
* @throws {TypeError} If the private key is invalid or unsupported.
|
22
22
|
*/
|
23
23
|
export declare function sign(request: Request, privateKey: dntShim.CryptoKey, keyId: URL): Promise<Request>;
|
24
|
+
/**
|
25
|
+
* Options for {@link verify}.
|
26
|
+
*
|
27
|
+
* @since 0.9.0
|
28
|
+
*/
|
29
|
+
export interface VerifyOptions {
|
30
|
+
/**
|
31
|
+
* The document loader to use for fetching the public key.
|
32
|
+
*/
|
33
|
+
documentLoader?: DocumentLoader;
|
34
|
+
/**
|
35
|
+
* The context loader to use for JSON-LD context retrieval.
|
36
|
+
*/
|
37
|
+
contextLoader?: DocumentLoader;
|
38
|
+
/**
|
39
|
+
* The time window to allow for the request date. The actual time window is
|
40
|
+
* twice the value of this option, with the current time as the center.
|
41
|
+
* A minute by default.
|
42
|
+
*/
|
43
|
+
timeWindow?: dntShim.Temporal.DurationLike;
|
44
|
+
/**
|
45
|
+
* The current time. If not specified, the current time is used. This is
|
46
|
+
* useful for testing.
|
47
|
+
*/
|
48
|
+
currentTime?: dntShim.Temporal.Instant;
|
49
|
+
}
|
24
50
|
/**
|
25
51
|
* Verifies the signature of a request.
|
26
52
|
*
|
@@ -28,15 +54,13 @@ export declare function sign(request: Request, privateKey: dntShim.CryptoKey, ke
|
|
28
54
|
* if the request body is already consumed. Consuming the request body after
|
29
55
|
* calling this function is okay, since this function clones the request
|
30
56
|
* under the hood.
|
57
|
+
*
|
31
58
|
* @param request The request to verify.
|
32
|
-
* @param
|
33
|
-
* @param contextLoader The context loader to use for JSON-LD context retrieval.
|
34
|
-
* @param currentTime The current time. If not specified, the current time is
|
35
|
-
* used. This is useful for testing.
|
59
|
+
* @param options Options for verifying the request.
|
36
60
|
* @returns The public key of the verified signature, or `null` if the signature
|
37
61
|
* could not be verified.
|
38
62
|
*/
|
39
|
-
export declare function verify(request: Request, documentLoader
|
63
|
+
export declare function verify(request: Request, { documentLoader, contextLoader, timeWindow, currentTime }?: VerifyOptions): Promise<CryptographicKey | null>;
|
40
64
|
/**
|
41
65
|
* Options for {@link doesActorOwnKey}.
|
42
66
|
* @since 0.8.0
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/httpsig/mod.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAK5C,OAAO,EACL,K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,CAAC,QAAQ,CAAC,OAAO,CAAC;CACxC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,MAAM,CAC1B,OAAO,EAAE,OAAO,EAChB,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,GAAE,aACxD,GACH,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CA+NlC;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAEhC;;OAEG;IACH,aAAa,CAAC,EAAE,cAAc,CAAC;CAChC;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,gBAAgB,EACrB,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,OAAO,CAAC,CAUlB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAEhC;;OAEG;IACH,aAAa,CAAC,EAAE,cAAc,CAAC;CAChC;AAED;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAC/B,KAAK,EAAE,GAAG,GAAG,gBAAgB,EAC7B,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,CAgDvB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/testing/context.ts"],"names":[],"mappings":";
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/testing/context.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAIxE,wBAAgB,aAAa,CAAC,YAAY,EACxC,EACE,IAAI,EACJ,cAAc,EACd,aAAa,EACb,cAAc,EACd,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,eAAe,EACf,eAAe,EACf,QAAQ,EACR,WAAW,EACX,iBAAiB,EACjB,YAAY,GACb,EAAE,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,GAAG;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,GACzD,OAAO,CAAC,YAAY,CAAC,CAqCvB;AAED,wBAAgB,oBAAoB,CAAC,YAAY,EAC/C,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,GAAG;IAC5C,GAAG,EAAE,GAAG,CAAC;IACT,IAAI,EAAE,YAAY,CAAC;CACpB,GACA,cAAc,CAAC,YAAY,CAAC,CAa9B"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/webfinger/handler.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAI/D;;GAEG;AACH,MAAM,WAAW,0BAA0B,CAAC,YAAY;IACtD;;OAEG;IACH,OAAO,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC;IAEtC;;OAEG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC;IAEhD;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC5D;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,YAAY,EAChD,OAAO,EAAE,OAAO,EAChB,EACE,OAAO,EACP,eAAe,EACf,UAAU,GACX,EAAE,0BAA0B,CAAC,YAAY,CAAC,GAC1C,OAAO,CAAC,QAAQ,CAAC,
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/webfinger/handler.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAI/D;;GAEG;AACH,MAAM,WAAW,0BAA0B,CAAC,YAAY;IACtD;;OAEG;IACH,OAAO,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC;IAEtC;;OAEG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC;IAEhD;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC5D;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,YAAY,EAChD,OAAO,EAAE,OAAO,EAChB,EACE,OAAO,EACP,eAAe,EACf,UAAU,GACX,EAAE,0BAA0B,CAAC,YAAY,CAAC,GAC1C,OAAO,CAAC,QAAQ,CAAC,CAoEnB"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"delay.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/async/0.224.0/delay.ts"],"names":[],"mappings":";AAMA,MAAM,WAAW,YAAY;IAC3B,sCAAsC;IACtC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA0B3E"}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|