@fedify/vocab-runtime 2.4.0-dev.1567 → 2.4.0-dev.1570

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 (48) hide show
  1. package/deno.json +1 -2
  2. package/dist/mod.cjs +190 -178
  3. package/dist/mod.d.cts +190 -59
  4. package/dist/mod.d.ts +190 -59
  5. package/dist/mod.js +184 -165
  6. package/dist/tests/decimal.test.cjs +3 -3
  7. package/dist/tests/decimal.test.mjs +3 -3
  8. package/dist/tests/{docloader-D61oV0K1.mjs → docloader-C76ldE5C.mjs} +10 -97
  9. package/dist/tests/{docloader-BcaQHb0Q.cjs → docloader-mvgIWKI7.cjs} +9 -102
  10. package/dist/tests/docloader.test.cjs +6 -58
  11. package/dist/tests/docloader.test.mjs +6 -58
  12. package/dist/tests/{key-CDGDH_vC.mjs → key-CrrK9mYh.mjs} +1 -69
  13. package/dist/tests/{key-_wXwomh_.cjs → key-pMmqUKuo.cjs} +0 -86
  14. package/dist/tests/key.test.cjs +1 -48
  15. package/dist/tests/key.test.mjs +1 -48
  16. package/dist/tests/{request-Cn0vP7Hj.mjs → request-BEXkv1ul.mjs} +1 -1
  17. package/dist/tests/{request-DnNWah97.cjs → request-SworbvLc.cjs} +1 -1
  18. package/dist/tests/request.test.cjs +1 -1
  19. package/dist/tests/request.test.mjs +1 -1
  20. package/dist/tests/{url-2XwVbUS_.cjs → url-C20FhC7p.cjs} +0 -108
  21. package/dist/tests/{url-YWJbnRlf.mjs → url-m9Qzxy-Y.mjs} +1 -85
  22. package/dist/tests/url.test.cjs +1 -104
  23. package/dist/tests/url.test.mjs +2 -105
  24. package/package.json +1 -11
  25. package/src/contexts.ts +0 -2
  26. package/src/docloader.test.ts +6 -102
  27. package/src/docloader.ts +8 -76
  28. package/src/key.test.ts +0 -86
  29. package/src/key.ts +0 -125
  30. package/src/mod.ts +0 -8
  31. package/src/url.test.ts +1 -252
  32. package/src/url.ts +0 -141
  33. package/tsdown.config.ts +1 -6
  34. package/dist/docloader-DnUMWHaJ.d.cts +0 -202
  35. package/dist/docloader-xRGn1azD.d.ts +0 -202
  36. package/dist/internal/jsonld-cache.cjs +0 -279
  37. package/dist/internal/jsonld-cache.d.cts +0 -48
  38. package/dist/internal/jsonld-cache.d.ts +0 -48
  39. package/dist/internal/jsonld-cache.js +0 -275
  40. package/dist/tests/jsonld-cache.test.cjs +0 -652
  41. package/dist/tests/jsonld-cache.test.d.cts +0 -1
  42. package/dist/tests/jsonld-cache.test.d.mts +0 -1
  43. package/dist/tests/jsonld-cache.test.mjs +0 -651
  44. package/dist/url-BAdyyqAa.cjs +0 -315
  45. package/dist/url-BuxPHxK2.js +0 -261
  46. package/src/contexts/fep-7aa9.json +0 -24
  47. package/src/internal/jsonld-cache.ts +0 -538
  48. package/src/jsonld-cache.test.ts +0 -554
package/dist/mod.d.cts CHANGED
@@ -1,35 +1,210 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { a as DocumentLoaderOptions, c as getDocumentLoader, d as FetchError, f as GetUserAgentOptions, h as logRequest, i as DocumentLoaderFactoryOptions, l as getRemoteDocument, m as getUserAgent, n as DocumentLoader, o as GetDocumentLoaderOptions, p as createActivityPubRequest, r as DocumentLoaderFactory, s as RemoteDocument, t as AuthenticatedDocumentLoaderFactory, u as CreateRequestOptions } from "./docloader-DnUMWHaJ.cjs";
2
+ import { Logger } from "@logtape/logtape";
3
3
  import { TracerProvider } from "@opentelemetry/api";
4
4
 
5
5
  //#region src/contexts.d.ts
6
6
  declare const preloadedContexts: Record<string, unknown>;
7
7
  //#endregion
8
- //#region src/key.d.ts
8
+ //#region src/request.d.ts
9
9
  /**
10
- * Parsed `did:key` verification method.
11
- *
12
- * @since 2.4.0
10
+ * Error thrown when fetching a JSON-LD document failed.
13
11
  */
14
- interface DidKeyVerificationMethod {
12
+ declare class FetchError extends Error {
15
13
  /**
16
- * The DID URL identifying the verification method.
14
+ * The URL that failed to fetch.
17
15
  */
18
- readonly id: URL;
16
+ url: URL;
19
17
  /**
20
- * The controller DID.
18
+ * The HTTP response that failed, if available.
21
19
  */
22
- readonly controller: URL;
20
+ response?: Response;
21
+ /**
22
+ * Constructs a new `FetchError`.
23
+ *
24
+ * @param url The URL that failed to fetch.
25
+ * @param message Error message.
26
+ * @param response The failed HTTP response, if available.
27
+ */
28
+ constructor(url: URL | string, message?: string, response?: Response);
29
+ }
30
+ /**
31
+ * Options for creating a request.
32
+ * @internal
33
+ */
34
+ interface CreateRequestOptions {
35
+ userAgent?: GetUserAgentOptions | string;
36
+ }
37
+ /**
38
+ * Creates a request for the given URL.
39
+ * @param url The URL to create the request for.
40
+ * @param options The options for the request.
41
+ * @returns The created request.
42
+ * @internal
43
+ */
44
+ declare function createActivityPubRequest(url: string, options?: CreateRequestOptions): Request;
45
+ /**
46
+ * Options for making `User-Agent` string.
47
+ * @see {@link getUserAgent}
48
+ * @since 1.3.0
49
+ */
50
+ interface GetUserAgentOptions {
23
51
  /**
24
- * The Ed25519 public key encoded as a Multibase Multikey value.
52
+ * An optional software name and version, e.g., `"Hollo/1.0.0"`.
25
53
  */
26
- readonly publicKeyMultibase: string;
54
+ software?: string | null;
27
55
  /**
28
- * The Ed25519 public key.
56
+ * An optional URL to append to the user agent string.
57
+ * Usually the URL of the ActivityPub instance.
29
58
  */
30
- readonly publicKey: CryptoKey;
59
+ url?: string | URL | null;
31
60
  }
32
61
  /**
62
+ * Gets the user agent string for the given application and URL.
63
+ * @param options The options for making the user agent string.
64
+ * @returns The user agent string.
65
+ * @since 1.3.0
66
+ */
67
+ declare function getUserAgent({
68
+ software,
69
+ url
70
+ }?: GetUserAgentOptions): string;
71
+ /**
72
+ * Logs the request.
73
+ * @param request The request to log.
74
+ * @internal
75
+ */
76
+ declare function logRequest(logger: Logger, request: Request): void;
77
+ //#endregion
78
+ //#region src/docloader.d.ts
79
+ /**
80
+ * A remote JSON-LD document and its context fetched by
81
+ * a {@link DocumentLoader}.
82
+ */
83
+ interface RemoteDocument {
84
+ /**
85
+ * The URL of the context document.
86
+ */
87
+ contextUrl: string | null;
88
+ /**
89
+ * The fetched JSON-LD document.
90
+ */
91
+ document: unknown;
92
+ /**
93
+ * The URL of the fetched document.
94
+ */
95
+ documentUrl: string;
96
+ }
97
+ /**
98
+ * Options for {@link DocumentLoader}.
99
+ * @since 1.8.0
100
+ */
101
+ interface DocumentLoaderOptions {
102
+ /**
103
+ * An `AbortSignal` for cancellation.
104
+ * @since 1.8.0
105
+ */
106
+ signal?: AbortSignal;
107
+ }
108
+ /**
109
+ * A JSON-LD document loader that fetches documents from the Web.
110
+ * @param url The URL of the document to load.
111
+ * @param options The options for the document loader.
112
+ * @returns The loaded remote document.
113
+ */
114
+ type DocumentLoader = (url: string, options?: DocumentLoaderOptions) => Promise<RemoteDocument>;
115
+ /**
116
+ * A factory function that creates a {@link DocumentLoader} with options.
117
+ * @param options The options for the document loader.
118
+ * @returns The document loader.
119
+ * @since 1.4.0
120
+ */
121
+ type DocumentLoaderFactory = (options?: DocumentLoaderFactoryOptions) => DocumentLoader;
122
+ /**
123
+ * Options for {@link DocumentLoaderFactory}.
124
+ * @see {@link DocumentLoaderFactory}
125
+ * @see {@link AuthenticatedDocumentLoaderFactory}
126
+ * @since 1.4.0
127
+ */
128
+ interface DocumentLoaderFactoryOptions {
129
+ /**
130
+ * Whether to allow fetching private network addresses.
131
+ * Turned off by default.
132
+ * @default `false``
133
+ */
134
+ allowPrivateAddress?: boolean;
135
+ /**
136
+ * Options for making `User-Agent` string.
137
+ * If a string is given, it is used as the `User-Agent` header value.
138
+ * If an object is given, it is passed to {@link getUserAgent} function.
139
+ */
140
+ userAgent?: GetUserAgentOptions | string;
141
+ /**
142
+ * The maximum number of redirections to follow.
143
+ * @default `20`
144
+ * @since 2.2.0
145
+ */
146
+ maxRedirection?: number;
147
+ }
148
+ /**
149
+ * A factory function that creates an authenticated {@link DocumentLoader} for
150
+ * a given identity. This is used for fetching documents that require
151
+ * authentication.
152
+ * @param identity The identity to create the document loader for.
153
+ * The actor's key pair.
154
+ * @param options The options for the document loader.
155
+ * @returns The authenticated document loader.
156
+ * @since 0.4.0
157
+ */
158
+ type AuthenticatedDocumentLoaderFactory = (identity: {
159
+ keyId: URL;
160
+ privateKey: CryptoKey;
161
+ }, options?: DocumentLoaderFactoryOptions) => DocumentLoader;
162
+ /**
163
+ * Gets a {@link RemoteDocument} from the given response.
164
+ * @param url The URL of the document to load.
165
+ * @param response The response to get the document from.
166
+ * @param fetch The function to fetch the document.
167
+ * @returns The loaded remote document.
168
+ * @throws {FetchError} If the response is not OK.
169
+ * @internal
170
+ */
171
+ declare function getRemoteDocument(url: string, response: Response, fetch: (url: string, options?: DocumentLoaderOptions) => Promise<RemoteDocument>): Promise<RemoteDocument>;
172
+ /**
173
+ * Options for {@link getDocumentLoader}.
174
+ * @since 1.3.0
175
+ */
176
+ interface GetDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
177
+ /**
178
+ * Whether to preload the frequently used contexts.
179
+ */
180
+ skipPreloadedContexts?: boolean;
181
+ }
182
+ /**
183
+ * Creates a JSON-LD document loader that utilizes the browser's `fetch` API.
184
+ *
185
+ * The created loader preloads the below frequently used contexts by default
186
+ * (unless `options.skipPreloadedContexts` is set to `true`):
187
+ *
188
+ * - <https://www.w3.org/ns/activitystreams>
189
+ * - <https://w3id.org/security/v1>
190
+ * - <https://w3id.org/security/data-integrity/v1>
191
+ * - <https://www.w3.org/ns/did/v1>
192
+ * - <https://w3id.org/security/multikey/v1>
193
+ * - <https://purl.archive.org/socialweb/webfinger>
194
+ * - <http://schema.org/>
195
+ * @param options Options for the document loader.
196
+ * @returns The document loader.
197
+ * @since 1.3.0
198
+ */
199
+ declare function getDocumentLoader({
200
+ allowPrivateAddress,
201
+ maxRedirection,
202
+ skipPreloadedContexts,
203
+ userAgent
204
+ }?: GetDocumentLoaderOptions): DocumentLoader;
205
+ //#endregion
206
+ //#region src/key.d.ts
207
+ /**
33
208
  * Imports a PEM-SPKI formatted public key.
34
209
  * @param pem The PEM-SPKI formatted public key.
35
210
  * @returns The imported public key.
@@ -62,34 +237,6 @@ declare function importPkcs1(pem: string): Promise<CryptoKey>;
62
237
  */
63
238
  declare function importPem(pem: string): Promise<CryptoKey>;
64
239
  /**
65
- * Imports an Ed25519 `did:key` DID.
66
- *
67
- * @param did The `did:key` DID.
68
- * @returns The imported Ed25519 public key.
69
- * @throws {TypeError} If the DID is malformed or uses an unsupported key type.
70
- * @since 2.4.0
71
- */
72
- declare function importDidKey(did: string | URL): Promise<CryptoKey>;
73
- /**
74
- * Exports an Ed25519 public key as a `did:key` DID.
75
- *
76
- * @param key The Ed25519 public key.
77
- * @returns The `did:key` DID.
78
- * @throws {TypeError} If the key is invalid or unsupported.
79
- * @since 2.4.0
80
- */
81
- declare function exportDidKey(key: CryptoKey): Promise<string>;
82
- /**
83
- * Parses an Ed25519 `did:key` verification method DID URL.
84
- *
85
- * @param didUrl The `did:key` DID URL.
86
- * @returns The parsed verification method.
87
- * @throws {TypeError} If the DID URL is malformed, unsupported, or its
88
- * fragment does not identify the same key as the DID.
89
- * @since 2.4.0
90
- */
91
- declare function parseDidKeyVerificationMethod(didUrl: string | URL): Promise<DidKeyVerificationMethod>;
92
- /**
93
240
  * Imports a [Multibase]-encoded public key.
94
241
  *
95
242
  * [Multibase]: https://www.w3.org/TR/vc-data-integrity/#multibase-0
@@ -314,22 +461,6 @@ declare class UrlError extends Error {
314
461
  constructor(message: string);
315
462
  }
316
463
  /**
317
- * Parses a JSON-LD `@id` value as an IRI.
318
- */
319
- declare function parseJsonLdId(id: string | undefined, base?: string | URL): URL | undefined;
320
- /**
321
- * Parses an IRI as a URL, including FEP-ef61 portable ActivityPub IRIs.
322
- */
323
- declare function parseIri(iri: string | URL, base?: string | URL): URL;
324
- /**
325
- * Formats a URL as an IRI, including FEP-ef61 portable ActivityPub IRIs.
326
- */
327
- declare function formatIri(iri: string | URL): string;
328
- /**
329
- * Checks whether two IRIs have the same origin.
330
- */
331
- declare function haveSameIriOrigin(left: URL, right: URL): boolean;
332
- /**
333
464
  * Validates a URL to prevent SSRF attacks.
334
465
  */
335
466
  declare function validatePublicUrl(url: string): Promise<void>;
@@ -337,4 +468,4 @@ declare function isValidPublicIPv4Address(address: string): boolean;
337
468
  declare function isValidPublicIPv6Address(address: string): boolean;
338
469
  declare function expandIPv6Address(address: string): string;
339
470
  //#endregion
340
- export { type AuthenticatedDocumentLoaderFactory, type CreateRequestOptions, type Decimal, type DidKeyVerificationMethod, type DocumentLoader, type DocumentLoaderFactory, type DocumentLoaderFactoryOptions, type DocumentLoaderOptions, FetchError, type GetDocumentLoaderOptions, type GetUserAgentOptions, type Json, LanguageString, type PropertyPreprocessor, type PropertyPreprocessorContext, type RemoteDocument, UrlError, canParseDecimal, createActivityPubRequest, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportDidKey, exportMultibaseKey, exportSpki, formatIri, getDocumentLoader, getRemoteDocument, getUserAgent, haveSameIriOrigin, importDidKey, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, parseDidKeyVerificationMethod, parseIri, parseJsonLdId, preloadedContexts, validatePublicUrl };
471
+ export { type AuthenticatedDocumentLoaderFactory, type CreateRequestOptions, type Decimal, type DocumentLoader, type DocumentLoaderFactory, type DocumentLoaderFactoryOptions, type DocumentLoaderOptions, FetchError, type GetDocumentLoaderOptions, type GetUserAgentOptions, type Json, LanguageString, type PropertyPreprocessor, type PropertyPreprocessorContext, type RemoteDocument, UrlError, canParseDecimal, createActivityPubRequest, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportMultibaseKey, exportSpki, getDocumentLoader, getRemoteDocument, getUserAgent, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, preloadedContexts, validatePublicUrl };
package/dist/mod.d.ts CHANGED
@@ -1,35 +1,210 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { a as DocumentLoaderOptions, c as getDocumentLoader, d as FetchError, f as GetUserAgentOptions, h as logRequest, i as DocumentLoaderFactoryOptions, l as getRemoteDocument, m as getUserAgent, n as DocumentLoader, o as GetDocumentLoaderOptions, p as createActivityPubRequest, r as DocumentLoaderFactory, s as RemoteDocument, t as AuthenticatedDocumentLoaderFactory, u as CreateRequestOptions } from "./docloader-xRGn1azD.js";
2
+ import { Logger } from "@logtape/logtape";
3
3
  import { TracerProvider } from "@opentelemetry/api";
4
4
 
5
5
  //#region src/contexts.d.ts
6
6
  declare const preloadedContexts: Record<string, unknown>;
7
7
  //#endregion
8
- //#region src/key.d.ts
8
+ //#region src/request.d.ts
9
9
  /**
10
- * Parsed `did:key` verification method.
11
- *
12
- * @since 2.4.0
10
+ * Error thrown when fetching a JSON-LD document failed.
13
11
  */
14
- interface DidKeyVerificationMethod {
12
+ declare class FetchError extends Error {
15
13
  /**
16
- * The DID URL identifying the verification method.
14
+ * The URL that failed to fetch.
17
15
  */
18
- readonly id: URL;
16
+ url: URL;
19
17
  /**
20
- * The controller DID.
18
+ * The HTTP response that failed, if available.
21
19
  */
22
- readonly controller: URL;
20
+ response?: Response;
21
+ /**
22
+ * Constructs a new `FetchError`.
23
+ *
24
+ * @param url The URL that failed to fetch.
25
+ * @param message Error message.
26
+ * @param response The failed HTTP response, if available.
27
+ */
28
+ constructor(url: URL | string, message?: string, response?: Response);
29
+ }
30
+ /**
31
+ * Options for creating a request.
32
+ * @internal
33
+ */
34
+ interface CreateRequestOptions {
35
+ userAgent?: GetUserAgentOptions | string;
36
+ }
37
+ /**
38
+ * Creates a request for the given URL.
39
+ * @param url The URL to create the request for.
40
+ * @param options The options for the request.
41
+ * @returns The created request.
42
+ * @internal
43
+ */
44
+ declare function createActivityPubRequest(url: string, options?: CreateRequestOptions): Request;
45
+ /**
46
+ * Options for making `User-Agent` string.
47
+ * @see {@link getUserAgent}
48
+ * @since 1.3.0
49
+ */
50
+ interface GetUserAgentOptions {
23
51
  /**
24
- * The Ed25519 public key encoded as a Multibase Multikey value.
52
+ * An optional software name and version, e.g., `"Hollo/1.0.0"`.
25
53
  */
26
- readonly publicKeyMultibase: string;
54
+ software?: string | null;
27
55
  /**
28
- * The Ed25519 public key.
56
+ * An optional URL to append to the user agent string.
57
+ * Usually the URL of the ActivityPub instance.
29
58
  */
30
- readonly publicKey: CryptoKey;
59
+ url?: string | URL | null;
31
60
  }
32
61
  /**
62
+ * Gets the user agent string for the given application and URL.
63
+ * @param options The options for making the user agent string.
64
+ * @returns The user agent string.
65
+ * @since 1.3.0
66
+ */
67
+ declare function getUserAgent({
68
+ software,
69
+ url
70
+ }?: GetUserAgentOptions): string;
71
+ /**
72
+ * Logs the request.
73
+ * @param request The request to log.
74
+ * @internal
75
+ */
76
+ declare function logRequest(logger: Logger, request: Request): void;
77
+ //#endregion
78
+ //#region src/docloader.d.ts
79
+ /**
80
+ * A remote JSON-LD document and its context fetched by
81
+ * a {@link DocumentLoader}.
82
+ */
83
+ interface RemoteDocument {
84
+ /**
85
+ * The URL of the context document.
86
+ */
87
+ contextUrl: string | null;
88
+ /**
89
+ * The fetched JSON-LD document.
90
+ */
91
+ document: unknown;
92
+ /**
93
+ * The URL of the fetched document.
94
+ */
95
+ documentUrl: string;
96
+ }
97
+ /**
98
+ * Options for {@link DocumentLoader}.
99
+ * @since 1.8.0
100
+ */
101
+ interface DocumentLoaderOptions {
102
+ /**
103
+ * An `AbortSignal` for cancellation.
104
+ * @since 1.8.0
105
+ */
106
+ signal?: AbortSignal;
107
+ }
108
+ /**
109
+ * A JSON-LD document loader that fetches documents from the Web.
110
+ * @param url The URL of the document to load.
111
+ * @param options The options for the document loader.
112
+ * @returns The loaded remote document.
113
+ */
114
+ type DocumentLoader = (url: string, options?: DocumentLoaderOptions) => Promise<RemoteDocument>;
115
+ /**
116
+ * A factory function that creates a {@link DocumentLoader} with options.
117
+ * @param options The options for the document loader.
118
+ * @returns The document loader.
119
+ * @since 1.4.0
120
+ */
121
+ type DocumentLoaderFactory = (options?: DocumentLoaderFactoryOptions) => DocumentLoader;
122
+ /**
123
+ * Options for {@link DocumentLoaderFactory}.
124
+ * @see {@link DocumentLoaderFactory}
125
+ * @see {@link AuthenticatedDocumentLoaderFactory}
126
+ * @since 1.4.0
127
+ */
128
+ interface DocumentLoaderFactoryOptions {
129
+ /**
130
+ * Whether to allow fetching private network addresses.
131
+ * Turned off by default.
132
+ * @default `false``
133
+ */
134
+ allowPrivateAddress?: boolean;
135
+ /**
136
+ * Options for making `User-Agent` string.
137
+ * If a string is given, it is used as the `User-Agent` header value.
138
+ * If an object is given, it is passed to {@link getUserAgent} function.
139
+ */
140
+ userAgent?: GetUserAgentOptions | string;
141
+ /**
142
+ * The maximum number of redirections to follow.
143
+ * @default `20`
144
+ * @since 2.2.0
145
+ */
146
+ maxRedirection?: number;
147
+ }
148
+ /**
149
+ * A factory function that creates an authenticated {@link DocumentLoader} for
150
+ * a given identity. This is used for fetching documents that require
151
+ * authentication.
152
+ * @param identity The identity to create the document loader for.
153
+ * The actor's key pair.
154
+ * @param options The options for the document loader.
155
+ * @returns The authenticated document loader.
156
+ * @since 0.4.0
157
+ */
158
+ type AuthenticatedDocumentLoaderFactory = (identity: {
159
+ keyId: URL;
160
+ privateKey: CryptoKey;
161
+ }, options?: DocumentLoaderFactoryOptions) => DocumentLoader;
162
+ /**
163
+ * Gets a {@link RemoteDocument} from the given response.
164
+ * @param url The URL of the document to load.
165
+ * @param response The response to get the document from.
166
+ * @param fetch The function to fetch the document.
167
+ * @returns The loaded remote document.
168
+ * @throws {FetchError} If the response is not OK.
169
+ * @internal
170
+ */
171
+ declare function getRemoteDocument(url: string, response: Response, fetch: (url: string, options?: DocumentLoaderOptions) => Promise<RemoteDocument>): Promise<RemoteDocument>;
172
+ /**
173
+ * Options for {@link getDocumentLoader}.
174
+ * @since 1.3.0
175
+ */
176
+ interface GetDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
177
+ /**
178
+ * Whether to preload the frequently used contexts.
179
+ */
180
+ skipPreloadedContexts?: boolean;
181
+ }
182
+ /**
183
+ * Creates a JSON-LD document loader that utilizes the browser's `fetch` API.
184
+ *
185
+ * The created loader preloads the below frequently used contexts by default
186
+ * (unless `options.skipPreloadedContexts` is set to `true`):
187
+ *
188
+ * - <https://www.w3.org/ns/activitystreams>
189
+ * - <https://w3id.org/security/v1>
190
+ * - <https://w3id.org/security/data-integrity/v1>
191
+ * - <https://www.w3.org/ns/did/v1>
192
+ * - <https://w3id.org/security/multikey/v1>
193
+ * - <https://purl.archive.org/socialweb/webfinger>
194
+ * - <http://schema.org/>
195
+ * @param options Options for the document loader.
196
+ * @returns The document loader.
197
+ * @since 1.3.0
198
+ */
199
+ declare function getDocumentLoader({
200
+ allowPrivateAddress,
201
+ maxRedirection,
202
+ skipPreloadedContexts,
203
+ userAgent
204
+ }?: GetDocumentLoaderOptions): DocumentLoader;
205
+ //#endregion
206
+ //#region src/key.d.ts
207
+ /**
33
208
  * Imports a PEM-SPKI formatted public key.
34
209
  * @param pem The PEM-SPKI formatted public key.
35
210
  * @returns The imported public key.
@@ -62,34 +237,6 @@ declare function importPkcs1(pem: string): Promise<CryptoKey>;
62
237
  */
63
238
  declare function importPem(pem: string): Promise<CryptoKey>;
64
239
  /**
65
- * Imports an Ed25519 `did:key` DID.
66
- *
67
- * @param did The `did:key` DID.
68
- * @returns The imported Ed25519 public key.
69
- * @throws {TypeError} If the DID is malformed or uses an unsupported key type.
70
- * @since 2.4.0
71
- */
72
- declare function importDidKey(did: string | URL): Promise<CryptoKey>;
73
- /**
74
- * Exports an Ed25519 public key as a `did:key` DID.
75
- *
76
- * @param key The Ed25519 public key.
77
- * @returns The `did:key` DID.
78
- * @throws {TypeError} If the key is invalid or unsupported.
79
- * @since 2.4.0
80
- */
81
- declare function exportDidKey(key: CryptoKey): Promise<string>;
82
- /**
83
- * Parses an Ed25519 `did:key` verification method DID URL.
84
- *
85
- * @param didUrl The `did:key` DID URL.
86
- * @returns The parsed verification method.
87
- * @throws {TypeError} If the DID URL is malformed, unsupported, or its
88
- * fragment does not identify the same key as the DID.
89
- * @since 2.4.0
90
- */
91
- declare function parseDidKeyVerificationMethod(didUrl: string | URL): Promise<DidKeyVerificationMethod>;
92
- /**
93
240
  * Imports a [Multibase]-encoded public key.
94
241
  *
95
242
  * [Multibase]: https://www.w3.org/TR/vc-data-integrity/#multibase-0
@@ -314,22 +461,6 @@ declare class UrlError extends Error {
314
461
  constructor(message: string);
315
462
  }
316
463
  /**
317
- * Parses a JSON-LD `@id` value as an IRI.
318
- */
319
- declare function parseJsonLdId(id: string | undefined, base?: string | URL): URL | undefined;
320
- /**
321
- * Parses an IRI as a URL, including FEP-ef61 portable ActivityPub IRIs.
322
- */
323
- declare function parseIri(iri: string | URL, base?: string | URL): URL;
324
- /**
325
- * Formats a URL as an IRI, including FEP-ef61 portable ActivityPub IRIs.
326
- */
327
- declare function formatIri(iri: string | URL): string;
328
- /**
329
- * Checks whether two IRIs have the same origin.
330
- */
331
- declare function haveSameIriOrigin(left: URL, right: URL): boolean;
332
- /**
333
464
  * Validates a URL to prevent SSRF attacks.
334
465
  */
335
466
  declare function validatePublicUrl(url: string): Promise<void>;
@@ -337,4 +468,4 @@ declare function isValidPublicIPv4Address(address: string): boolean;
337
468
  declare function isValidPublicIPv6Address(address: string): boolean;
338
469
  declare function expandIPv6Address(address: string): string;
339
470
  //#endregion
340
- export { type AuthenticatedDocumentLoaderFactory, type CreateRequestOptions, type Decimal, type DidKeyVerificationMethod, type DocumentLoader, type DocumentLoaderFactory, type DocumentLoaderFactoryOptions, type DocumentLoaderOptions, FetchError, type GetDocumentLoaderOptions, type GetUserAgentOptions, type Json, LanguageString, type PropertyPreprocessor, type PropertyPreprocessorContext, type RemoteDocument, UrlError, canParseDecimal, createActivityPubRequest, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportDidKey, exportMultibaseKey, exportSpki, formatIri, getDocumentLoader, getRemoteDocument, getUserAgent, haveSameIriOrigin, importDidKey, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, parseDidKeyVerificationMethod, parseIri, parseJsonLdId, preloadedContexts, validatePublicUrl };
471
+ export { type AuthenticatedDocumentLoaderFactory, type CreateRequestOptions, type Decimal, type DocumentLoader, type DocumentLoaderFactory, type DocumentLoaderFactoryOptions, type DocumentLoaderOptions, FetchError, type GetDocumentLoaderOptions, type GetUserAgentOptions, type Json, LanguageString, type PropertyPreprocessor, type PropertyPreprocessorContext, type RemoteDocument, UrlError, canParseDecimal, createActivityPubRequest, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportMultibaseKey, exportSpki, getDocumentLoader, getRemoteDocument, getUserAgent, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, preloadedContexts, validatePublicUrl };