@fedify/vocab-runtime 2.5.0-dev.2448 → 2.5.0-dev.2492

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 (120) hide show
  1. package/deno.json +5 -2
  2. package/dist/{docloader-BBnBpbsG.d.cts → docloader-DD6binpN.d.cts} +4 -8
  3. package/dist/{docloader-BBnBpbsG.d.ts → docloader-DD6binpN.d.ts} +4 -8
  4. package/dist/internal/jsonld-cache.cjs +1 -1
  5. package/dist/internal/jsonld-cache.d.cts +1 -1
  6. package/dist/internal/jsonld-cache.d.ts +1 -1
  7. package/dist/internal/jsonld-cache.js +1 -1
  8. package/dist/internal/portable-dereference.cjs +1 -1
  9. package/dist/internal/portable-dereference.d.cts +2 -2
  10. package/dist/internal/portable-dereference.d.ts +2 -2
  11. package/dist/internal/portable-dereference.js +1 -1
  12. package/dist/internal.cjs +6 -0
  13. package/dist/internal.d.cts +108 -0
  14. package/dist/internal.d.ts +108 -0
  15. package/dist/internal.js +3 -0
  16. package/dist/mod.cjs +104 -38
  17. package/dist/mod.d.cts +3 -336
  18. package/dist/mod.d.ts +4 -336
  19. package/dist/mod.js +104 -38
  20. package/dist/{portable-BDydjp5H.d.ts → portable-1VSnSJFj.d.ts} +1 -1
  21. package/dist/{portable-Dfvcg_Wy.d.cts → portable-Cr7NwZwb.d.cts} +1 -1
  22. package/dist/public-fetch-Dvfvawei.cjs +527 -0
  23. package/dist/public-fetch-ziZ39L5I.js +510 -0
  24. package/dist/tests/{body-DP2u2wUX.cjs → body-C8d1PmDa.cjs} +1 -1
  25. package/dist/tests/{body-oV99TVdA.mjs → body-HSLxhexN.mjs} +1 -1
  26. package/dist/tests/body.test.cjs +1 -1
  27. package/dist/tests/body.test.mjs +1 -1
  28. package/dist/tests/decimal.test.cjs +4 -4
  29. package/dist/tests/decimal.test.mjs +4 -4
  30. package/dist/tests/{docloader-CwxZguqN.cjs → docloader-D1fNCGam.cjs} +111 -39
  31. package/dist/tests/{docloader-D3mA7aPJ.mjs → docloader-DkEUFJui.mjs} +106 -40
  32. package/dist/tests/docloader.test.cjs +531 -1293
  33. package/dist/tests/docloader.test.mjs +472 -1252
  34. package/dist/tests/esm-Ds-eHTfY.mjs +1229 -0
  35. package/dist/tests/esm-Q2tdh5f3.cjs +1215 -0
  36. package/dist/tests/internal/portable-dereference.test.cjs +3 -3
  37. package/dist/tests/internal/portable-dereference.test.mjs +3 -3
  38. package/dist/tests/{jsonld-cache-BEXiiM-V.cjs → jsonld-cache-DKIWKxEX.cjs} +1 -1
  39. package/dist/tests/{jsonld-cache-DFnWsLuZ.mjs → jsonld-cache-KH40z9_7.mjs} +1 -1
  40. package/dist/tests/jsonld-cache.test.cjs +2 -2
  41. package/dist/tests/jsonld-cache.test.mjs +2 -2
  42. package/dist/tests/node-CbBR-th-.mjs +84 -0
  43. package/dist/tests/node-Ch29PDXR.cjs +89 -0
  44. package/dist/tests/pin-grant-CPrpk1l4.cjs +70 -0
  45. package/dist/tests/pin-grant-H5XhM1Xs.mjs +53 -0
  46. package/dist/tests/pin-grant.test.cjs +87 -0
  47. package/dist/tests/pin-grant.test.d.cts +1 -0
  48. package/dist/tests/pin-grant.test.d.mts +1 -0
  49. package/dist/tests/pin-grant.test.mjs +88 -0
  50. package/dist/tests/pinners/bun.test.cjs +166 -0
  51. package/dist/tests/pinners/bun.test.d.cts +1 -0
  52. package/dist/tests/pinners/bun.test.d.mts +1 -0
  53. package/dist/tests/pinners/bun.test.mjs +167 -0
  54. package/dist/tests/pinners/node.test.cjs +269 -0
  55. package/dist/tests/pinners/node.test.d.cts +1 -0
  56. package/dist/tests/pinners/node.test.d.mts +1 -0
  57. package/dist/tests/pinners/node.test.mjs +268 -0
  58. package/dist/tests/pinners/pinners.test.cjs +196 -0
  59. package/dist/tests/pinners/pinners.test.d.cts +1 -0
  60. package/dist/tests/pinners/pinners.test.d.mts +1 -0
  61. package/dist/tests/pinners/pinners.test.mjs +197 -0
  62. package/dist/tests/pinners/testdata/node-child.cjs +135 -0
  63. package/dist/tests/pinners/testdata/node-child.d.cts +1 -0
  64. package/dist/tests/pinners/testdata/node-child.d.mts +1 -0
  65. package/dist/tests/pinners/testdata/node-child.mjs +134 -0
  66. package/dist/tests/pinners-DLH_npLf.cjs +220 -0
  67. package/dist/tests/pinners-tGcl49uF.mjs +203 -0
  68. package/dist/tests/{portable-dereference-DaTBBvCj.cjs → portable-dereference-BUoDzMxk.cjs} +2 -2
  69. package/dist/tests/{portable-dereference-sGRs_qdT.mjs → portable-dereference-Du2k3ngE.mjs} +2 -2
  70. package/dist/tests/{portable-media-D7ClSjFO.cjs → portable-media-BM9zgj9g.cjs} +3 -3
  71. package/dist/tests/{portable-media-B-oCeotd.mjs → portable-media-CTxGibcj.mjs} +3 -3
  72. package/dist/tests/portable-media.test.cjs +1 -1
  73. package/dist/tests/portable-media.test.mjs +1 -1
  74. package/dist/tests/portable-workers.test.cjs +2 -2
  75. package/dist/tests/portable-workers.test.mjs +2 -2
  76. package/dist/tests/public-fetch-BGj5pzUD.cjs +186 -0
  77. package/dist/tests/public-fetch-Cxo3Yzdf.mjs +170 -0
  78. package/dist/tests/public-fetch.test.cjs +1073 -0
  79. package/dist/tests/public-fetch.test.d.cts +1 -0
  80. package/dist/tests/public-fetch.test.d.mts +1 -0
  81. package/dist/tests/public-fetch.test.mjs +1074 -0
  82. package/dist/tests/{request-B77_oZnk.cjs → request-7q-Zfe1p.cjs} +2 -2
  83. package/dist/tests/{request-BlLYI4x3.mjs → request-D5uGtmmq.mjs} +2 -2
  84. package/dist/tests/request.test.cjs +2 -2
  85. package/dist/tests/request.test.mjs +2 -2
  86. package/dist/tests/support-Bj44xlQu.mjs +272 -0
  87. package/dist/tests/support-BrdlbLJk.cjs +363 -0
  88. package/dist/tests/{url-BNakuZ8k.cjs → url-Bdj-rTcC.cjs} +88 -12
  89. package/dist/tests/{url-DMxmp7ZG.mjs → url-COj5Q8mb.mjs} +65 -13
  90. package/dist/tests/url.test.cjs +4 -1
  91. package/dist/tests/url.test.mjs +4 -1
  92. package/dist/url-4EE56sNP.d.cts +352 -0
  93. package/dist/url-4EE56sNP.d.ts +352 -0
  94. package/dist/{url-DrGTR8yv.cjs → url-DIKZnaJv.cjs} +88 -12
  95. package/dist/{url-Dzyp-NsC.js → url-mWveR5GA.js} +65 -13
  96. package/package.json +14 -3
  97. package/src/docloader.test.ts +696 -48
  98. package/src/docloader.ts +186 -75
  99. package/src/internal.ts +13 -0
  100. package/src/pin-grant.test.ts +118 -0
  101. package/src/pin-grant.ts +99 -0
  102. package/src/pinners/bun.test.ts +278 -0
  103. package/src/pinners/bun.ts +223 -0
  104. package/src/pinners/mod.ts +59 -0
  105. package/src/pinners/node.test.ts +415 -0
  106. package/src/pinners/node.ts +144 -0
  107. package/src/pinners/pinners.test.ts +316 -0
  108. package/src/pinners/testdata/node-child.ts +147 -0
  109. package/src/pinners/testdata/proxy-child.ts +82 -0
  110. package/src/pinners/testdata/support.ts +343 -0
  111. package/src/pinners/testdata/tls-cert.pem +12 -0
  112. package/src/pinners/testdata/tls-child.ts +88 -0
  113. package/src/pinners/testdata/tls-key.pem +5 -0
  114. package/src/pinners/types.ts +48 -0
  115. package/src/public-fetch.test.ts +1286 -0
  116. package/src/public-fetch.ts +338 -0
  117. package/src/testdata/public-fetch-deno-worker.ts +74 -0
  118. package/src/url.test.ts +11 -0
  119. package/src/url.ts +113 -22
  120. package/tsdown.config.ts +7 -2
package/dist/mod.d.cts CHANGED
@@ -1,6 +1,7 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { _ as isTransientFetchError, a as DocumentLoaderOptions, c as getDocumentLoader, d as withDocumentLoaderTimeout, f as CreateRequestOptions, g as getUserAgent, h as createActivityPubRequest, i as DocumentLoaderFactoryOptions, l as getRemoteDocument, m as GetUserAgentOptions, n as DocumentLoader, o as GetDocumentLoaderOptions, p as FetchError, r as DocumentLoaderFactory, s as RemoteDocument, t as AuthenticatedDocumentLoaderFactory, u as resolveDocumentLoaderTimeout, v as logRequest } from "./docloader-BBnBpbsG.cjs";
3
- import { i as PortableObjectVerifierOptions, n as PortableObjectVerification, r as PortableObjectVerifier, t as PortableObjectReferrer } from "./portable-Dfvcg_Wy.cjs";
2
+ import { _ as parseJsonLdId, a as expandIPv6Address, b as withGatewayHints, c as getFe34Origin, d as haveSameIriOrigin, f as isGatewayUrl, g as parseIri, h as parseGatewayUrl, i as canonicalizePortableUri, l as getGatewayHints, m as isValidPublicIPv6Address, n as UrlError, o as formatIri, p as isValidPublicIPv4Address, r as arePortableUrisEqual, s as fromCompatibleEf61Id, u as haveSameFe34Origin, v as toCompatibleEf61Id, x as withoutGatewayHints, y as validatePublicUrl } from "./url-4EE56sNP.cjs";
3
+ import { _ as isTransientFetchError, a as DocumentLoaderOptions, c as getDocumentLoader, d as withDocumentLoaderTimeout, f as CreateRequestOptions, g as getUserAgent, h as createActivityPubRequest, i as DocumentLoaderFactoryOptions, l as getRemoteDocument, m as GetUserAgentOptions, n as DocumentLoader, o as GetDocumentLoaderOptions, p as FetchError, r as DocumentLoaderFactory, s as RemoteDocument, t as AuthenticatedDocumentLoaderFactory, u as resolveDocumentLoaderTimeout, v as logRequest } from "./docloader-DD6binpN.cjs";
4
+ import { i as PortableObjectVerifierOptions, n as PortableObjectVerification, r as PortableObjectVerifier, t as PortableObjectReferrer } from "./portable-Cr7NwZwb.cjs";
4
5
  import { TracerProvider } from "@opentelemetry/api";
5
6
 
6
7
  //#region src/contexts.d.ts
@@ -469,338 +470,4 @@ interface PropertyPreprocessorContext {
469
470
  */
470
471
  type PropertyPreprocessor<T = unknown> = (value: Json, context: PropertyPreprocessorContext) => T | undefined | Error | Promise<T | undefined | Error>;
471
472
  //#endregion
472
- //#region src/url.d.ts
473
- declare class UrlError extends Error {
474
- /**
475
- * The failure category. Defaults to `"disallowed"`.
476
- * `"dns"` includes lookup errors and results with no usable IP addresses.
477
- * @since 2.0.29
478
- */
479
- readonly reason: "dns" | "disallowed";
480
- constructor(message: string, options?: {
481
- cause?: unknown;
482
- reason?: "dns" | "disallowed";
483
- });
484
- }
485
- /**
486
- * Parses a JSON-LD `@id` value as an IRI, including FEP-ef61 portable
487
- * ActivityPub IRIs. See {@link parseIri} for how IRIs are parsed.
488
- * @param id The `@id` value.
489
- * @param base The base IRI to resolve a relative `@id` against.
490
- * @returns The parsed IRI, or `undefined` if `id` is missing or a blank node
491
- * identifier.
492
- * @throws {TypeError} If `id` is not a valid IRI.
493
- * @since 2.4.0
494
- */
495
- declare function parseJsonLdId(id: string | undefined, base?: string | URL): URL | undefined;
496
- /**
497
- * Parses an IRI as a URL, including FEP-ef61 portable ActivityPub IRIs.
498
- * Portable URI and FEP-ef61 compatible identifier strings whose path contains
499
- * a `.` or `..` segment, including percent-encoded spellings, throw a
500
- * `TypeError`: JavaScript `URL` would otherwise identify a different object.
501
- * This also applies to compatible identifier strings used as relative bases.
502
- * A `URL` argument may already have lost such segments before this function
503
- * receives it.
504
- *
505
- * Portable IRIs, e.g., `ap://did:key:z6Mk.../actor`, cannot be represented by
506
- * JavaScript `URL` as they are, so the returned `URL` keeps the DID authority
507
- * percent-encoded, e.g., `ap+ef61://did%3Akey%3Az6Mk.../actor`. Use
508
- * {@link formatIri} to get the canonical string back.
509
- * @param iri The IRI to parse.
510
- * @param base The base IRI to resolve a relative IRI against.
511
- * @returns The parsed IRI.
512
- * @throws {TypeError} If the IRI is malformed.
513
- * @since 2.4.0
514
- */
515
- declare function parseIri(iri: string | URL, base?: string | URL): URL;
516
- /**
517
- * Formats a URL as an IRI, including FEP-ef61 portable ActivityPub IRIs.
518
- * Portable URI and FEP-ef61 compatible identifier strings with dot segments
519
- * throw a `TypeError` because their paths cannot be represented by JavaScript
520
- * `URL` without normalization.
521
- *
522
- * Portable IRIs are formatted with the `ap+ef61:` scheme and a decoded DID
523
- * authority, even if they were parsed from `ap:` IRIs. FEP-ef61 currently
524
- * recommends the `ap:` scheme, so a future major version of Fedify may change
525
- * the scheme this function produces. Do not compare its results as strings to
526
- * tell whether two portable IRIs identify the same object; use
527
- * `arePortableUrisEqual()` instead.
528
- * @param iri The IRI to format.
529
- * @returns The formatted IRI. A string that cannot be parsed as a URL at all
530
- * is returned unchanged.
531
- * @throws {TypeError} If the IRI is a malformed portable IRI or FEP-ef61
532
- * compatible identifier, e.g., one with dot segments.
533
- * @since 2.4.0
534
- */
535
- declare function formatIri(iri: string | URL): string;
536
- /**
537
- * Canonicalizes a FEP-ef61 portable ActivityPub URI for comparison.
538
- *
539
- * This accepts both `ap:` and `ap+ef61:` URI strings with decoded or
540
- * percent-encoded DID authorities. The returned value uses the `ap+ef61:`
541
- * scheme, a decoded DID authority, and no query component. Pass the raw URI
542
- * string, not a `URL` object, because JavaScript `URL` normalizes opaque path
543
- * segments before Fedify can compare them.
544
- *
545
- * The `ap+ef61:` scheme of the result is a choice of Fedify's, whereas
546
- * FEP-ef61 currently canonicalizes portable URIs with the `ap:` scheme.
547
- * A future major version of Fedify may change the scheme of the result, so
548
- * do not persist the result as the only copy of an identifier; keep the
549
- * original URI, and canonicalize it again when comparing.
550
- *
551
- * @param input The raw portable ActivityPub URI string to canonicalize.
552
- * @returns The canonical portable ActivityPub URI string.
553
- * @throws {TypeError} If the input is not a valid portable ActivityPub IRI.
554
- * @since 2.4.0
555
- */
556
- declare function canonicalizePortableUri(input: string): string;
557
- /**
558
- * Checks whether two FEP-ef61 portable ActivityPub URIs identify the same
559
- * portable object.
560
- *
561
- * Non-string inputs return `false`. Non-portable URI strings use strict string
562
- * equality. Portable URI strings are compared through
563
- * {@link canonicalizePortableUri}; malformed portable URI strings return
564
- * `false` unless they are exactly equal.
565
- *
566
- * @since 2.4.0
567
- */
568
- declare function arePortableUrisEqual(left: string, right: string): boolean;
569
- /**
570
- * Computes an IRI's FEP-fe34 origin.
571
- *
572
- * HTTP(S) IRIs use their web origin. FEP-ef61 portable ActivityPub IRIs and
573
- * DID URLs use their DID as a cryptographic origin.
574
- *
575
- * @throws {TypeError} If the IRI does not have a supported FEP-fe34 origin.
576
- * @since 2.4.0
577
- */
578
- declare function getFe34Origin(input: string | URL): string;
579
- /**
580
- * Checks whether two IRIs have the same FEP-fe34 origin.
581
- *
582
- * Malformed or unsupported IRIs are treated as non-matching.
583
- *
584
- * @since 2.4.0
585
- */
586
- declare function haveSameFe34Origin(left: string | URL, right: string | URL): boolean;
587
- /**
588
- * Checks whether two IRIs have the same origin. Unlike comparing
589
- * `URL.origin`, which is `"null"` for URLs with non-special schemes, this
590
- * compares FEP-ef61 portable ActivityPub IRIs by their schemes and DIDs, so
591
- * that `ap:` and `ap+ef61:` IRIs of the same DID with decoded or
592
- * percent-encoded authorities have the same origin. Other IRIs with
593
- * a non-special scheme and a host are compared by their schemes and hosts.
594
- *
595
- * This is not an FEP-fe34 origin check: an `ap+ef61:` IRI and the `did:key`
596
- * verification method of the same DID have different origins here. Use
597
- * {@link haveSameFe34Origin} for that.
598
- * @param left The first IRI.
599
- * @param right The second IRI.
600
- * @returns `true` if the IRIs have the same origin.
601
- * @since 2.4.0
602
- */
603
- declare function haveSameIriOrigin(left: URL, right: URL): boolean;
604
- /**
605
- * Checks whether the URL is an FEP-ef61 gateway base URI, i.e., an HTTP(S)
606
- * URI with no credentials, path, query, or fragment, such as
607
- * `https://example.com/`. FEP-ef61 requires every item of a portable actor's
608
- * `gateways` to be such a URI. A URI with an empty query or fragment
609
- * delimiter, such as `https://example.com/?`, is not a gateway base URI.
610
- *
611
- * Note that the `URL` class normalizes `https://example.com` to
612
- * `https://example.com/`, so both are gateway base URIs.
613
- * @param url The URL to check.
614
- * @returns `true` if the URL is an FEP-ef61 gateway base URI.
615
- * @since 2.4.0
616
- */
617
- declare function isGatewayUrl(url: URL): boolean;
618
- /**
619
- * Parses and validates an FEP-ef61 gateway base URI, i.e., an HTTP(S) URI with
620
- * no credentials, path, query, or fragment, such as `https://example.com`.
621
- * See {@link isGatewayUrl} for the rules.
622
- * @param url The gateway base URI to parse.
623
- * @returns The parsed gateway base URI, whose path is `/`.
624
- * @throws {TypeError} If the URI is malformed, or is not an HTTP(S) base URI
625
- * with no credentials, path, query, or fragment. In the
626
- * latter case, the message starts with
627
- * `Invalid FEP-ef61 gateway:`.
628
- * @since 2.4.0
629
- */
630
- declare function parseGatewayUrl(url: string): URL;
631
- /**
632
- * Converts an [FEP-ef61] compatible identifier into a portable ActivityPub
633
- * URI.
634
- *
635
- * A compatible identifier is an HTTP(S) URL under a gateway's fixed
636
- * `/.well-known/apgateway/` path, such as
637
- * `https://server.example/.well-known/apgateway/did:key:z6Mk.../objects/1`.
638
- * This function removes the gateway part and returns the corresponding
639
- * portable URI, e.g., `ap+ef61://did:key:z6Mk.../objects/1`, in the same
640
- * internal `URL` form that {@link parseIri} produces. The path, query, and
641
- * fragment are preserved, so the result is a portable URI, not a comparison
642
- * form; pass its `href` to {@link canonicalizePortableUri} or
643
- * {@link arePortableUrisEqual} to compare it with other portable URIs.
644
- *
645
- * The conversion only reveals the *claimed* portable identifier. Anyone can
646
- * publish a compatible identifier for any DID on their own server, so the
647
- * gateway that served it is neither the object's origin nor authorized to act
648
- * for the DID. Callers must still verify the retrieved document's Object
649
- * Integrity Proof against the DID, as FEP-ef61 requires, and should keep the
650
- * original URL if they need the gateway as a retrieval hint.
651
- *
652
- * Arbitrary gateway paths are not supported.
653
- *
654
- * [FEP-ef61]: https://w3id.org/fep/ef61
655
- *
656
- * @param input The URL to convert.
657
- * @returns The portable ActivityPub URI, or `null` if the input is not an
658
- * HTTP(S) URL whose path starts with `/.well-known/apgateway/did:`.
659
- * Other gateway routes, such as the gateway discovery endpoint and
660
- * hashlink media URLs, also yield `null`.
661
- * @throws {TypeError} If the input looks like a compatible identifier but is
662
- * malformed, e.g., it has an invalid DID, no object path,
663
- * invalid percent-encoding, credentials, or location
664
- * hints (`@gateway` query parameters, or the legacy
665
- * `gateways` parameter), or its raw string path would
666
- * change during URL parsing. Already-parsed `URL`
667
- * arguments cannot reveal segments lost by their parser.
668
- * @since 2.4.0
669
- */
670
- declare function fromCompatibleEf61Id(input: string | URL): URL | null;
671
- /**
672
- * Converts a portable ActivityPub URI into an [FEP-ef61] compatible
673
- * identifier, which is an HTTP(S) URL under the gateway's fixed
674
- * `/.well-known/apgateway/` path.
675
- *
676
- * For example, `ap+ef61://did:key:z6Mk.../objects/1` and
677
- * `https://server.example` yield
678
- * `https://server.example/.well-known/apgateway/did:key:z6Mk.../objects/1`.
679
- * Both `ap:` and `ap+ef61:` URIs with decoded or percent-encoded DID
680
- * authorities are accepted. Publishers should use the first gateway in the
681
- * actor's `gateways` list, as FEP-ef61 requires.
682
- *
683
- * The path and fragment are preserved, with characters that are not allowed
684
- * in HTTP(S) URLs percent-encoded the same way as
685
- * {@link canonicalizePortableUri} does. FEP-ef61 location hints (`@gateway`
686
- * query parameters, and the legacy `gateways` parameter) are removed, since
687
- * compatible identifiers must not have them; other query parameters are kept
688
- * in order.
689
- *
690
- * Arbitrary gateway paths are not supported.
691
- *
692
- * [FEP-ef61]: https://w3id.org/fep/ef61
693
- *
694
- * @param portableId The `ap:` or `ap+ef61:` URI to convert.
695
- * @param gateway The gateway's HTTP(S) origin, e.g., `https://server.example`.
696
- * @returns The compatible identifier.
697
- * @throws {TypeError} If the portable ID is not a valid `ap:` or `ap+ef61:`
698
- * URI, if its path has `.` or `..` segments (which
699
- * HTTP(S) URLs cannot represent without changing the
700
- * identified object), or if the gateway is
701
- * not an HTTP(S) origin with no credentials, path, query,
702
- * or fragment.
703
- * @since 2.4.0
704
- */
705
- declare function toCompatibleEf61Id(portableId: string | URL, gateway: string | URL): URL;
706
- /**
707
- * Returns a copy of an [FEP-ef61] portable ActivityPub URI with `@gateway`
708
- * location hints for the given gateways, which tell consumers where they can
709
- * retrieve the object. Put hints on *references* to portable actors, e.g.,
710
- * in `actor`, `attributedTo`, `to`, or `cc`, when constructing an object, as
711
- * FEP-ef61 recommends:
712
- *
713
- * ~~~~ typescript
714
- * withGatewayHints("ap://did:key:z6Mk.../actor", [
715
- * "https://server1.example",
716
- * "https://server2.example",
717
- * ]);
718
- * // ap+ef61://did:key:z6Mk.../actor?@gateway=https%3A%2F%2Fserver1.example&@gateway=https%3A%2F%2Fserver2.example
719
- * ~~~~
720
- *
721
- * Do not put hints on an object's own `id`. Hints do not change the
722
- * identity of a portable URI, since FEP-ef61 drops the query when comparing
723
- * portable URIs, but implementations that do not canonicalize portable URIs
724
- * would take a hinted ID for another object. Add hints before signing the
725
- * object, since its Object Integrity Proof covers its references too.
726
- *
727
- * The hints that the URI already has, including the legacy `gateways`
728
- * parameter, are replaced. Each gateway becomes a `@gateway` query
729
- * parameter whose value is its URI-encoded origin, e.g.,
730
- * `@gateway=https%3A%2F%2Fserver1.example`, in the given order after the
731
- * other query parameters. Duplicate gateways are dropped, and an empty list
732
- * removes the hints as {@link withoutGatewayHints} does. The other query
733
- * parameters, their order, and the fragment are kept, but percent-encoding
734
- * is normalized the same way as {@link canonicalizePortableUri} does it.
735
- *
736
- * Fedify follows at most five hints when dereferencing a portable URI
737
- * (three for the key ID of an HTTP Signature), so list the preferred
738
- * gateways first; there is no limit on the number of hints added here.
739
- *
740
- * [FEP-ef61]: https://w3id.org/fep/ef61
741
- *
742
- * @param portableId The `ap:` or `ap+ef61:` URI. Pass the raw string rather
743
- * than a `URL` if its path may have `.` or `..` segments,
744
- * because the `URL` class resolves them.
745
- * @param gateways The gateways, e.g., the `gateways` of the actor that the
746
- * URI refers to. Each has to be an HTTP(S) origin with no
747
- * credentials, path, query, or fragment.
748
- * @returns The portable URI with the hints, in the same internal `URL` form
749
- * as {@link parseIri} returns. Use {@link formatIri} to get its
750
- * canonical string.
751
- * @throws {TypeError} If the portable ID is not a valid `ap:` or `ap+ef61:`
752
- * URI, e.g., it is a compatible identifier, which must
753
- * not have location hints; if its path has `.` or `..`
754
- * segments, which the `URL` class cannot represent; or
755
- * if a gateway is invalid.
756
- * @since 2.4.0
757
- */
758
- declare function withGatewayHints(portableId: string | URL, gateways: Iterable<string | URL>): URL;
759
- /**
760
- * Returns a copy of an [FEP-ef61] portable ActivityPub URI without its
761
- * location hints, i.e., `@gateway` query parameters and the legacy
762
- * `gateways` parameter. The other query parameters, their order, and the
763
- * fragment are kept, but percent-encoding is normalized the same way as
764
- * {@link canonicalizePortableUri} does it.
765
- *
766
- * [FEP-ef61]: https://w3id.org/fep/ef61
767
- *
768
- * @param portableId The `ap:` or `ap+ef61:` URI. Pass the raw string rather
769
- * than a `URL` if its path may have `.` or `..` segments,
770
- * because the `URL` class resolves them.
771
- * @returns The portable URI without the hints, in the same internal `URL`
772
- * form as {@link parseIri} returns.
773
- * @throws {TypeError} If the portable ID is not a valid `ap:` or `ap+ef61:`
774
- * URI, or if its path has `.` or `..` segments, which
775
- * the `URL` class cannot represent.
776
- * @since 2.4.0
777
- */
778
- declare function withoutGatewayHints(portableId: string | URL): URL;
779
- /**
780
- * Gets the gateways in the `@gateway` location hints of an [FEP-ef61]
781
- * portable ActivityPub URI, in order. Hints that are not valid gateways,
782
- * i.e., HTTP(S) origins with no credentials, path, query, or fragment, are
783
- * skipped, and so are duplicates. The legacy `gateways` parameter is not
784
- * read.
785
- *
786
- * Unlike Fedify's dereferencing, which follows at most five hints, this
787
- * returns all of them.
788
- *
789
- * [FEP-ef61]: https://w3id.org/fep/ef61
790
- *
791
- * @param portableId The `ap:` or `ap+ef61:` URI.
792
- * @returns The gateways, e.g., `https://server1.example/`.
793
- * @throws {TypeError} If the portable ID is not a valid `ap:` or `ap+ef61:`
794
- * URI.
795
- * @since 2.4.0
796
- */
797
- declare function getGatewayHints(portableId: string | URL): URL[];
798
- /**
799
- * Validates a URL to prevent SSRF attacks.
800
- */
801
- declare function validatePublicUrl(url: string): Promise<void>;
802
- declare function isValidPublicIPv4Address(address: string): boolean;
803
- declare function isValidPublicIPv6Address(address: string): boolean;
804
- declare function expandIPv6Address(address: string): string;
805
- //#endregion
806
473
  export { type AuthenticatedDocumentLoaderFactory, type CreateRequestOptions, type Decimal, type DidKeyVerificationMethod, type DocumentLoader, type DocumentLoaderFactory, type DocumentLoaderFactoryOptions, type DocumentLoaderOptions, FetchError, type FetchPortableMediaOptions, type GetDocumentLoaderOptions, type GetUserAgentOptions, type Json, LanguageString, type ParsedDigestMultibase, type ParsedHashlink, type PortableMedia, type PortableObjectReferrer, type PortableObjectVerification, type PortableObjectVerifier, type PortableObjectVerifierOptions, type PropertyPreprocessor, type PropertyPreprocessorContext, type RemoteDocument, UrlError, arePortableUrisEqual, canParseDecimal, canonicalizePortableUri, computeDigestMultibase, createActivityPubRequest, createHashlink, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportDidKey, exportMultibaseKey, exportSpki, fetchPortableMedia, formatIri, fromCompatibleEf61Id, getDocumentLoader, getFe34Origin, getGatewayHints, getRemoteDocument, getUserAgent, haveSameFe34Origin, haveSameIriOrigin, importDidKey, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isGatewayUrl, isTransientFetchError, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, normalizeLanguageTag, parseDecimal, parseDidKeyVerificationMethod, parseDigestMultibase, parseGatewayUrl, parseHashlink, parseIri, parseJsonLdId, preloadedContexts, resolveDocumentLoaderTimeout, toCompatibleEf61Id, validatePublicUrl, verifyDigestMultibase, verifyHashlink, withDocumentLoaderTimeout, withGatewayHints, withoutGatewayHints };