@fedify/vocab-runtime 2.4.0-dev.1655 → 2.4.0-pr.934.40

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 (57) hide show
  1. package/deno.json +1 -1
  2. package/dist/{docloader-C_dir7Xb.d.ts → docloader-DnUMWHaJ.d.cts} +0 -2
  3. package/dist/{docloader-D2DTRiyA.d.cts → docloader-xRGn1azD.d.ts} +0 -2
  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/mod.cjs +8 -159
  9. package/dist/mod.d.cts +2 -91
  10. package/dist/mod.d.ts +2 -91
  11. package/dist/mod.js +9 -152
  12. package/dist/tests/decimal.test.cjs +5 -6
  13. package/dist/tests/decimal.test.mjs +5 -6
  14. package/dist/tests/{docloader-DVVWmXLI.cjs → docloader-BFedvemb.cjs} +6 -12
  15. package/dist/tests/{docloader-HbEvzi-t.mjs → docloader-Xi61Le8w.mjs} +6 -12
  16. package/dist/tests/docloader.test.cjs +3 -3
  17. package/dist/tests/docloader.test.mjs +3 -3
  18. package/dist/tests/jsonld-cache.test.cjs +1 -1
  19. package/dist/tests/jsonld-cache.test.mjs +1 -1
  20. package/dist/tests/{key-Drbw_2tw.mjs → key-CDGDH_vC.mjs} +1 -1
  21. package/dist/tests/{key-BcOWDLMm.cjs → key-_wXwomh_.cjs} +1 -1
  22. package/dist/tests/key.test.cjs +2 -2
  23. package/dist/tests/key.test.mjs +2 -2
  24. package/dist/tests/langstr.test.cjs +1 -1
  25. package/dist/tests/langstr.test.mjs +1 -1
  26. package/dist/tests/multibase/multibase.test.cjs +1 -1
  27. package/dist/tests/multibase/multibase.test.mjs +1 -1
  28. package/dist/tests/{multibase-Cluwl8OM.mjs → multibase-B4bvakyA.mjs} +1 -12
  29. package/dist/tests/{multibase-DcDQDNnI.cjs → multibase-Bz_UUDtL.cjs} +0 -17
  30. package/dist/tests/{request-B6s_F7bi.mjs → request-BOS-hNaf.mjs} +1 -1
  31. package/dist/tests/{request-DvEyU5Zf.cjs → request-cCPgOxYG.cjs} +1 -1
  32. package/dist/tests/request.test.cjs +1 -1
  33. package/dist/tests/request.test.mjs +1 -1
  34. package/dist/tests/{url-CsOV_B_P.cjs → url-BvjYQdxL.cjs} +0 -26
  35. package/dist/tests/{url-Du7RQQgP.mjs → url-a2D8NAgh.mjs} +1 -15
  36. package/dist/tests/url.test.cjs +1 -18
  37. package/dist/tests/url.test.mjs +1 -18
  38. package/dist/{url-DD4F0ULf.cjs → url-Ck3dGEwH.cjs} +0 -26
  39. package/dist/{url-DGVbSVVi.js → url-m1YxGNZ0.js} +1 -15
  40. package/package.json +1 -1
  41. package/src/contexts/security-data-integrity-v1.json +4 -0
  42. package/src/contexts.ts +0 -2
  43. package/src/docloader.ts +0 -2
  44. package/src/mod.ts +0 -12
  45. package/src/url.test.ts +0 -23
  46. package/src/url.ts +0 -23
  47. package/dist/tests/digest-BJlumPNJ.mjs +0 -140
  48. package/dist/tests/digest-DLwUyHCK.cjs +0 -175
  49. package/dist/tests/digest.test.cjs +0 -103
  50. package/dist/tests/digest.test.d.cts +0 -1
  51. package/dist/tests/digest.test.d.mts +0 -1
  52. package/dist/tests/digest.test.mjs +0 -103
  53. package/src/contexts/fep-ef61.json +0 -10
  54. package/src/digest.test.ts +0 -220
  55. package/src/digest.ts +0 -229
  56. /package/dist/tests/{langstr-BOQHfJDr.cjs → langstr-CbAxaeEZ.cjs} +0 -0
  57. /package/dist/tests/{langstr-DDLc4833.mjs → langstr-Di5AvKpB.mjs} +0 -0
package/deno.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab-runtime",
3
- "version": "2.4.0-dev.1655+b8f3c3d5",
3
+ "version": "2.4.0-pr.934.40+3331d302",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./src/mod.ts",
@@ -184,10 +184,8 @@ interface GetDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
184
184
  * - <https://www.w3.org/ns/activitystreams>
185
185
  * - <https://w3id.org/security/v1>
186
186
  * - <https://w3id.org/security/data-integrity/v1>
187
- * - <https://w3id.org/security/data-integrity/v2>
188
187
  * - <https://www.w3.org/ns/did/v1>
189
188
  * - <https://w3id.org/security/multikey/v1>
190
- * - <https://w3id.org/fep/ef61>
191
189
  * - <https://purl.archive.org/socialweb/webfinger>
192
190
  * - <http://schema.org/>
193
191
  * @param options Options for the document loader.
@@ -184,10 +184,8 @@ interface GetDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
184
184
  * - <https://www.w3.org/ns/activitystreams>
185
185
  * - <https://w3id.org/security/v1>
186
186
  * - <https://w3id.org/security/data-integrity/v1>
187
- * - <https://w3id.org/security/data-integrity/v2>
188
187
  * - <https://www.w3.org/ns/did/v1>
189
188
  * - <https://w3id.org/security/multikey/v1>
190
- * - <https://w3id.org/fep/ef61>
191
189
  * - <https://purl.archive.org/socialweb/webfinger>
192
190
  * - <http://schema.org/>
193
191
  * @param options Options for the document loader.
@@ -1,6 +1,6 @@
1
1
 
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const require_url = require("../url-DD4F0ULf.cjs");
3
+ const require_url = require("../url-Ck3dGEwH.cjs");
4
4
  const require_jsonld = require("../jsonld.cjs");
5
5
  //#region src/internal/jsonld-cache.ts
6
6
  const noJsonLdContext = Symbol("noJsonLdContext");
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { n as DocumentLoader } from "../docloader-D2DTRiyA.cjs";
2
+ import { n as DocumentLoader } from "../docloader-DnUMWHaJ.cjs";
3
3
 
4
4
  //#region src/internal/jsonld-cache.d.ts
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { n as DocumentLoader } from "../docloader-C_dir7Xb.js";
2
+ import { n as DocumentLoader } from "../docloader-xRGn1azD.js";
3
3
 
4
4
  //#region src/internal/jsonld-cache.d.ts
5
5
  /**
@@ -1,5 +1,5 @@
1
1
 
2
- import { a as formatIri, c as haveSameIriOrigin, s as haveSameFe34Origin } from "../url-DGVbSVVi.js";
2
+ import { a as formatIri, c as haveSameIriOrigin, s as haveSameFe34Origin } from "../url-m1YxGNZ0.js";
3
3
  import jsonld_default from "../jsonld.js";
4
4
  //#region src/internal/jsonld-cache.ts
5
5
  const noJsonLdContext = Symbol("noJsonLdContext");
package/dist/mod.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const require_chunk = require("./chunk-M78iaK0I.cjs");
4
- const require_url = require("./url-DD4F0ULf.cjs");
4
+ const require_url = require("./url-Ck3dGEwH.cjs");
5
5
  let _logtape_logtape = require("@logtape/logtape");
6
6
  let _opentelemetry_api = require("@opentelemetry/api");
7
7
  let node_process = require("node:process");
@@ -469,6 +469,10 @@ const preloadedContexts = {
469
469
  "id": "@id",
470
470
  "type": "@type",
471
471
  "@protected": true,
472
+ "digestMultibase": {
473
+ "@id": "https://w3id.org/security#digestMultibase",
474
+ "@type": "https://w3id.org/security#multibase"
475
+ },
472
476
  "proof": {
473
477
  "@id": "https://w3id.org/security#proof",
474
478
  "@type": "@id",
@@ -4305,14 +4309,6 @@ const preloadedContexts = {
4305
4309
  "@type": "@id"
4306
4310
  }
4307
4311
  } },
4308
- "https://w3id.org/fep/ef61": { "@context": {
4309
- "gateways": {
4310
- "@id": "https://w3id.org/fep/ef61/gateways",
4311
- "@type": "@id",
4312
- "@container": "@list"
4313
- },
4314
- "digestMultibase": "https://www.w3.org/ns/credentials/v2#digestMultibase"
4315
- } },
4316
4312
  "https://join-lemmy.org/context.json": { "@context": ["https://w3id.org/security/v1", {
4317
4313
  "as": "https://www.w3.org/ns/activitystreams#",
4318
4314
  "lemmy": "https://join-lemmy.org/ns#",
@@ -4371,7 +4367,7 @@ const preloadedContexts = {
4371
4367
  //#endregion
4372
4368
  //#region deno.json
4373
4369
  var name = "@fedify/vocab-runtime";
4374
- var version = "2.4.0-dev.1655+b8f3c3d5";
4370
+ var version = "2.4.0-pr.934.40+3331d302";
4375
4371
  //#endregion
4376
4372
  //#region src/link.ts
4377
4373
  const parametersNeedLowerCase = ["rel", "type"];
@@ -4802,10 +4798,8 @@ async function getRemoteDocument(url, response, fetch) {
4802
4798
  * - <https://www.w3.org/ns/activitystreams>
4803
4799
  * - <https://w3id.org/security/v1>
4804
4800
  * - <https://w3id.org/security/data-integrity/v1>
4805
- * - <https://w3id.org/security/data-integrity/v2>
4806
4801
  * - <https://www.w3.org/ns/did/v1>
4807
4802
  * - <https://w3id.org/security/multikey/v1>
4808
- * - <https://w3id.org/fep/ef61>
4809
4803
  * - <https://purl.archive.org/socialweb/webfinger>
4810
4804
  * - <http://schema.org/>
4811
4805
  * @param options Options for the document loader.
@@ -4936,8 +4930,8 @@ function validateCryptoKey(key, type) {
4936
4930
  }
4937
4931
  //#endregion
4938
4932
  //#region src/multibase/util.ts
4939
- const textDecoder$1 = new TextDecoder();
4940
- const decodeText = (bytes) => textDecoder$1.decode(bytes);
4933
+ const textDecoder = new TextDecoder();
4934
+ const decodeText = (bytes) => textDecoder.decode(bytes);
4941
4935
  const textEncoder = new TextEncoder();
4942
4936
  const encodeText = (text) => textEncoder.encode(text);
4943
4937
  function concat(arrs, length) {
@@ -5526,143 +5520,6 @@ function parseDecimal(value) {
5526
5520
  return normalized;
5527
5521
  }
5528
5522
  //#endregion
5529
- //#region src/digest.ts
5530
- const SHA2_256_MULTIHASH_CODE = 18;
5531
- const SHA2_256_DIGEST_LENGTH = 32;
5532
- const MAX_DIGEST_MULTIBASE_LENGTH = 1 + (SHA2_256_DIGEST_LENGTH + 2) * 8;
5533
- const textDecoder = new TextDecoder();
5534
- const getArrayBufferByteLength = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength")?.get;
5535
- function isCanonicalVarintPrefix(data, prefix) {
5536
- const canonical = addMulticodecPrefix(prefix.code, new Uint8Array());
5537
- if (canonical.length !== prefix.prefixLength) return false;
5538
- for (let i = 0; i < canonical.length; i++) if (data[i] !== canonical[i]) return false;
5539
- return true;
5540
- }
5541
- function toWebCryptoBytes(bytes) {
5542
- if (getArrayBufferByteLength != null) try {
5543
- getArrayBufferByteLength.call(bytes.buffer);
5544
- return bytes;
5545
- } catch {}
5546
- return new Uint8Array(bytes);
5547
- }
5548
- /**
5549
- * Computes the SHA-256 digest of a byte sequence and encodes it as a
5550
- * base58-btc multibase multihash suitable for FEP-ef61's
5551
- * `digestMultibase` property.
5552
- *
5553
- * @param bytes The bytes to digest.
5554
- * @returns The base58-btc multibase-encoded SHA-256 multihash.
5555
- * @since 2.4.0
5556
- */
5557
- async function computeDigestMultibase(bytes) {
5558
- const digest = new Uint8Array(await crypto.subtle.digest("SHA-256", toWebCryptoBytes(bytes)));
5559
- const multihash = addMulticodecPrefix(SHA2_256_MULTIHASH_CODE, addMulticodecPrefix(digest.length, digest));
5560
- return textDecoder.decode(encodeMultibase("base58btc", multihash));
5561
- }
5562
- /**
5563
- * Parses and validates a SHA-256 `digestMultibase` value.
5564
- *
5565
- * @param value The multibase-encoded multihash to parse.
5566
- * @returns The digest algorithm and raw digest bytes.
5567
- * @throws {TypeError} If the value is malformed or uses an unsupported hash
5568
- * algorithm.
5569
- * @since 2.4.0
5570
- */
5571
- function parseDigestMultibase(value) {
5572
- if (value.length > MAX_DIGEST_MULTIBASE_LENGTH) throw new TypeError("Invalid digestMultibase encoding.");
5573
- let multihash;
5574
- try {
5575
- multihash = decodeMultibase(value);
5576
- } catch (error) {
5577
- throw new TypeError("Invalid digestMultibase encoding.", { cause: error });
5578
- }
5579
- const encoding = encodingFromBaseData(value);
5580
- if (value !== textDecoder.decode(encodeMultibase(encoding.name, multihash))) throw new TypeError("Invalid digestMultibase encoding.");
5581
- let algorithmPrefix;
5582
- try {
5583
- algorithmPrefix = getMulticodecPrefix(multihash);
5584
- } catch (error) {
5585
- throw new TypeError("Invalid digestMultibase multihash.", { cause: error });
5586
- }
5587
- if (!isCanonicalVarintPrefix(multihash, algorithmPrefix)) throw new TypeError("Invalid digestMultibase multihash.");
5588
- if (algorithmPrefix.code !== SHA2_256_MULTIHASH_CODE) throw new TypeError(`Unsupported digest algorithm: 0x${algorithmPrefix.code.toString(16)}`);
5589
- const lengthAndDigest = multihash.subarray(algorithmPrefix.prefixLength);
5590
- let lengthPrefix;
5591
- try {
5592
- lengthPrefix = getMulticodecPrefix(lengthAndDigest);
5593
- } catch (error) {
5594
- throw new TypeError("Invalid digestMultibase multihash.", { cause: error });
5595
- }
5596
- if (!isCanonicalVarintPrefix(lengthAndDigest, lengthPrefix)) throw new TypeError("Invalid digestMultibase multihash.");
5597
- const digest = lengthAndDigest.slice(lengthPrefix.prefixLength);
5598
- if (lengthPrefix.code !== SHA2_256_DIGEST_LENGTH || digest.length !== SHA2_256_DIGEST_LENGTH) throw new TypeError("Invalid SHA-256 digest length.");
5599
- return {
5600
- algorithm: "sha2-256",
5601
- digest
5602
- };
5603
- }
5604
- function extractDigestMultibase(value) {
5605
- const hashlink = typeof value === "string" ? value : value.href;
5606
- const match = /^hl:([^:\r\n\u2028\u2029]+)$/i.exec(hashlink);
5607
- if (match == null || match[0].length !== hashlink.length) throw new TypeError("Invalid simple hashlink.");
5608
- return match[1];
5609
- }
5610
- /**
5611
- * Parses a metadata-free `hl:` hashlink and validates its resource digest.
5612
- *
5613
- * @param value The simple hashlink to parse.
5614
- * @returns The `digestMultibase` value carried by the hashlink.
5615
- * @throws {TypeError} If the hashlink is malformed, contains metadata, or
5616
- * carries an invalid or unsupported digest.
5617
- * @since 2.4.0
5618
- */
5619
- function parseHashlink(value) {
5620
- const digestMultibase = extractDigestMultibase(value);
5621
- parseDigestMultibase(digestMultibase);
5622
- return { digestMultibase };
5623
- }
5624
- /**
5625
- * Creates a metadata-free `hl:` hashlink from a `digestMultibase` value.
5626
- *
5627
- * @param digestMultibase The SHA-256 multibase multihash to embed.
5628
- * @returns The simple hashlink.
5629
- * @throws {TypeError} If the digest is malformed or unsupported.
5630
- * @since 2.4.0
5631
- */
5632
- function createHashlink(digestMultibase) {
5633
- parseDigestMultibase(digestMultibase);
5634
- return `hl:${digestMultibase}`;
5635
- }
5636
- /**
5637
- * Verifies that bytes match a SHA-256 `digestMultibase` value.
5638
- *
5639
- * @param bytes The bytes to verify.
5640
- * @param digestMultibase The expected digest.
5641
- * @returns Whether the bytes match the digest.
5642
- * @throws {TypeError} If the digest is malformed or unsupported.
5643
- * @since 2.4.0
5644
- */
5645
- async function verifyDigestMultibase(bytes, digestMultibase) {
5646
- const expected = parseDigestMultibase(digestMultibase).digest;
5647
- const actual = new Uint8Array(await crypto.subtle.digest("SHA-256", toWebCryptoBytes(bytes)));
5648
- if (expected.length !== actual.length) return false;
5649
- let difference = 0;
5650
- for (let i = 0; i < expected.length; i++) difference |= expected[i] ^ actual[i];
5651
- return difference === 0;
5652
- }
5653
- /**
5654
- * Verifies that bytes match the resource digest in a simple hashlink.
5655
- *
5656
- * @param bytes The bytes to verify.
5657
- * @param hashlink The simple hashlink containing the expected digest.
5658
- * @returns Whether the bytes match the hashlink digest.
5659
- * @throws {TypeError} If the hashlink or digest is malformed or unsupported.
5660
- * @since 2.4.0
5661
- */
5662
- async function verifyHashlink(bytes, hashlink) {
5663
- return await verifyDigestMultibase(bytes, extractDigestMultibase(hashlink));
5664
- }
5665
- //#endregion
5666
5523
  //#region src/langstr.ts
5667
5524
  /**
5668
5525
  * A language-tagged string which corresponds to the `rdf:langString` type.
@@ -5697,9 +5554,7 @@ exports.UrlError = require_url.UrlError;
5697
5554
  exports.arePortableUrisEqual = require_url.arePortableUrisEqual;
5698
5555
  exports.canParseDecimal = canParseDecimal;
5699
5556
  exports.canonicalizePortableUri = require_url.canonicalizePortableUri;
5700
- exports.computeDigestMultibase = computeDigestMultibase;
5701
5557
  exports.createActivityPubRequest = createActivityPubRequest;
5702
- exports.createHashlink = createHashlink;
5703
5558
  exports.decodeMultibase = decodeMultibase;
5704
5559
  exports.encodeMultibase = encodeMultibase;
5705
5560
  exports.encodingFromBaseData = encodingFromBaseData;
@@ -5720,18 +5575,12 @@ exports.importPem = importPem;
5720
5575
  exports.importPkcs1 = importPkcs1;
5721
5576
  exports.importSpki = importSpki;
5722
5577
  exports.isDecimal = isDecimal;
5723
- exports.isGatewayUrl = require_url.isGatewayUrl;
5724
5578
  exports.isValidPublicIPv4Address = require_url.isValidPublicIPv4Address;
5725
5579
  exports.isValidPublicIPv6Address = require_url.isValidPublicIPv6Address;
5726
5580
  exports.logRequest = logRequest;
5727
5581
  exports.parseDecimal = parseDecimal;
5728
5582
  exports.parseDidKeyVerificationMethod = parseDidKeyVerificationMethod;
5729
- exports.parseDigestMultibase = parseDigestMultibase;
5730
- exports.parseGatewayUrl = require_url.parseGatewayUrl;
5731
- exports.parseHashlink = parseHashlink;
5732
5583
  exports.parseIri = require_url.parseIri;
5733
5584
  exports.parseJsonLdId = require_url.parseJsonLdId;
5734
5585
  exports.preloadedContexts = preloadedContexts;
5735
5586
  exports.validatePublicUrl = require_url.validatePublicUrl;
5736
- exports.verifyDigestMultibase = verifyDigestMultibase;
5737
- exports.verifyHashlink = verifyHashlink;
package/dist/mod.d.cts CHANGED
@@ -1,5 +1,5 @@
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-D2DTRiyA.cjs";
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";
3
3
  import { TracerProvider } from "@opentelemetry/api";
4
4
 
5
5
  //#region src/contexts.d.ts
@@ -204,87 +204,6 @@ declare function canParseDecimal(value: string): boolean;
204
204
  */
205
205
  declare function parseDecimal(value: string): Decimal;
206
206
  //#endregion
207
- //#region src/digest.d.ts
208
- /**
209
- * A parsed SHA-256 resource digest.
210
- *
211
- * @since 2.4.0
212
- */
213
- interface ParsedDigestMultibase {
214
- /** The multihash algorithm represented by the digest. */
215
- readonly algorithm: "sha2-256";
216
- /** The raw 32-byte SHA-256 digest. */
217
- readonly digest: Uint8Array;
218
- }
219
- /**
220
- * A parsed simple hashlink.
221
- *
222
- * @since 2.4.0
223
- */
224
- interface ParsedHashlink {
225
- /** The multibase-encoded multihash carried by the hashlink. */
226
- readonly digestMultibase: string;
227
- }
228
- /**
229
- * Computes the SHA-256 digest of a byte sequence and encodes it as a
230
- * base58-btc multibase multihash suitable for FEP-ef61's
231
- * `digestMultibase` property.
232
- *
233
- * @param bytes The bytes to digest.
234
- * @returns The base58-btc multibase-encoded SHA-256 multihash.
235
- * @since 2.4.0
236
- */
237
- declare function computeDigestMultibase(bytes: Uint8Array): Promise<string>;
238
- /**
239
- * Parses and validates a SHA-256 `digestMultibase` value.
240
- *
241
- * @param value The multibase-encoded multihash to parse.
242
- * @returns The digest algorithm and raw digest bytes.
243
- * @throws {TypeError} If the value is malformed or uses an unsupported hash
244
- * algorithm.
245
- * @since 2.4.0
246
- */
247
- declare function parseDigestMultibase(value: string): ParsedDigestMultibase;
248
- /**
249
- * Parses a metadata-free `hl:` hashlink and validates its resource digest.
250
- *
251
- * @param value The simple hashlink to parse.
252
- * @returns The `digestMultibase` value carried by the hashlink.
253
- * @throws {TypeError} If the hashlink is malformed, contains metadata, or
254
- * carries an invalid or unsupported digest.
255
- * @since 2.4.0
256
- */
257
- declare function parseHashlink(value: string | URL): ParsedHashlink;
258
- /**
259
- * Creates a metadata-free `hl:` hashlink from a `digestMultibase` value.
260
- *
261
- * @param digestMultibase The SHA-256 multibase multihash to embed.
262
- * @returns The simple hashlink.
263
- * @throws {TypeError} If the digest is malformed or unsupported.
264
- * @since 2.4.0
265
- */
266
- declare function createHashlink(digestMultibase: string): string;
267
- /**
268
- * Verifies that bytes match a SHA-256 `digestMultibase` value.
269
- *
270
- * @param bytes The bytes to verify.
271
- * @param digestMultibase The expected digest.
272
- * @returns Whether the bytes match the digest.
273
- * @throws {TypeError} If the digest is malformed or unsupported.
274
- * @since 2.4.0
275
- */
276
- declare function verifyDigestMultibase(bytes: Uint8Array, digestMultibase: string): Promise<boolean>;
277
- /**
278
- * Verifies that bytes match the resource digest in a simple hashlink.
279
- *
280
- * @param bytes The bytes to verify.
281
- * @param hashlink The simple hashlink containing the expected digest.
282
- * @returns Whether the bytes match the hashlink digest.
283
- * @throws {TypeError} If the hashlink or digest is malformed or unsupported.
284
- * @since 2.4.0
285
- */
286
- declare function verifyHashlink(bytes: Uint8Array, hashlink: string | URL): Promise<boolean>;
287
- //#endregion
288
207
  //#region src/langstr.d.ts
289
208
  /**
290
209
  * A language-tagged string which corresponds to the `rdf:langString` type.
@@ -456,14 +375,6 @@ declare function haveSameFe34Origin(left: string | URL, right: string | URL): bo
456
375
  */
457
376
  declare function haveSameIriOrigin(left: URL, right: URL): boolean;
458
377
  /**
459
- * Checks whether the URL is an FEP-ef61 gateway base URI.
460
- */
461
- declare function isGatewayUrl(url: URL): boolean;
462
- /**
463
- * Parses and validates an FEP-ef61 gateway base URI.
464
- */
465
- declare function parseGatewayUrl(url: string): URL;
466
- /**
467
378
  * Validates a URL to prevent SSRF attacks.
468
379
  */
469
380
  declare function validatePublicUrl(url: string): Promise<void>;
@@ -471,4 +382,4 @@ declare function isValidPublicIPv4Address(address: string): boolean;
471
382
  declare function isValidPublicIPv6Address(address: string): boolean;
472
383
  declare function expandIPv6Address(address: string): string;
473
384
  //#endregion
474
- 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 ParsedDigestMultibase, type ParsedHashlink, type PropertyPreprocessor, type PropertyPreprocessorContext, type RemoteDocument, UrlError, arePortableUrisEqual, canParseDecimal, canonicalizePortableUri, computeDigestMultibase, createActivityPubRequest, createHashlink, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportDidKey, exportMultibaseKey, exportSpki, formatIri, getDocumentLoader, getFe34Origin, getRemoteDocument, getUserAgent, haveSameFe34Origin, haveSameIriOrigin, importDidKey, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isGatewayUrl, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, parseDidKeyVerificationMethod, parseDigestMultibase, parseGatewayUrl, parseHashlink, parseIri, parseJsonLdId, preloadedContexts, validatePublicUrl, verifyDigestMultibase, verifyHashlink };
385
+ 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, arePortableUrisEqual, canParseDecimal, canonicalizePortableUri, createActivityPubRequest, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportDidKey, exportMultibaseKey, exportSpki, formatIri, getDocumentLoader, getFe34Origin, getRemoteDocument, getUserAgent, haveSameFe34Origin, haveSameIriOrigin, importDidKey, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, parseDidKeyVerificationMethod, parseIri, parseJsonLdId, preloadedContexts, validatePublicUrl };
package/dist/mod.d.ts CHANGED
@@ -1,5 +1,5 @@
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-C_dir7Xb.js";
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";
3
3
  import { TracerProvider } from "@opentelemetry/api";
4
4
 
5
5
  //#region src/contexts.d.ts
@@ -204,87 +204,6 @@ declare function canParseDecimal(value: string): boolean;
204
204
  */
205
205
  declare function parseDecimal(value: string): Decimal;
206
206
  //#endregion
207
- //#region src/digest.d.ts
208
- /**
209
- * A parsed SHA-256 resource digest.
210
- *
211
- * @since 2.4.0
212
- */
213
- interface ParsedDigestMultibase {
214
- /** The multihash algorithm represented by the digest. */
215
- readonly algorithm: "sha2-256";
216
- /** The raw 32-byte SHA-256 digest. */
217
- readonly digest: Uint8Array;
218
- }
219
- /**
220
- * A parsed simple hashlink.
221
- *
222
- * @since 2.4.0
223
- */
224
- interface ParsedHashlink {
225
- /** The multibase-encoded multihash carried by the hashlink. */
226
- readonly digestMultibase: string;
227
- }
228
- /**
229
- * Computes the SHA-256 digest of a byte sequence and encodes it as a
230
- * base58-btc multibase multihash suitable for FEP-ef61's
231
- * `digestMultibase` property.
232
- *
233
- * @param bytes The bytes to digest.
234
- * @returns The base58-btc multibase-encoded SHA-256 multihash.
235
- * @since 2.4.0
236
- */
237
- declare function computeDigestMultibase(bytes: Uint8Array): Promise<string>;
238
- /**
239
- * Parses and validates a SHA-256 `digestMultibase` value.
240
- *
241
- * @param value The multibase-encoded multihash to parse.
242
- * @returns The digest algorithm and raw digest bytes.
243
- * @throws {TypeError} If the value is malformed or uses an unsupported hash
244
- * algorithm.
245
- * @since 2.4.0
246
- */
247
- declare function parseDigestMultibase(value: string): ParsedDigestMultibase;
248
- /**
249
- * Parses a metadata-free `hl:` hashlink and validates its resource digest.
250
- *
251
- * @param value The simple hashlink to parse.
252
- * @returns The `digestMultibase` value carried by the hashlink.
253
- * @throws {TypeError} If the hashlink is malformed, contains metadata, or
254
- * carries an invalid or unsupported digest.
255
- * @since 2.4.0
256
- */
257
- declare function parseHashlink(value: string | URL): ParsedHashlink;
258
- /**
259
- * Creates a metadata-free `hl:` hashlink from a `digestMultibase` value.
260
- *
261
- * @param digestMultibase The SHA-256 multibase multihash to embed.
262
- * @returns The simple hashlink.
263
- * @throws {TypeError} If the digest is malformed or unsupported.
264
- * @since 2.4.0
265
- */
266
- declare function createHashlink(digestMultibase: string): string;
267
- /**
268
- * Verifies that bytes match a SHA-256 `digestMultibase` value.
269
- *
270
- * @param bytes The bytes to verify.
271
- * @param digestMultibase The expected digest.
272
- * @returns Whether the bytes match the digest.
273
- * @throws {TypeError} If the digest is malformed or unsupported.
274
- * @since 2.4.0
275
- */
276
- declare function verifyDigestMultibase(bytes: Uint8Array, digestMultibase: string): Promise<boolean>;
277
- /**
278
- * Verifies that bytes match the resource digest in a simple hashlink.
279
- *
280
- * @param bytes The bytes to verify.
281
- * @param hashlink The simple hashlink containing the expected digest.
282
- * @returns Whether the bytes match the hashlink digest.
283
- * @throws {TypeError} If the hashlink or digest is malformed or unsupported.
284
- * @since 2.4.0
285
- */
286
- declare function verifyHashlink(bytes: Uint8Array, hashlink: string | URL): Promise<boolean>;
287
- //#endregion
288
207
  //#region src/langstr.d.ts
289
208
  /**
290
209
  * A language-tagged string which corresponds to the `rdf:langString` type.
@@ -456,14 +375,6 @@ declare function haveSameFe34Origin(left: string | URL, right: string | URL): bo
456
375
  */
457
376
  declare function haveSameIriOrigin(left: URL, right: URL): boolean;
458
377
  /**
459
- * Checks whether the URL is an FEP-ef61 gateway base URI.
460
- */
461
- declare function isGatewayUrl(url: URL): boolean;
462
- /**
463
- * Parses and validates an FEP-ef61 gateway base URI.
464
- */
465
- declare function parseGatewayUrl(url: string): URL;
466
- /**
467
378
  * Validates a URL to prevent SSRF attacks.
468
379
  */
469
380
  declare function validatePublicUrl(url: string): Promise<void>;
@@ -471,4 +382,4 @@ declare function isValidPublicIPv4Address(address: string): boolean;
471
382
  declare function isValidPublicIPv6Address(address: string): boolean;
472
383
  declare function expandIPv6Address(address: string): string;
473
384
  //#endregion
474
- 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 ParsedDigestMultibase, type ParsedHashlink, type PropertyPreprocessor, type PropertyPreprocessorContext, type RemoteDocument, UrlError, arePortableUrisEqual, canParseDecimal, canonicalizePortableUri, computeDigestMultibase, createActivityPubRequest, createHashlink, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportDidKey, exportMultibaseKey, exportSpki, formatIri, getDocumentLoader, getFe34Origin, getRemoteDocument, getUserAgent, haveSameFe34Origin, haveSameIriOrigin, importDidKey, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isGatewayUrl, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, parseDidKeyVerificationMethod, parseDigestMultibase, parseGatewayUrl, parseHashlink, parseIri, parseJsonLdId, preloadedContexts, validatePublicUrl, verifyDigestMultibase, verifyHashlink };
385
+ 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, arePortableUrisEqual, canParseDecimal, canonicalizePortableUri, createActivityPubRequest, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportDidKey, exportMultibaseKey, exportSpki, formatIri, getDocumentLoader, getFe34Origin, getRemoteDocument, getUserAgent, haveSameFe34Origin, haveSameIriOrigin, importDidKey, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, parseDidKeyVerificationMethod, parseIri, parseJsonLdId, preloadedContexts, validatePublicUrl };