@fedify/vocab-runtime 2.4.0-dev.1618 → 2.4.0-dev.1634
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.
- package/deno.json +1 -1
- package/dist/{docloader-DnUMWHaJ.d.cts → docloader-C_dir7Xb.d.ts} +2 -0
- package/dist/{docloader-xRGn1azD.d.ts → docloader-D2DTRiyA.d.cts} +2 -0
- package/dist/internal/jsonld-cache.cjs +1 -1
- package/dist/internal/jsonld-cache.d.cts +1 -1
- package/dist/internal/jsonld-cache.d.ts +1 -1
- package/dist/internal/jsonld-cache.js +1 -1
- package/dist/mod.cjs +14 -6
- package/dist/mod.d.cts +10 -2
- package/dist/mod.d.ts +10 -2
- package/dist/mod.js +13 -7
- package/dist/tests/decimal.test.cjs +2 -2
- package/dist/tests/decimal.test.mjs +2 -2
- package/dist/tests/{docloader-CBVde8Va.mjs → docloader-CNzoXrLM.mjs} +12 -6
- package/dist/tests/{docloader-QmR6VOqT.cjs → docloader-CTd4XwqK.cjs} +12 -6
- package/dist/tests/docloader.test.cjs +3 -3
- package/dist/tests/docloader.test.mjs +3 -3
- package/dist/tests/jsonld-cache.test.cjs +1 -1
- package/dist/tests/jsonld-cache.test.mjs +1 -1
- package/dist/tests/{request-BHx0fCb5.mjs → request-BWDludWb.mjs} +1 -1
- package/dist/tests/{request-DxSceLvB.cjs → request-Zpjq9m-W.cjs} +1 -1
- package/dist/tests/request.test.cjs +1 -1
- package/dist/tests/request.test.mjs +1 -1
- package/dist/tests/{url-BvjYQdxL.cjs → url-CsOV_B_P.cjs} +26 -0
- package/dist/tests/{url-a2D8NAgh.mjs → url-Du7RQQgP.mjs} +15 -1
- package/dist/tests/url.test.cjs +18 -1
- package/dist/tests/url.test.mjs +18 -1
- package/dist/{url-Ck3dGEwH.cjs → url-DD4F0ULf.cjs} +26 -0
- package/dist/{url-m1YxGNZ0.js → url-DGVbSVVi.js} +15 -1
- package/package.json +1 -1
- package/src/contexts/fep-ef61.json +10 -0
- package/src/contexts/security-data-integrity-v1.json +0 -4
- package/src/contexts.ts +2 -0
- package/src/docloader.ts +2 -0
- package/src/mod.ts +2 -0
- package/src/url.test.ts +23 -0
- package/src/url.ts +23 -0
package/deno.json
CHANGED
|
@@ -184,8 +184,10 @@ 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>
|
|
187
188
|
* - <https://www.w3.org/ns/did/v1>
|
|
188
189
|
* - <https://w3id.org/security/multikey/v1>
|
|
190
|
+
* - <https://w3id.org/fep/ef61>
|
|
189
191
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
190
192
|
* - <http://schema.org/>
|
|
191
193
|
* @param options Options for the document loader.
|
|
@@ -184,8 +184,10 @@ 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>
|
|
187
188
|
* - <https://www.w3.org/ns/did/v1>
|
|
188
189
|
* - <https://w3id.org/security/multikey/v1>
|
|
190
|
+
* - <https://w3id.org/fep/ef61>
|
|
189
191
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
190
192
|
* - <http://schema.org/>
|
|
191
193
|
* @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-
|
|
3
|
+
const require_url = require("../url-DD4F0ULf.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
|
|
|
2
|
-
import { a as formatIri, c as haveSameIriOrigin, s as haveSameFe34Origin } from "../url-
|
|
2
|
+
import { a as formatIri, c as haveSameIriOrigin, s as haveSameFe34Origin } from "../url-DGVbSVVi.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-
|
|
4
|
+
const require_url = require("./url-DD4F0ULf.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,10 +469,6 @@ 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
|
-
},
|
|
476
472
|
"proof": {
|
|
477
473
|
"@id": "https://w3id.org/security#proof",
|
|
478
474
|
"@type": "@id",
|
|
@@ -4309,6 +4305,14 @@ const preloadedContexts = {
|
|
|
4309
4305
|
"@type": "@id"
|
|
4310
4306
|
}
|
|
4311
4307
|
} },
|
|
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
|
+
} },
|
|
4312
4316
|
"https://join-lemmy.org/context.json": { "@context": ["https://w3id.org/security/v1", {
|
|
4313
4317
|
"as": "https://www.w3.org/ns/activitystreams#",
|
|
4314
4318
|
"lemmy": "https://join-lemmy.org/ns#",
|
|
@@ -4367,7 +4371,7 @@ const preloadedContexts = {
|
|
|
4367
4371
|
//#endregion
|
|
4368
4372
|
//#region deno.json
|
|
4369
4373
|
var name = "@fedify/vocab-runtime";
|
|
4370
|
-
var version = "2.4.0-dev.
|
|
4374
|
+
var version = "2.4.0-dev.1634+3b4bfbb6";
|
|
4371
4375
|
//#endregion
|
|
4372
4376
|
//#region src/link.ts
|
|
4373
4377
|
const parametersNeedLowerCase = ["rel", "type"];
|
|
@@ -4798,8 +4802,10 @@ async function getRemoteDocument(url, response, fetch) {
|
|
|
4798
4802
|
* - <https://www.w3.org/ns/activitystreams>
|
|
4799
4803
|
* - <https://w3id.org/security/v1>
|
|
4800
4804
|
* - <https://w3id.org/security/data-integrity/v1>
|
|
4805
|
+
* - <https://w3id.org/security/data-integrity/v2>
|
|
4801
4806
|
* - <https://www.w3.org/ns/did/v1>
|
|
4802
4807
|
* - <https://w3id.org/security/multikey/v1>
|
|
4808
|
+
* - <https://w3id.org/fep/ef61>
|
|
4803
4809
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
4804
4810
|
* - <http://schema.org/>
|
|
4805
4811
|
* @param options Options for the document loader.
|
|
@@ -5575,11 +5581,13 @@ exports.importPem = importPem;
|
|
|
5575
5581
|
exports.importPkcs1 = importPkcs1;
|
|
5576
5582
|
exports.importSpki = importSpki;
|
|
5577
5583
|
exports.isDecimal = isDecimal;
|
|
5584
|
+
exports.isGatewayUrl = require_url.isGatewayUrl;
|
|
5578
5585
|
exports.isValidPublicIPv4Address = require_url.isValidPublicIPv4Address;
|
|
5579
5586
|
exports.isValidPublicIPv6Address = require_url.isValidPublicIPv6Address;
|
|
5580
5587
|
exports.logRequest = logRequest;
|
|
5581
5588
|
exports.parseDecimal = parseDecimal;
|
|
5582
5589
|
exports.parseDidKeyVerificationMethod = parseDidKeyVerificationMethod;
|
|
5590
|
+
exports.parseGatewayUrl = require_url.parseGatewayUrl;
|
|
5583
5591
|
exports.parseIri = require_url.parseIri;
|
|
5584
5592
|
exports.parseJsonLdId = require_url.parseJsonLdId;
|
|
5585
5593
|
exports.preloadedContexts = preloadedContexts;
|
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-
|
|
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";
|
|
3
3
|
import { TracerProvider } from "@opentelemetry/api";
|
|
4
4
|
|
|
5
5
|
//#region src/contexts.d.ts
|
|
@@ -375,6 +375,14 @@ declare function haveSameFe34Origin(left: string | URL, right: string | URL): bo
|
|
|
375
375
|
*/
|
|
376
376
|
declare function haveSameIriOrigin(left: URL, right: URL): boolean;
|
|
377
377
|
/**
|
|
378
|
+
* Checks whether the URL is an FEP-ef61 gateway base URI.
|
|
379
|
+
*/
|
|
380
|
+
declare function isGatewayUrl(url: URL): boolean;
|
|
381
|
+
/**
|
|
382
|
+
* Parses and validates an FEP-ef61 gateway base URI.
|
|
383
|
+
*/
|
|
384
|
+
declare function parseGatewayUrl(url: string): URL;
|
|
385
|
+
/**
|
|
378
386
|
* Validates a URL to prevent SSRF attacks.
|
|
379
387
|
*/
|
|
380
388
|
declare function validatePublicUrl(url: string): Promise<void>;
|
|
@@ -382,4 +390,4 @@ declare function isValidPublicIPv4Address(address: string): boolean;
|
|
|
382
390
|
declare function isValidPublicIPv6Address(address: string): boolean;
|
|
383
391
|
declare function expandIPv6Address(address: string): string;
|
|
384
392
|
//#endregion
|
|
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 };
|
|
393
|
+
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, isGatewayUrl, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, parseDidKeyVerificationMethod, parseGatewayUrl, 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-
|
|
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";
|
|
3
3
|
import { TracerProvider } from "@opentelemetry/api";
|
|
4
4
|
|
|
5
5
|
//#region src/contexts.d.ts
|
|
@@ -375,6 +375,14 @@ declare function haveSameFe34Origin(left: string | URL, right: string | URL): bo
|
|
|
375
375
|
*/
|
|
376
376
|
declare function haveSameIriOrigin(left: URL, right: URL): boolean;
|
|
377
377
|
/**
|
|
378
|
+
* Checks whether the URL is an FEP-ef61 gateway base URI.
|
|
379
|
+
*/
|
|
380
|
+
declare function isGatewayUrl(url: URL): boolean;
|
|
381
|
+
/**
|
|
382
|
+
* Parses and validates an FEP-ef61 gateway base URI.
|
|
383
|
+
*/
|
|
384
|
+
declare function parseGatewayUrl(url: string): URL;
|
|
385
|
+
/**
|
|
378
386
|
* Validates a URL to prevent SSRF attacks.
|
|
379
387
|
*/
|
|
380
388
|
declare function validatePublicUrl(url: string): Promise<void>;
|
|
@@ -382,4 +390,4 @@ declare function isValidPublicIPv4Address(address: string): boolean;
|
|
|
382
390
|
declare function isValidPublicIPv6Address(address: string): boolean;
|
|
383
391
|
declare function expandIPv6Address(address: string): string;
|
|
384
392
|
//#endregion
|
|
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 };
|
|
393
|
+
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, isGatewayUrl, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, parseDidKeyVerificationMethod, parseGatewayUrl, parseIri, parseJsonLdId, preloadedContexts, validatePublicUrl };
|
package/dist/mod.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { a as formatIri, c as haveSameIriOrigin, d as
|
|
2
|
+
import { a as formatIri, c as haveSameIriOrigin, d as isValidPublicIPv6Address, f as parseGatewayUrl, h as validatePublicUrl, i as expandIPv6Address, l as isGatewayUrl, m as parseJsonLdId, n as arePortableUrisEqual, o as getFe34Origin, p as parseIri, r as canonicalizePortableUri, s as haveSameFe34Origin, t as UrlError, u as isValidPublicIPv4Address } from "./url-DGVbSVVi.js";
|
|
3
3
|
import { getLogger } from "@logtape/logtape";
|
|
4
4
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
5
5
|
import process from "node:process";
|
|
@@ -465,10 +465,6 @@ const preloadedContexts = {
|
|
|
465
465
|
"id": "@id",
|
|
466
466
|
"type": "@type",
|
|
467
467
|
"@protected": true,
|
|
468
|
-
"digestMultibase": {
|
|
469
|
-
"@id": "https://w3id.org/security#digestMultibase",
|
|
470
|
-
"@type": "https://w3id.org/security#multibase"
|
|
471
|
-
},
|
|
472
468
|
"proof": {
|
|
473
469
|
"@id": "https://w3id.org/security#proof",
|
|
474
470
|
"@type": "@id",
|
|
@@ -4305,6 +4301,14 @@ const preloadedContexts = {
|
|
|
4305
4301
|
"@type": "@id"
|
|
4306
4302
|
}
|
|
4307
4303
|
} },
|
|
4304
|
+
"https://w3id.org/fep/ef61": { "@context": {
|
|
4305
|
+
"gateways": {
|
|
4306
|
+
"@id": "https://w3id.org/fep/ef61/gateways",
|
|
4307
|
+
"@type": "@id",
|
|
4308
|
+
"@container": "@list"
|
|
4309
|
+
},
|
|
4310
|
+
"digestMultibase": "https://www.w3.org/ns/credentials/v2#digestMultibase"
|
|
4311
|
+
} },
|
|
4308
4312
|
"https://join-lemmy.org/context.json": { "@context": ["https://w3id.org/security/v1", {
|
|
4309
4313
|
"as": "https://www.w3.org/ns/activitystreams#",
|
|
4310
4314
|
"lemmy": "https://join-lemmy.org/ns#",
|
|
@@ -4363,7 +4367,7 @@ const preloadedContexts = {
|
|
|
4363
4367
|
//#endregion
|
|
4364
4368
|
//#region deno.json
|
|
4365
4369
|
var name = "@fedify/vocab-runtime";
|
|
4366
|
-
var version = "2.4.0-dev.
|
|
4370
|
+
var version = "2.4.0-dev.1634+3b4bfbb6";
|
|
4367
4371
|
//#endregion
|
|
4368
4372
|
//#region src/link.ts
|
|
4369
4373
|
const parametersNeedLowerCase = ["rel", "type"];
|
|
@@ -4794,8 +4798,10 @@ async function getRemoteDocument(url, response, fetch) {
|
|
|
4794
4798
|
* - <https://www.w3.org/ns/activitystreams>
|
|
4795
4799
|
* - <https://w3id.org/security/v1>
|
|
4796
4800
|
* - <https://w3id.org/security/data-integrity/v1>
|
|
4801
|
+
* - <https://w3id.org/security/data-integrity/v2>
|
|
4797
4802
|
* - <https://www.w3.org/ns/did/v1>
|
|
4798
4803
|
* - <https://w3id.org/security/multikey/v1>
|
|
4804
|
+
* - <https://w3id.org/fep/ef61>
|
|
4799
4805
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
4800
4806
|
* - <http://schema.org/>
|
|
4801
4807
|
* @param options Options for the document loader.
|
|
@@ -5544,4 +5550,4 @@ LanguageString.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_d
|
|
|
5544
5550
|
return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
|
|
5545
5551
|
};
|
|
5546
5552
|
//#endregion
|
|
5547
|
-
export { FetchError, LanguageString, 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 };
|
|
5553
|
+
export { FetchError, LanguageString, 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, isGatewayUrl, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, parseDidKeyVerificationMethod, parseGatewayUrl, parseIri, parseJsonLdId, preloadedContexts, validatePublicUrl };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require("./chunk-C2EiDwsr.cjs");
|
|
2
|
-
require("./docloader-
|
|
3
|
-
require("./url-
|
|
2
|
+
require("./docloader-CTd4XwqK.cjs");
|
|
3
|
+
require("./url-CsOV_B_P.cjs");
|
|
4
4
|
require("./key-_wXwomh_.cjs");
|
|
5
5
|
require("./multibase-Bz_UUDtL.cjs");
|
|
6
6
|
require("./langstr-CbAxaeEZ.cjs");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as name, i as logRequest, n as createActivityPubRequest, o as version, t as FetchError } from "./request-
|
|
1
|
+
import { a as name, i as logRequest, n as createActivityPubRequest, o as version, t as FetchError } from "./request-BWDludWb.mjs";
|
|
2
2
|
import { t as HttpHeaderLink } from "./link-NUUWCdnK.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { h as validatePublicUrl, t as UrlError } from "./url-Du7RQQgP.mjs";
|
|
4
4
|
import { getLogger } from "@logtape/logtape";
|
|
5
5
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
6
6
|
//#endregion
|
|
@@ -459,10 +459,6 @@ const preloadedContexts = {
|
|
|
459
459
|
"id": "@id",
|
|
460
460
|
"type": "@type",
|
|
461
461
|
"@protected": true,
|
|
462
|
-
"digestMultibase": {
|
|
463
|
-
"@id": "https://w3id.org/security#digestMultibase",
|
|
464
|
-
"@type": "https://w3id.org/security#multibase"
|
|
465
|
-
},
|
|
466
462
|
"proof": {
|
|
467
463
|
"@id": "https://w3id.org/security#proof",
|
|
468
464
|
"@type": "@id",
|
|
@@ -4299,6 +4295,14 @@ const preloadedContexts = {
|
|
|
4299
4295
|
"@type": "@id"
|
|
4300
4296
|
}
|
|
4301
4297
|
} },
|
|
4298
|
+
"https://w3id.org/fep/ef61": { "@context": {
|
|
4299
|
+
"gateways": {
|
|
4300
|
+
"@id": "https://w3id.org/fep/ef61/gateways",
|
|
4301
|
+
"@type": "@id",
|
|
4302
|
+
"@container": "@list"
|
|
4303
|
+
},
|
|
4304
|
+
"digestMultibase": "https://www.w3.org/ns/credentials/v2#digestMultibase"
|
|
4305
|
+
} },
|
|
4302
4306
|
"https://join-lemmy.org/context.json": { "@context": ["https://w3id.org/security/v1", {
|
|
4303
4307
|
"as": "https://www.w3.org/ns/activitystreams#",
|
|
4304
4308
|
"lemmy": "https://join-lemmy.org/ns#",
|
|
@@ -4533,8 +4537,10 @@ async function getRemoteDocument(url, response, fetch) {
|
|
|
4533
4537
|
* - <https://www.w3.org/ns/activitystreams>
|
|
4534
4538
|
* - <https://w3id.org/security/v1>
|
|
4535
4539
|
* - <https://w3id.org/security/data-integrity/v1>
|
|
4540
|
+
* - <https://w3id.org/security/data-integrity/v2>
|
|
4536
4541
|
* - <https://www.w3.org/ns/did/v1>
|
|
4537
4542
|
* - <https://w3id.org/security/multikey/v1>
|
|
4543
|
+
* - <https://w3id.org/fep/ef61>
|
|
4538
4544
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
4539
4545
|
* - <http://schema.org/>
|
|
4540
4546
|
* @param options Options for the document loader.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require("./chunk-C2EiDwsr.cjs");
|
|
2
|
-
const require_request = require("./request-
|
|
2
|
+
const require_request = require("./request-Zpjq9m-W.cjs");
|
|
3
3
|
const require_link = require("./link-FguCydMA.cjs");
|
|
4
|
-
const require_url = require("./url-
|
|
4
|
+
const require_url = require("./url-CsOV_B_P.cjs");
|
|
5
5
|
let _logtape_logtape = require("@logtape/logtape");
|
|
6
6
|
let _opentelemetry_api = require("@opentelemetry/api");
|
|
7
7
|
//#endregion
|
|
@@ -460,10 +460,6 @@ const preloadedContexts = {
|
|
|
460
460
|
"id": "@id",
|
|
461
461
|
"type": "@type",
|
|
462
462
|
"@protected": true,
|
|
463
|
-
"digestMultibase": {
|
|
464
|
-
"@id": "https://w3id.org/security#digestMultibase",
|
|
465
|
-
"@type": "https://w3id.org/security#multibase"
|
|
466
|
-
},
|
|
467
463
|
"proof": {
|
|
468
464
|
"@id": "https://w3id.org/security#proof",
|
|
469
465
|
"@type": "@id",
|
|
@@ -4300,6 +4296,14 @@ const preloadedContexts = {
|
|
|
4300
4296
|
"@type": "@id"
|
|
4301
4297
|
}
|
|
4302
4298
|
} },
|
|
4299
|
+
"https://w3id.org/fep/ef61": { "@context": {
|
|
4300
|
+
"gateways": {
|
|
4301
|
+
"@id": "https://w3id.org/fep/ef61/gateways",
|
|
4302
|
+
"@type": "@id",
|
|
4303
|
+
"@container": "@list"
|
|
4304
|
+
},
|
|
4305
|
+
"digestMultibase": "https://www.w3.org/ns/credentials/v2#digestMultibase"
|
|
4306
|
+
} },
|
|
4303
4307
|
"https://join-lemmy.org/context.json": { "@context": ["https://w3id.org/security/v1", {
|
|
4304
4308
|
"as": "https://www.w3.org/ns/activitystreams#",
|
|
4305
4309
|
"lemmy": "https://join-lemmy.org/ns#",
|
|
@@ -4534,8 +4538,10 @@ async function getRemoteDocument(url, response, fetch) {
|
|
|
4534
4538
|
* - <https://www.w3.org/ns/activitystreams>
|
|
4535
4539
|
* - <https://w3id.org/security/v1>
|
|
4536
4540
|
* - <https://w3id.org/security/data-integrity/v1>
|
|
4541
|
+
* - <https://w3id.org/security/data-integrity/v2>
|
|
4537
4542
|
* - <https://www.w3.org/ns/did/v1>
|
|
4538
4543
|
* - <https://w3id.org/security/multikey/v1>
|
|
4544
|
+
* - <https://w3id.org/fep/ef61>
|
|
4539
4545
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
4540
4546
|
* - <http://schema.org/>
|
|
4541
4547
|
* @param options Options for the document loader.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-C2EiDwsr.cjs");
|
|
2
|
-
const require_docloader = require("./docloader-
|
|
3
|
-
const require_request = require("./request-
|
|
4
|
-
const require_url = require("./url-
|
|
2
|
+
const require_docloader = require("./docloader-CTd4XwqK.cjs");
|
|
3
|
+
const require_request = require("./request-Zpjq9m-W.cjs");
|
|
4
|
+
const require_url = require("./url-CsOV_B_P.cjs");
|
|
5
5
|
let node_assert = require("node:assert");
|
|
6
6
|
let node_test = require("node:test");
|
|
7
7
|
//#region ../../node_modules/.pnpm/glob-to-regexp@0.4.1/node_modules/glob-to-regexp/index.js
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as getRemoteDocument, r as preloadedContexts, t as getDocumentLoader } from "./docloader-
|
|
2
|
-
import { t as FetchError } from "./request-
|
|
3
|
-
import { t as UrlError } from "./url-
|
|
1
|
+
import { n as getRemoteDocument, r as preloadedContexts, t as getDocumentLoader } from "./docloader-CNzoXrLM.mjs";
|
|
2
|
+
import { t as FetchError } from "./request-BWDludWb.mjs";
|
|
3
|
+
import { t as UrlError } from "./url-Du7RQQgP.mjs";
|
|
4
4
|
import { deepStrictEqual, ok, rejects } from "node:assert";
|
|
5
5
|
import { test } from "node:test";
|
|
6
6
|
//#region \0rolldown/runtime.js
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-C2EiDwsr.cjs");
|
|
2
|
-
const require_url = require("./url-
|
|
2
|
+
const require_url = require("./url-CsOV_B_P.cjs");
|
|
3
3
|
let node_assert = require("node:assert");
|
|
4
4
|
let node_test = require("node:test");
|
|
5
5
|
let jsonld_dist_jsonld_esm_js = require("jsonld/dist/jsonld.esm.js");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as formatIri, c as haveSameIriOrigin,
|
|
1
|
+
import { a as formatIri, c as haveSameIriOrigin, p as parseIri, s as haveSameFe34Origin } from "./url-Du7RQQgP.mjs";
|
|
2
2
|
import { deepStrictEqual, ok, strictEqual } from "node:assert";
|
|
3
3
|
import { test } from "node:test";
|
|
4
4
|
import jsonld from "jsonld/dist/jsonld.esm.js";
|
|
@@ -3,7 +3,7 @@ let node_process = require("node:process");
|
|
|
3
3
|
node_process = require_chunk.__toESM(node_process, 1);
|
|
4
4
|
//#region deno.json
|
|
5
5
|
var name = "@fedify/vocab-runtime";
|
|
6
|
-
var version = "2.4.0-dev.
|
|
6
|
+
var version = "2.4.0-dev.1634+3b4bfbb6";
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/request.ts
|
|
9
9
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-C2EiDwsr.cjs");
|
|
2
|
-
const require_request = require("./request-
|
|
2
|
+
const require_request = require("./request-Zpjq9m-W.cjs");
|
|
3
3
|
let node_assert = require("node:assert");
|
|
4
4
|
let node_test = require("node:test");
|
|
5
5
|
let node_process = require("node:process");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as version, r as getUserAgent } from "./request-
|
|
1
|
+
import { o as version, r as getUserAgent } from "./request-BWDludWb.mjs";
|
|
2
2
|
import { deepStrictEqual } from "node:assert";
|
|
3
3
|
import { test } from "node:test";
|
|
4
4
|
import process from "node:process";
|
|
@@ -211,6 +211,20 @@ function parseAtUri(uri) {
|
|
|
211
211
|
return new URL("at://" + encodeURIComponent(authority) + path);
|
|
212
212
|
}
|
|
213
213
|
/**
|
|
214
|
+
* Checks whether the URL is an FEP-ef61 gateway base URI.
|
|
215
|
+
*/
|
|
216
|
+
function isGatewayUrl(url) {
|
|
217
|
+
return (url.protocol === "http:" || url.protocol === "https:") && url.username === "" && url.password === "" && url.pathname === "/" && url.search === "" && url.hash === "";
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Parses and validates an FEP-ef61 gateway base URI.
|
|
221
|
+
*/
|
|
222
|
+
function parseGatewayUrl(url) {
|
|
223
|
+
const parsed = parseIri(url);
|
|
224
|
+
if (!isGatewayUrl(parsed)) throw new TypeError("FEP-ef61 gateways must be HTTP(S) base URIs with no credentials, path, query, or fragment.");
|
|
225
|
+
return parsed;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
214
228
|
* Validates a URL to prevent SSRF attacks.
|
|
215
229
|
*/
|
|
216
230
|
async function validatePublicUrl(url) {
|
|
@@ -424,6 +438,12 @@ Object.defineProperty(exports, "haveSameIriOrigin", {
|
|
|
424
438
|
return haveSameIriOrigin;
|
|
425
439
|
}
|
|
426
440
|
});
|
|
441
|
+
Object.defineProperty(exports, "isGatewayUrl", {
|
|
442
|
+
enumerable: true,
|
|
443
|
+
get: function() {
|
|
444
|
+
return isGatewayUrl;
|
|
445
|
+
}
|
|
446
|
+
});
|
|
427
447
|
Object.defineProperty(exports, "isValidPublicIPv4Address", {
|
|
428
448
|
enumerable: true,
|
|
429
449
|
get: function() {
|
|
@@ -436,6 +456,12 @@ Object.defineProperty(exports, "isValidPublicIPv6Address", {
|
|
|
436
456
|
return isValidPublicIPv6Address;
|
|
437
457
|
}
|
|
438
458
|
});
|
|
459
|
+
Object.defineProperty(exports, "parseGatewayUrl", {
|
|
460
|
+
enumerable: true,
|
|
461
|
+
get: function() {
|
|
462
|
+
return parseGatewayUrl;
|
|
463
|
+
}
|
|
464
|
+
});
|
|
439
465
|
Object.defineProperty(exports, "parseIri", {
|
|
440
466
|
enumerable: true,
|
|
441
467
|
get: function() {
|
|
@@ -210,6 +210,20 @@ function parseAtUri(uri) {
|
|
|
210
210
|
return new URL("at://" + encodeURIComponent(authority) + path);
|
|
211
211
|
}
|
|
212
212
|
/**
|
|
213
|
+
* Checks whether the URL is an FEP-ef61 gateway base URI.
|
|
214
|
+
*/
|
|
215
|
+
function isGatewayUrl(url) {
|
|
216
|
+
return (url.protocol === "http:" || url.protocol === "https:") && url.username === "" && url.password === "" && url.pathname === "/" && url.search === "" && url.hash === "";
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Parses and validates an FEP-ef61 gateway base URI.
|
|
220
|
+
*/
|
|
221
|
+
function parseGatewayUrl(url) {
|
|
222
|
+
const parsed = parseIri(url);
|
|
223
|
+
if (!isGatewayUrl(parsed)) throw new TypeError("FEP-ef61 gateways must be HTTP(S) base URIs with no credentials, path, query, or fragment.");
|
|
224
|
+
return parsed;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
213
227
|
* Validates a URL to prevent SSRF attacks.
|
|
214
228
|
*/
|
|
215
229
|
async function validatePublicUrl(url) {
|
|
@@ -375,4 +389,4 @@ function matchesIPv6Prefix(address, prefixWords, prefixLength) {
|
|
|
375
389
|
return true;
|
|
376
390
|
}
|
|
377
391
|
//#endregion
|
|
378
|
-
export { formatIri as a, haveSameIriOrigin as c,
|
|
392
|
+
export { formatIri as a, haveSameIriOrigin as c, isValidPublicIPv6Address as d, parseGatewayUrl as f, validatePublicUrl as h, expandIPv6Address as i, isGatewayUrl as l, parseJsonLdId as m, arePortableUrisEqual as n, getFe34Origin as o, parseIri as p, canonicalizePortableUri as r, haveSameFe34Origin as s, UrlError as t, isValidPublicIPv4Address as u };
|
package/dist/tests/url.test.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require("./chunk-C2EiDwsr.cjs");
|
|
2
|
-
const require_url = require("./url-
|
|
2
|
+
const require_url = require("./url-CsOV_B_P.cjs");
|
|
3
3
|
let node_assert = require("node:assert");
|
|
4
4
|
let node_test = require("node:test");
|
|
5
5
|
//#region src/url.test.ts
|
|
@@ -228,6 +228,23 @@ let node_test = require("node:test");
|
|
|
228
228
|
(0, node_assert.deepStrictEqual)(parsed, new URL("ap+ef61://did%3Aweb%3Aexample.com%2500/u/1"));
|
|
229
229
|
(0, node_assert.deepStrictEqual)(require_url.formatIri(parsed), "ap+ef61://did:web:example.com%00/u/1");
|
|
230
230
|
});
|
|
231
|
+
(0, node_test.test)("parseGatewayUrl() accepts only HTTP(S) base URIs", () => {
|
|
232
|
+
for (const url of ["https://server.example/", "http://server.example/"]) {
|
|
233
|
+
(0, node_assert.deepStrictEqual)(require_url.parseGatewayUrl(url), new URL(url));
|
|
234
|
+
(0, node_assert.ok)(require_url.isGatewayUrl(new URL(url)));
|
|
235
|
+
}
|
|
236
|
+
for (const url of [
|
|
237
|
+
"ftp://server.example/",
|
|
238
|
+
"https://user:pass@server.example/",
|
|
239
|
+
"https://user@server.example/",
|
|
240
|
+
"https://server.example/path",
|
|
241
|
+
"https://server.example/?x=1",
|
|
242
|
+
"https://server.example/#fragment"
|
|
243
|
+
]) {
|
|
244
|
+
(0, node_assert.throws)(() => require_url.parseGatewayUrl(url), TypeError);
|
|
245
|
+
(0, node_assert.ok)(!require_url.isGatewayUrl(new URL(url)));
|
|
246
|
+
}
|
|
247
|
+
});
|
|
231
248
|
(0, node_test.test)("validatePublicUrl()", async () => {
|
|
232
249
|
await (0, node_assert.rejects)(() => require_url.validatePublicUrl("ftp://localhost"), require_url.UrlError);
|
|
233
250
|
await (0, node_assert.rejects)(() => require_url.validatePublicUrl("data:text/plain;base64,SGVsbG8sIFdvcmxkIQ=="), require_url.UrlError);
|
package/dist/tests/url.test.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as formatIri, c as haveSameIriOrigin, d as
|
|
1
|
+
import { a as formatIri, c as haveSameIriOrigin, d as isValidPublicIPv6Address, f as parseGatewayUrl, h as validatePublicUrl, i as expandIPv6Address, l as isGatewayUrl, m as parseJsonLdId, n as arePortableUrisEqual, o as getFe34Origin, p as parseIri, r as canonicalizePortableUri, s as haveSameFe34Origin, t as UrlError, u as isValidPublicIPv4Address } from "./url-Du7RQQgP.mjs";
|
|
2
2
|
import { deepStrictEqual, ok, rejects, throws } from "node:assert";
|
|
3
3
|
import { test } from "node:test";
|
|
4
4
|
//#region src/url.test.ts
|
|
@@ -227,6 +227,23 @@ test("parseIri() preserves encoded percent signs while decoding delimiters", ()
|
|
|
227
227
|
deepStrictEqual(parsed, new URL("ap+ef61://did%3Aweb%3Aexample.com%2500/u/1"));
|
|
228
228
|
deepStrictEqual(formatIri(parsed), "ap+ef61://did:web:example.com%00/u/1");
|
|
229
229
|
});
|
|
230
|
+
test("parseGatewayUrl() accepts only HTTP(S) base URIs", () => {
|
|
231
|
+
for (const url of ["https://server.example/", "http://server.example/"]) {
|
|
232
|
+
deepStrictEqual(parseGatewayUrl(url), new URL(url));
|
|
233
|
+
ok(isGatewayUrl(new URL(url)));
|
|
234
|
+
}
|
|
235
|
+
for (const url of [
|
|
236
|
+
"ftp://server.example/",
|
|
237
|
+
"https://user:pass@server.example/",
|
|
238
|
+
"https://user@server.example/",
|
|
239
|
+
"https://server.example/path",
|
|
240
|
+
"https://server.example/?x=1",
|
|
241
|
+
"https://server.example/#fragment"
|
|
242
|
+
]) {
|
|
243
|
+
throws(() => parseGatewayUrl(url), TypeError);
|
|
244
|
+
ok(!isGatewayUrl(new URL(url)));
|
|
245
|
+
}
|
|
246
|
+
});
|
|
230
247
|
test("validatePublicUrl()", async () => {
|
|
231
248
|
await rejects(() => validatePublicUrl("ftp://localhost"), UrlError);
|
|
232
249
|
await rejects(() => validatePublicUrl("data:text/plain;base64,SGVsbG8sIFdvcmxkIQ=="), UrlError);
|
|
@@ -212,6 +212,20 @@ function parseAtUri(uri) {
|
|
|
212
212
|
return new URL("at://" + encodeURIComponent(authority) + path);
|
|
213
213
|
}
|
|
214
214
|
/**
|
|
215
|
+
* Checks whether the URL is an FEP-ef61 gateway base URI.
|
|
216
|
+
*/
|
|
217
|
+
function isGatewayUrl(url) {
|
|
218
|
+
return (url.protocol === "http:" || url.protocol === "https:") && url.username === "" && url.password === "" && url.pathname === "/" && url.search === "" && url.hash === "";
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Parses and validates an FEP-ef61 gateway base URI.
|
|
222
|
+
*/
|
|
223
|
+
function parseGatewayUrl(url) {
|
|
224
|
+
const parsed = parseIri(url);
|
|
225
|
+
if (!isGatewayUrl(parsed)) throw new TypeError("FEP-ef61 gateways must be HTTP(S) base URIs with no credentials, path, query, or fragment.");
|
|
226
|
+
return parsed;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
215
229
|
* Validates a URL to prevent SSRF attacks.
|
|
216
230
|
*/
|
|
217
231
|
async function validatePublicUrl(url) {
|
|
@@ -425,6 +439,12 @@ Object.defineProperty(exports, "haveSameIriOrigin", {
|
|
|
425
439
|
return haveSameIriOrigin;
|
|
426
440
|
}
|
|
427
441
|
});
|
|
442
|
+
Object.defineProperty(exports, "isGatewayUrl", {
|
|
443
|
+
enumerable: true,
|
|
444
|
+
get: function() {
|
|
445
|
+
return isGatewayUrl;
|
|
446
|
+
}
|
|
447
|
+
});
|
|
428
448
|
Object.defineProperty(exports, "isValidPublicIPv4Address", {
|
|
429
449
|
enumerable: true,
|
|
430
450
|
get: function() {
|
|
@@ -437,6 +457,12 @@ Object.defineProperty(exports, "isValidPublicIPv6Address", {
|
|
|
437
457
|
return isValidPublicIPv6Address;
|
|
438
458
|
}
|
|
439
459
|
});
|
|
460
|
+
Object.defineProperty(exports, "parseGatewayUrl", {
|
|
461
|
+
enumerable: true,
|
|
462
|
+
get: function() {
|
|
463
|
+
return parseGatewayUrl;
|
|
464
|
+
}
|
|
465
|
+
});
|
|
440
466
|
Object.defineProperty(exports, "parseIri", {
|
|
441
467
|
enumerable: true,
|
|
442
468
|
get: function() {
|
|
@@ -211,6 +211,20 @@ function parseAtUri(uri) {
|
|
|
211
211
|
return new URL("at://" + encodeURIComponent(authority) + path);
|
|
212
212
|
}
|
|
213
213
|
/**
|
|
214
|
+
* Checks whether the URL is an FEP-ef61 gateway base URI.
|
|
215
|
+
*/
|
|
216
|
+
function isGatewayUrl(url) {
|
|
217
|
+
return (url.protocol === "http:" || url.protocol === "https:") && url.username === "" && url.password === "" && url.pathname === "/" && url.search === "" && url.hash === "";
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Parses and validates an FEP-ef61 gateway base URI.
|
|
221
|
+
*/
|
|
222
|
+
function parseGatewayUrl(url) {
|
|
223
|
+
const parsed = parseIri(url);
|
|
224
|
+
if (!isGatewayUrl(parsed)) throw new TypeError("FEP-ef61 gateways must be HTTP(S) base URIs with no credentials, path, query, or fragment.");
|
|
225
|
+
return parsed;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
214
228
|
* Validates a URL to prevent SSRF attacks.
|
|
215
229
|
*/
|
|
216
230
|
async function validatePublicUrl(url) {
|
|
@@ -376,4 +390,4 @@ function matchesIPv6Prefix(address, prefixWords, prefixLength) {
|
|
|
376
390
|
return true;
|
|
377
391
|
}
|
|
378
392
|
//#endregion
|
|
379
|
-
export { formatIri as a, haveSameIriOrigin as c,
|
|
393
|
+
export { formatIri as a, haveSameIriOrigin as c, isValidPublicIPv6Address as d, parseGatewayUrl as f, validatePublicUrl as h, expandIPv6Address as i, isGatewayUrl as l, parseJsonLdId as m, arePortableUrisEqual as n, getFe34Origin as o, parseIri as p, canonicalizePortableUri as r, haveSameFe34Origin as s, UrlError as t, isValidPublicIPv4Address as u };
|
package/package.json
CHANGED
|
@@ -3,10 +3,6 @@
|
|
|
3
3
|
"id": "@id",
|
|
4
4
|
"type": "@type",
|
|
5
5
|
"@protected": true,
|
|
6
|
-
"digestMultibase": {
|
|
7
|
-
"@id": "https://w3id.org/security#digestMultibase",
|
|
8
|
-
"@type": "https://w3id.org/security#multibase"
|
|
9
|
-
},
|
|
10
6
|
"proof": {
|
|
11
7
|
"@id": "https://w3id.org/security#proof",
|
|
12
8
|
"@type": "@id",
|
package/src/contexts.ts
CHANGED
|
@@ -8,6 +8,7 @@ import activitystreams from "./contexts/activitystreams.json" with {
|
|
|
8
8
|
import didV1 from "./contexts/did-v1.json" with { type: "json" };
|
|
9
9
|
import fep5711 from "./contexts/fep-5711.json" with { type: "json" };
|
|
10
10
|
import fep7aa9 from "./contexts/fep-7aa9.json" with { type: "json" };
|
|
11
|
+
import fepEf61 from "./contexts/fep-ef61.json" with { type: "json" };
|
|
11
12
|
import gotosocial from "./contexts/gotosocial.json" with { type: "json" };
|
|
12
13
|
import identityV1 from "./contexts/identity-v1.json" with { type: "json" };
|
|
13
14
|
import joinLemmyContext from "./contexts/join-lemmy.json" with { type: "json" };
|
|
@@ -37,6 +38,7 @@ const preloadedContexts: Record<string, unknown> = {
|
|
|
37
38
|
"https://gotosocial.org/ns": gotosocial,
|
|
38
39
|
"https://w3id.org/fep/5711": fep5711,
|
|
39
40
|
"https://w3id.org/fep/7aa9": fep7aa9,
|
|
41
|
+
"https://w3id.org/fep/ef61": fepEf61,
|
|
40
42
|
|
|
41
43
|
// Lemmy's context document is served as application/json without the JSON-LD
|
|
42
44
|
// context Link header. The default document loader treats that as a regular
|
package/src/docloader.ts
CHANGED
|
@@ -351,8 +351,10 @@ export interface GetDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
|
|
|
351
351
|
* - <https://www.w3.org/ns/activitystreams>
|
|
352
352
|
* - <https://w3id.org/security/v1>
|
|
353
353
|
* - <https://w3id.org/security/data-integrity/v1>
|
|
354
|
+
* - <https://w3id.org/security/data-integrity/v2>
|
|
354
355
|
* - <https://www.w3.org/ns/did/v1>
|
|
355
356
|
* - <https://w3id.org/security/multikey/v1>
|
|
357
|
+
* - <https://w3id.org/fep/ef61>
|
|
356
358
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
357
359
|
* - <http://schema.org/>
|
|
358
360
|
* @param options Options for the document loader.
|
package/src/mod.ts
CHANGED
package/src/url.test.ts
CHANGED
|
@@ -8,8 +8,10 @@ import {
|
|
|
8
8
|
getFe34Origin,
|
|
9
9
|
haveSameFe34Origin,
|
|
10
10
|
haveSameIriOrigin,
|
|
11
|
+
isGatewayUrl,
|
|
11
12
|
isValidPublicIPv4Address,
|
|
12
13
|
isValidPublicIPv6Address,
|
|
14
|
+
parseGatewayUrl,
|
|
13
15
|
parseIri,
|
|
14
16
|
parseJsonLdId,
|
|
15
17
|
UrlError,
|
|
@@ -638,6 +640,27 @@ test("parseIri() preserves encoded percent signs while decoding delimiters", ()
|
|
|
638
640
|
);
|
|
639
641
|
});
|
|
640
642
|
|
|
643
|
+
test("parseGatewayUrl() accepts only HTTP(S) base URIs", () => {
|
|
644
|
+
for (const url of ["https://server.example/", "http://server.example/"]) {
|
|
645
|
+
deepStrictEqual(parseGatewayUrl(url), new URL(url));
|
|
646
|
+
ok(isGatewayUrl(new URL(url)));
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
for (
|
|
650
|
+
const url of [
|
|
651
|
+
"ftp://server.example/",
|
|
652
|
+
"https://user:pass@server.example/",
|
|
653
|
+
"https://user@server.example/",
|
|
654
|
+
"https://server.example/path",
|
|
655
|
+
"https://server.example/?x=1",
|
|
656
|
+
"https://server.example/#fragment",
|
|
657
|
+
]
|
|
658
|
+
) {
|
|
659
|
+
throws(() => parseGatewayUrl(url), TypeError);
|
|
660
|
+
ok(!isGatewayUrl(new URL(url)));
|
|
661
|
+
}
|
|
662
|
+
});
|
|
663
|
+
|
|
641
664
|
test("validatePublicUrl()", async () => {
|
|
642
665
|
await rejects(() => validatePublicUrl("ftp://localhost"), UrlError);
|
|
643
666
|
await rejects(
|
package/src/url.ts
CHANGED
|
@@ -323,6 +323,29 @@ function parseAtUri(uri: string): URL {
|
|
|
323
323
|
return new URL("at://" + encodeURIComponent(authority) + path);
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
+
/**
|
|
327
|
+
* Checks whether the URL is an FEP-ef61 gateway base URI.
|
|
328
|
+
*/
|
|
329
|
+
export function isGatewayUrl(url: URL): boolean {
|
|
330
|
+
return (url.protocol === "http:" || url.protocol === "https:") &&
|
|
331
|
+
url.username === "" && url.password === "" &&
|
|
332
|
+
url.pathname === "/" && url.search === "" && url.hash === "";
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Parses and validates an FEP-ef61 gateway base URI.
|
|
337
|
+
*/
|
|
338
|
+
export function parseGatewayUrl(url: string): URL {
|
|
339
|
+
const parsed = parseIri(url);
|
|
340
|
+
if (!isGatewayUrl(parsed)) {
|
|
341
|
+
throw new TypeError(
|
|
342
|
+
"FEP-ef61 gateways must be HTTP(S) base URIs with no credentials, " +
|
|
343
|
+
"path, query, or fragment.",
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
return parsed;
|
|
347
|
+
}
|
|
348
|
+
|
|
326
349
|
/**
|
|
327
350
|
* Validates a URL to prevent SSRF attacks.
|
|
328
351
|
*/
|