@fedify/vocab-runtime 2.4.5-dev.2462 → 2.4.5

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-BMHljyYb.d.cts → docloader-DOWjnNCz.d.cts} +4 -8
  3. package/dist/{docloader-BMHljyYb.d.ts → docloader-DOWjnNCz.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-6Aj-7dZJ.d.cts → portable-CTnZWX7J.d.cts} +1 -1
  21. package/dist/{portable-nkTiqH0w.d.ts → portable-Cq-rhQgY.d.ts} +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-Dlnsb-QX.cjs → body-BO79kuv1.cjs} +1 -1
  25. package/dist/tests/{body-BXrFIcFa.mjs → body-CUzCsDZ4.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 +3 -3
  29. package/dist/tests/decimal.test.mjs +3 -3
  30. package/dist/tests/{docloader-c9BQWaF1.cjs → docloader-B79_YgeY.cjs} +111 -39
  31. package/dist/tests/{docloader-DsuF8YDf.mjs → docloader-C5ZHGEfO.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-BvS3AhZ2.cjs +89 -0
  43. package/dist/tests/node-Cg4pRuYy.mjs +84 -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-CJi9ZkYs.cjs +220 -0
  67. package/dist/tests/pinners-zSofbiy2.mjs +203 -0
  68. package/dist/tests/{portable-dereference-DmTYDy2p.mjs → portable-dereference-BHRE5Pkm.mjs} +2 -2
  69. package/dist/tests/{portable-dereference-qTLMqe2_.cjs → portable-dereference-mRHrC7PI.cjs} +2 -2
  70. package/dist/tests/{portable-media-M7idvaUq.mjs → portable-media-BpVpe1gj.mjs} +3 -3
  71. package/dist/tests/{portable-media-CS4czG6X.cjs → portable-media-C3yY0W5E.cjs} +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-DNkPoks1.mjs +170 -0
  77. package/dist/tests/public-fetch-U822jbKB.cjs +186 -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-C336eT6A.mjs → request-3AP-HBJ6.mjs} +1 -1
  83. package/dist/tests/{request-CgTgsBUA.cjs → request-BhopJTZd.cjs} +1 -1
  84. package/dist/tests/request.test.cjs +1 -1
  85. package/dist/tests/request.test.mjs +1 -1
  86. package/dist/tests/support-BmzI3dRJ.cjs +363 -0
  87. package/dist/tests/support-CiHDVJgh.mjs +272 -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 logRequest, 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 } from "./docloader-BMHljyYb.cjs";
3
- import { i as PortableObjectVerifierOptions, n as PortableObjectVerification, r as PortableObjectVerifier, t as PortableObjectReferrer } from "./portable-6Aj-7dZJ.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 logRequest, 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 } from "./docloader-DOWjnNCz.cjs";
4
+ import { i as PortableObjectVerifierOptions, n as PortableObjectVerification, r as PortableObjectVerifier, t as PortableObjectReferrer } from "./portable-CTnZWX7J.cjs";
4
5
  import { TracerProvider } from "@opentelemetry/api";
5
6
 
6
7
  //#region src/contexts.d.ts
@@ -474,338 +475,4 @@ interface PropertyPreprocessorContext {
474
475
  */
475
476
  type PropertyPreprocessor<T = unknown> = (value: Json, context: PropertyPreprocessorContext) => T | undefined | Error | Promise<T | undefined | Error>;
476
477
  //#endregion
477
- //#region src/url.d.ts
478
- declare class UrlError extends Error {
479
- /**
480
- * The failure category. Defaults to `"disallowed"`.
481
- * `"dns"` includes lookup errors and results with no usable IP addresses.
482
- * @since 2.0.29
483
- */
484
- readonly reason: "dns" | "disallowed";
485
- constructor(message: string, options?: {
486
- cause?: unknown;
487
- reason?: "dns" | "disallowed";
488
- });
489
- }
490
- /**
491
- * Parses a JSON-LD `@id` value as an IRI, including FEP-ef61 portable
492
- * ActivityPub IRIs. See {@link parseIri} for how IRIs are parsed.
493
- * @param id The `@id` value.
494
- * @param base The base IRI to resolve a relative `@id` against.
495
- * @returns The parsed IRI, or `undefined` if `id` is missing or a blank node
496
- * identifier.
497
- * @throws {TypeError} If `id` is not a valid IRI.
498
- * @since 2.4.0
499
- */
500
- declare function parseJsonLdId(id: string | undefined, base?: string | URL): URL | undefined;
501
- /**
502
- * Parses an IRI as a URL, including FEP-ef61 portable ActivityPub IRIs.
503
- * Portable URI and FEP-ef61 compatible identifier strings whose path contains
504
- * a `.` or `..` segment, including percent-encoded spellings, throw a
505
- * `TypeError`: JavaScript `URL` would otherwise identify a different object.
506
- * This also applies to compatible identifier strings used as relative bases.
507
- * A `URL` argument may already have lost such segments before this function
508
- * receives it.
509
- *
510
- * Portable IRIs, e.g., `ap://did:key:z6Mk.../actor`, cannot be represented by
511
- * JavaScript `URL` as they are, so the returned `URL` keeps the DID authority
512
- * percent-encoded, e.g., `ap+ef61://did%3Akey%3Az6Mk.../actor`. Use
513
- * {@link formatIri} to get the canonical string back.
514
- * @param iri The IRI to parse.
515
- * @param base The base IRI to resolve a relative IRI against.
516
- * @returns The parsed IRI.
517
- * @throws {TypeError} If the IRI is malformed.
518
- * @since 2.4.0
519
- */
520
- declare function parseIri(iri: string | URL, base?: string | URL): URL;
521
- /**
522
- * Formats a URL as an IRI, including FEP-ef61 portable ActivityPub IRIs.
523
- * Portable URI and FEP-ef61 compatible identifier strings with dot segments
524
- * throw a `TypeError` because their paths cannot be represented by JavaScript
525
- * `URL` without normalization.
526
- *
527
- * Portable IRIs are formatted with the `ap+ef61:` scheme and a decoded DID
528
- * authority, even if they were parsed from `ap:` IRIs. FEP-ef61 currently
529
- * recommends the `ap:` scheme, so a future major version of Fedify may change
530
- * the scheme this function produces. Do not compare its results as strings to
531
- * tell whether two portable IRIs identify the same object; use
532
- * `arePortableUrisEqual()` instead.
533
- * @param iri The IRI to format.
534
- * @returns The formatted IRI. A string that cannot be parsed as a URL at all
535
- * is returned unchanged.
536
- * @throws {TypeError} If the IRI is a malformed portable IRI or FEP-ef61
537
- * compatible identifier, e.g., one with dot segments.
538
- * @since 2.4.0
539
- */
540
- declare function formatIri(iri: string | URL): string;
541
- /**
542
- * Canonicalizes a FEP-ef61 portable ActivityPub URI for comparison.
543
- *
544
- * This accepts both `ap:` and `ap+ef61:` URI strings with decoded or
545
- * percent-encoded DID authorities. The returned value uses the `ap+ef61:`
546
- * scheme, a decoded DID authority, and no query component. Pass the raw URI
547
- * string, not a `URL` object, because JavaScript `URL` normalizes opaque path
548
- * segments before Fedify can compare them.
549
- *
550
- * The `ap+ef61:` scheme of the result is a choice of Fedify's, whereas
551
- * FEP-ef61 currently canonicalizes portable URIs with the `ap:` scheme.
552
- * A future major version of Fedify may change the scheme of the result, so
553
- * do not persist the result as the only copy of an identifier; keep the
554
- * original URI, and canonicalize it again when comparing.
555
- *
556
- * @param input The raw portable ActivityPub URI string to canonicalize.
557
- * @returns The canonical portable ActivityPub URI string.
558
- * @throws {TypeError} If the input is not a valid portable ActivityPub IRI.
559
- * @since 2.4.0
560
- */
561
- declare function canonicalizePortableUri(input: string): string;
562
- /**
563
- * Checks whether two FEP-ef61 portable ActivityPub URIs identify the same
564
- * portable object.
565
- *
566
- * Non-string inputs return `false`. Non-portable URI strings use strict string
567
- * equality. Portable URI strings are compared through
568
- * {@link canonicalizePortableUri}; malformed portable URI strings return
569
- * `false` unless they are exactly equal.
570
- *
571
- * @since 2.4.0
572
- */
573
- declare function arePortableUrisEqual(left: string, right: string): boolean;
574
- /**
575
- * Computes an IRI's FEP-fe34 origin.
576
- *
577
- * HTTP(S) IRIs use their web origin. FEP-ef61 portable ActivityPub IRIs and
578
- * DID URLs use their DID as a cryptographic origin.
579
- *
580
- * @throws {TypeError} If the IRI does not have a supported FEP-fe34 origin.
581
- * @since 2.4.0
582
- */
583
- declare function getFe34Origin(input: string | URL): string;
584
- /**
585
- * Checks whether two IRIs have the same FEP-fe34 origin.
586
- *
587
- * Malformed or unsupported IRIs are treated as non-matching.
588
- *
589
- * @since 2.4.0
590
- */
591
- declare function haveSameFe34Origin(left: string | URL, right: string | URL): boolean;
592
- /**
593
- * Checks whether two IRIs have the same origin. Unlike comparing
594
- * `URL.origin`, which is `"null"` for URLs with non-special schemes, this
595
- * compares FEP-ef61 portable ActivityPub IRIs by their schemes and DIDs, so
596
- * that `ap:` and `ap+ef61:` IRIs of the same DID with decoded or
597
- * percent-encoded authorities have the same origin. Other IRIs with
598
- * a non-special scheme and a host are compared by their schemes and hosts.
599
- *
600
- * This is not an FEP-fe34 origin check: an `ap+ef61:` IRI and the `did:key`
601
- * verification method of the same DID have different origins here. Use
602
- * {@link haveSameFe34Origin} for that.
603
- * @param left The first IRI.
604
- * @param right The second IRI.
605
- * @returns `true` if the IRIs have the same origin.
606
- * @since 2.4.0
607
- */
608
- declare function haveSameIriOrigin(left: URL, right: URL): boolean;
609
- /**
610
- * Checks whether the URL is an FEP-ef61 gateway base URI, i.e., an HTTP(S)
611
- * URI with no credentials, path, query, or fragment, such as
612
- * `https://example.com/`. FEP-ef61 requires every item of a portable actor's
613
- * `gateways` to be such a URI. A URI with an empty query or fragment
614
- * delimiter, such as `https://example.com/?`, is not a gateway base URI.
615
- *
616
- * Note that the `URL` class normalizes `https://example.com` to
617
- * `https://example.com/`, so both are gateway base URIs.
618
- * @param url The URL to check.
619
- * @returns `true` if the URL is an FEP-ef61 gateway base URI.
620
- * @since 2.4.0
621
- */
622
- declare function isGatewayUrl(url: URL): boolean;
623
- /**
624
- * Parses and validates an FEP-ef61 gateway base URI, i.e., an HTTP(S) URI with
625
- * no credentials, path, query, or fragment, such as `https://example.com`.
626
- * See {@link isGatewayUrl} for the rules.
627
- * @param url The gateway base URI to parse.
628
- * @returns The parsed gateway base URI, whose path is `/`.
629
- * @throws {TypeError} If the URI is malformed, or is not an HTTP(S) base URI
630
- * with no credentials, path, query, or fragment. In the
631
- * latter case, the message starts with
632
- * `Invalid FEP-ef61 gateway:`.
633
- * @since 2.4.0
634
- */
635
- declare function parseGatewayUrl(url: string): URL;
636
- /**
637
- * Converts an [FEP-ef61] compatible identifier into a portable ActivityPub
638
- * URI.
639
- *
640
- * A compatible identifier is an HTTP(S) URL under a gateway's fixed
641
- * `/.well-known/apgateway/` path, such as
642
- * `https://server.example/.well-known/apgateway/did:key:z6Mk.../objects/1`.
643
- * This function removes the gateway part and returns the corresponding
644
- * portable URI, e.g., `ap+ef61://did:key:z6Mk.../objects/1`, in the same
645
- * internal `URL` form that {@link parseIri} produces. The path, query, and
646
- * fragment are preserved, so the result is a portable URI, not a comparison
647
- * form; pass its `href` to {@link canonicalizePortableUri} or
648
- * {@link arePortableUrisEqual} to compare it with other portable URIs.
649
- *
650
- * The conversion only reveals the *claimed* portable identifier. Anyone can
651
- * publish a compatible identifier for any DID on their own server, so the
652
- * gateway that served it is neither the object's origin nor authorized to act
653
- * for the DID. Callers must still verify the retrieved document's Object
654
- * Integrity Proof against the DID, as FEP-ef61 requires, and should keep the
655
- * original URL if they need the gateway as a retrieval hint.
656
- *
657
- * Arbitrary gateway paths are not supported.
658
- *
659
- * [FEP-ef61]: https://w3id.org/fep/ef61
660
- *
661
- * @param input The URL to convert.
662
- * @returns The portable ActivityPub URI, or `null` if the input is not an
663
- * HTTP(S) URL whose path starts with `/.well-known/apgateway/did:`.
664
- * Other gateway routes, such as the gateway discovery endpoint and
665
- * hashlink media URLs, also yield `null`.
666
- * @throws {TypeError} If the input looks like a compatible identifier but is
667
- * malformed, e.g., it has an invalid DID, no object path,
668
- * invalid percent-encoding, credentials, or location
669
- * hints (`@gateway` query parameters, or the legacy
670
- * `gateways` parameter), or its raw string path would
671
- * change during URL parsing. Already-parsed `URL`
672
- * arguments cannot reveal segments lost by their parser.
673
- * @since 2.4.0
674
- */
675
- declare function fromCompatibleEf61Id(input: string | URL): URL | null;
676
- /**
677
- * Converts a portable ActivityPub URI into an [FEP-ef61] compatible
678
- * identifier, which is an HTTP(S) URL under the gateway's fixed
679
- * `/.well-known/apgateway/` path.
680
- *
681
- * For example, `ap+ef61://did:key:z6Mk.../objects/1` and
682
- * `https://server.example` yield
683
- * `https://server.example/.well-known/apgateway/did:key:z6Mk.../objects/1`.
684
- * Both `ap:` and `ap+ef61:` URIs with decoded or percent-encoded DID
685
- * authorities are accepted. Publishers should use the first gateway in the
686
- * actor's `gateways` list, as FEP-ef61 requires.
687
- *
688
- * The path and fragment are preserved, with characters that are not allowed
689
- * in HTTP(S) URLs percent-encoded the same way as
690
- * {@link canonicalizePortableUri} does. FEP-ef61 location hints (`@gateway`
691
- * query parameters, and the legacy `gateways` parameter) are removed, since
692
- * compatible identifiers must not have them; other query parameters are kept
693
- * in order.
694
- *
695
- * Arbitrary gateway paths are not supported.
696
- *
697
- * [FEP-ef61]: https://w3id.org/fep/ef61
698
- *
699
- * @param portableId The `ap:` or `ap+ef61:` URI to convert.
700
- * @param gateway The gateway's HTTP(S) origin, e.g., `https://server.example`.
701
- * @returns The compatible identifier.
702
- * @throws {TypeError} If the portable ID is not a valid `ap:` or `ap+ef61:`
703
- * URI, if its path has `.` or `..` segments (which
704
- * HTTP(S) URLs cannot represent without changing the
705
- * identified object), or if the gateway is
706
- * not an HTTP(S) origin with no credentials, path, query,
707
- * or fragment.
708
- * @since 2.4.0
709
- */
710
- declare function toCompatibleEf61Id(portableId: string | URL, gateway: string | URL): URL;
711
- /**
712
- * Returns a copy of an [FEP-ef61] portable ActivityPub URI with `@gateway`
713
- * location hints for the given gateways, which tell consumers where they can
714
- * retrieve the object. Put hints on *references* to portable actors, e.g.,
715
- * in `actor`, `attributedTo`, `to`, or `cc`, when constructing an object, as
716
- * FEP-ef61 recommends:
717
- *
718
- * ~~~~ typescript
719
- * withGatewayHints("ap://did:key:z6Mk.../actor", [
720
- * "https://server1.example",
721
- * "https://server2.example",
722
- * ]);
723
- * // ap+ef61://did:key:z6Mk.../actor?@gateway=https%3A%2F%2Fserver1.example&@gateway=https%3A%2F%2Fserver2.example
724
- * ~~~~
725
- *
726
- * Do not put hints on an object's own `id`. Hints do not change the
727
- * identity of a portable URI, since FEP-ef61 drops the query when comparing
728
- * portable URIs, but implementations that do not canonicalize portable URIs
729
- * would take a hinted ID for another object. Add hints before signing the
730
- * object, since its Object Integrity Proof covers its references too.
731
- *
732
- * The hints that the URI already has, including the legacy `gateways`
733
- * parameter, are replaced. Each gateway becomes a `@gateway` query
734
- * parameter whose value is its URI-encoded origin, e.g.,
735
- * `@gateway=https%3A%2F%2Fserver1.example`, in the given order after the
736
- * other query parameters. Duplicate gateways are dropped, and an empty list
737
- * removes the hints as {@link withoutGatewayHints} does. The other query
738
- * parameters, their order, and the fragment are kept, but percent-encoding
739
- * is normalized the same way as {@link canonicalizePortableUri} does it.
740
- *
741
- * Fedify follows at most five hints when dereferencing a portable URI
742
- * (three for the key ID of an HTTP Signature), so list the preferred
743
- * gateways first; there is no limit on the number of hints added here.
744
- *
745
- * [FEP-ef61]: https://w3id.org/fep/ef61
746
- *
747
- * @param portableId The `ap:` or `ap+ef61:` URI. Pass the raw string rather
748
- * than a `URL` if its path may have `.` or `..` segments,
749
- * because the `URL` class resolves them.
750
- * @param gateways The gateways, e.g., the `gateways` of the actor that the
751
- * URI refers to. Each has to be an HTTP(S) origin with no
752
- * credentials, path, query, or fragment.
753
- * @returns The portable URI with the hints, in the same internal `URL` form
754
- * as {@link parseIri} returns. Use {@link formatIri} to get its
755
- * canonical string.
756
- * @throws {TypeError} If the portable ID is not a valid `ap:` or `ap+ef61:`
757
- * URI, e.g., it is a compatible identifier, which must
758
- * not have location hints; if its path has `.` or `..`
759
- * segments, which the `URL` class cannot represent; or
760
- * if a gateway is invalid.
761
- * @since 2.4.0
762
- */
763
- declare function withGatewayHints(portableId: string | URL, gateways: Iterable<string | URL>): URL;
764
- /**
765
- * Returns a copy of an [FEP-ef61] portable ActivityPub URI without its
766
- * location hints, i.e., `@gateway` query parameters and the legacy
767
- * `gateways` parameter. The other query parameters, their order, and the
768
- * fragment are kept, but percent-encoding is normalized the same way as
769
- * {@link canonicalizePortableUri} does it.
770
- *
771
- * [FEP-ef61]: https://w3id.org/fep/ef61
772
- *
773
- * @param portableId The `ap:` or `ap+ef61:` URI. Pass the raw string rather
774
- * than a `URL` if its path may have `.` or `..` segments,
775
- * because the `URL` class resolves them.
776
- * @returns The portable URI without the hints, in the same internal `URL`
777
- * form as {@link parseIri} returns.
778
- * @throws {TypeError} If the portable ID is not a valid `ap:` or `ap+ef61:`
779
- * URI, or if its path has `.` or `..` segments, which
780
- * the `URL` class cannot represent.
781
- * @since 2.4.0
782
- */
783
- declare function withoutGatewayHints(portableId: string | URL): URL;
784
- /**
785
- * Gets the gateways in the `@gateway` location hints of an [FEP-ef61]
786
- * portable ActivityPub URI, in order. Hints that are not valid gateways,
787
- * i.e., HTTP(S) origins with no credentials, path, query, or fragment, are
788
- * skipped, and so are duplicates. The legacy `gateways` parameter is not
789
- * read.
790
- *
791
- * Unlike Fedify's dereferencing, which follows at most five hints, this
792
- * returns all of them.
793
- *
794
- * [FEP-ef61]: https://w3id.org/fep/ef61
795
- *
796
- * @param portableId The `ap:` or `ap+ef61:` URI.
797
- * @returns The gateways, e.g., `https://server1.example/`.
798
- * @throws {TypeError} If the portable ID is not a valid `ap:` or `ap+ef61:`
799
- * URI.
800
- * @since 2.4.0
801
- */
802
- declare function getGatewayHints(portableId: string | URL): URL[];
803
- /**
804
- * Validates a URL to prevent SSRF attacks.
805
- */
806
- declare function validatePublicUrl(url: string): Promise<void>;
807
- declare function isValidPublicIPv4Address(address: string): boolean;
808
- declare function isValidPublicIPv6Address(address: string): boolean;
809
- declare function expandIPv6Address(address: string): string;
810
- //#endregion
811
478
  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, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, normalizeLanguageTag, parseDecimal, parseDidKeyVerificationMethod, parseDigestMultibase, parseGatewayUrl, parseHashlink, parseIri, parseJsonLdId, preloadedContexts, resolveDocumentLoaderTimeout, toCompatibleEf61Id, validatePublicUrl, verifyDigestMultibase, verifyHashlink, withDocumentLoaderTimeout, withGatewayHints, withoutGatewayHints };