@fedify/vocab-runtime 2.0.8 → 2.0.9
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/{chunk-CUT6urMc.cjs → chunk-CKQMccvm.cjs} +7 -9
- package/dist/jsonld.cjs +4 -5
- package/dist/jsonld.d.cts +3 -4
- package/dist/jsonld.d.ts +2 -2
- package/dist/jsonld.js +1 -3
- package/dist/mod.cjs +56 -121
- package/dist/mod.d.cts +1 -5
- package/dist/mod.d.ts +1 -5
- package/dist/mod.js +32 -100
- package/dist/tests/{chunk-DWy1uDak.cjs → chunk-Do9eywBl.cjs} +13 -17
- package/dist/tests/docloader.test.cjs +65 -106
- package/dist/tests/{docloader.test.js → docloader.test.mjs} +60 -107
- package/dist/tests/internal/multicodec.test.cjs +5 -7
- package/dist/tests/internal/{multicodec.test.js → multicodec.test.mjs} +3 -4
- package/dist/tests/key.test.cjs +39 -70
- package/dist/tests/{key.test.js → key.test.mjs} +32 -62
- package/dist/tests/langstr.test.cjs +6 -8
- package/dist/tests/{langstr.test.js → langstr.test.mjs} +2 -4
- package/dist/tests/{link-CdFPEo9O.cjs → link-B6ZWBZhf.cjs} +6 -8
- package/dist/tests/{link-Ck2yj4dH.js → link-B8JGXSS2.mjs} +1 -2
- package/dist/tests/link.test.cjs +5 -7
- package/dist/tests/{link.test.js → link.test.mjs} +3 -4
- package/dist/tests/multibase/multibase.test.cjs +10 -17
- package/dist/tests/multibase/{multibase.test.js → multibase.test.mjs} +10 -18
- package/dist/tests/{multibase-B2D6B0V4.cjs → multibase-CgYqpk4Z.cjs} +43 -49
- package/dist/tests/{multibase-BdHCGO4H.js → multibase-jcKrOpuU.mjs} +5 -12
- package/dist/tests/{multicodec-mHcRzSGY.cjs → multicodec-DeYop8xg.cjs} +16 -18
- package/dist/tests/{multicodec-DvC5xnX2.js → multicodec-aqbZnrNi.mjs} +1 -2
- package/dist/tests/{request-Cqx2eUpt.js → request-AitXfW_2.mjs} +4 -45
- package/dist/tests/{request-D2-F2dMS.cjs → request-C6iSYeYi.cjs} +38 -72
- package/dist/tests/request.test.cjs +23 -24
- package/dist/tests/request.test.mjs +42 -0
- package/dist/tests/{url-C5Vs9nYh.cjs → url-Cr2K-wzd.cjs} +31 -35
- package/dist/tests/{url-fW_DHbih.js → url-Djghaq0m.mjs} +3 -7
- package/dist/tests/url.test.cjs +5 -7
- package/dist/tests/{url.test.js → url.test.mjs} +3 -4
- package/package.json +3 -3
- package/dist/tests/request.test.js +0 -43
- /package/dist/tests/{docloader.test.d.ts → docloader.test.d.mts} +0 -0
- /package/dist/tests/internal/{multicodec.test.d.ts → multicodec.test.d.mts} +0 -0
- /package/dist/tests/{key.test.d.ts → key.test.d.mts} +0 -0
- /package/dist/tests/{langstr.test.d.ts → langstr.test.d.mts} +0 -0
- /package/dist/tests/{link.test.d.ts → link.test.d.mts} +0 -0
- /package/dist/tests/multibase/{multibase.test.d.ts → multibase.test.d.mts} +0 -0
- /package/dist/tests/{request.test.d.ts → request.test.d.mts} +0 -0
- /package/dist/tests/{url.test.d.ts → url.test.d.mts} +0 -0
package/dist/mod.js
CHANGED
|
@@ -9,7 +9,6 @@ import { decodeBase64Url } from "byte-encodings/base64url";
|
|
|
9
9
|
import { createPublicKey } from "node:crypto";
|
|
10
10
|
import { PublicKeyInfo } from "pkijs";
|
|
11
11
|
import baseX from "@multiformats/base-x";
|
|
12
|
-
|
|
13
12
|
//#region src/contexts.ts
|
|
14
13
|
const preloadedContexts = {
|
|
15
14
|
"https://www.w3.org/ns/activitystreams": { "@context": {
|
|
@@ -4257,50 +4256,10 @@ const preloadedContexts = {
|
|
|
4257
4256
|
}
|
|
4258
4257
|
} }
|
|
4259
4258
|
};
|
|
4260
|
-
var contexts_default = preloadedContexts;
|
|
4261
|
-
|
|
4262
4259
|
//#endregion
|
|
4263
4260
|
//#region deno.json
|
|
4264
4261
|
var name = "@fedify/vocab-runtime";
|
|
4265
|
-
var version = "2.0.
|
|
4266
|
-
var license = "MIT";
|
|
4267
|
-
var exports = {
|
|
4268
|
-
".": "./src/mod.ts",
|
|
4269
|
-
"./jsonld": "./src/jsonld.ts"
|
|
4270
|
-
};
|
|
4271
|
-
var description = "Runtime library for @fedify/vocab";
|
|
4272
|
-
var author = {
|
|
4273
|
-
"name": "Hong Minhee",
|
|
4274
|
-
"email": "hong@minhee.org",
|
|
4275
|
-
"url": "https://hongminhee.org/"
|
|
4276
|
-
};
|
|
4277
|
-
var imports = {
|
|
4278
|
-
"@multiformats/base-x": "npm:@multiformats/base-x@^4.0.1",
|
|
4279
|
-
"asn1js": "npm:asn1js@^3.0.6",
|
|
4280
|
-
"byte-encodings": "npm:byte-encodings@^1.0.11",
|
|
4281
|
-
"fetch-mock": "npm:fetch-mock@^12.5.4",
|
|
4282
|
-
"jsonld": "npm:jsonld@^9.0.0",
|
|
4283
|
-
"pkijs": "npm:pkijs@^3.2.5"
|
|
4284
|
-
};
|
|
4285
|
-
var exclude = ["dist", "node_modules"];
|
|
4286
|
-
var publish = { "exclude": ["**/*.test.ts", "tsdown.config.ts"] };
|
|
4287
|
-
var tasks = {
|
|
4288
|
-
"check": "deno fmt --check && deno lint && deno check src/*.ts",
|
|
4289
|
-
"test": "deno test"
|
|
4290
|
-
};
|
|
4291
|
-
var deno_default = {
|
|
4292
|
-
name,
|
|
4293
|
-
version,
|
|
4294
|
-
license,
|
|
4295
|
-
exports,
|
|
4296
|
-
description,
|
|
4297
|
-
author,
|
|
4298
|
-
imports,
|
|
4299
|
-
exclude,
|
|
4300
|
-
publish,
|
|
4301
|
-
tasks
|
|
4302
|
-
};
|
|
4303
|
-
|
|
4262
|
+
var version = "2.0.9";
|
|
4304
4263
|
//#endregion
|
|
4305
4264
|
//#region src/link.ts
|
|
4306
4265
|
const parametersNeedLowerCase = ["rel", "type"];
|
|
@@ -4482,7 +4441,6 @@ var HttpHeaderLink = class HttpHeaderLink {
|
|
|
4482
4441
|
return new this(...inputs).toString();
|
|
4483
4442
|
}
|
|
4484
4443
|
};
|
|
4485
|
-
|
|
4486
4444
|
//#endregion
|
|
4487
4445
|
//#region src/request.ts
|
|
4488
4446
|
/**
|
|
@@ -4528,27 +4486,25 @@ function createActivityPubRequest(url, options = {}) {
|
|
|
4528
4486
|
* @since 1.3.0
|
|
4529
4487
|
*/
|
|
4530
4488
|
function getUserAgent({ software, url } = {}) {
|
|
4531
|
-
const fedify = `Fedify/${
|
|
4489
|
+
const fedify = `Fedify/${version}`;
|
|
4532
4490
|
const runtime = globalThis.Deno?.version?.deno != null ? `Deno/${Deno.version.deno}` : globalThis.process?.versions?.bun != null ? `Bun/${process.versions.bun}` : "navigator" in globalThis && navigator.userAgent === "Cloudflare-Workers" ? navigator.userAgent : globalThis.process?.versions?.node != null ? `Node.js/${process.versions.node}` : null;
|
|
4533
4491
|
const userAgent = software == null ? [fedify] : [software, fedify];
|
|
4534
4492
|
if (runtime != null) userAgent.push(runtime);
|
|
4535
4493
|
if (url != null) userAgent.push(`+${url.toString()}`);
|
|
4536
|
-
|
|
4537
|
-
return `${first} (${userAgent.join("; ")})`;
|
|
4494
|
+
return `${userAgent.shift()} (${userAgent.join("; ")})`;
|
|
4538
4495
|
}
|
|
4539
4496
|
/**
|
|
4540
4497
|
* Logs the request.
|
|
4541
4498
|
* @param request The request to log.
|
|
4542
4499
|
* @internal
|
|
4543
4500
|
*/
|
|
4544
|
-
function logRequest(logger
|
|
4545
|
-
logger
|
|
4501
|
+
function logRequest(logger, request) {
|
|
4502
|
+
logger.debug("Fetching document: {method} {url} {headers}", {
|
|
4546
4503
|
method: request.method,
|
|
4547
4504
|
url: request.url,
|
|
4548
4505
|
headers: Object.fromEntries(request.headers.entries())
|
|
4549
4506
|
});
|
|
4550
4507
|
}
|
|
4551
|
-
|
|
4552
4508
|
//#endregion
|
|
4553
4509
|
//#region src/url.ts
|
|
4554
4510
|
var UrlError = class extends Error {
|
|
@@ -4567,8 +4523,7 @@ async function validatePublicUrl(url) {
|
|
|
4567
4523
|
if (hostname.startsWith("[") && hostname.endsWith("]")) hostname = hostname.substring(1, hostname.length - 2);
|
|
4568
4524
|
if (hostname === "localhost") throw new UrlError("Localhost is not allowed");
|
|
4569
4525
|
if ("Deno" in globalThis && !isIP(hostname)) {
|
|
4570
|
-
|
|
4571
|
-
if (netPermission.state !== "granted") return;
|
|
4526
|
+
if ((await Deno.permissions.query({ name: "net" })).state !== "granted") return;
|
|
4572
4527
|
}
|
|
4573
4528
|
if ("Bun" in globalThis) {
|
|
4574
4529
|
if (hostname === "example.com" || hostname.endsWith(".example.com")) return;
|
|
@@ -4604,10 +4559,8 @@ function expandIPv6Address(address) {
|
|
|
4604
4559
|
if (address.startsWith("::")) address = "0000" + address;
|
|
4605
4560
|
if (address.endsWith("::")) address = address + "0000";
|
|
4606
4561
|
address = address.replace("::", ":0000".repeat(8 - (address.match(/:/g) || []).length) + ":");
|
|
4607
|
-
|
|
4608
|
-
return parts.map((part) => part.padStart(4, "0")).join(":");
|
|
4562
|
+
return address.split(":").map((part) => part.padStart(4, "0")).join(":");
|
|
4609
4563
|
}
|
|
4610
|
-
|
|
4611
4564
|
//#endregion
|
|
4612
4565
|
//#region src/docloader.ts
|
|
4613
4566
|
const logger = getLogger([
|
|
@@ -4625,7 +4578,7 @@ const DEFAULT_MAX_REDIRECTION = 20;
|
|
|
4625
4578
|
* @throws {FetchError} If the response is not OK.
|
|
4626
4579
|
* @internal
|
|
4627
4580
|
*/
|
|
4628
|
-
async function getRemoteDocument(url, response, fetch
|
|
4581
|
+
async function getRemoteDocument(url, response, fetch) {
|
|
4629
4582
|
const documentUrl = response.url === "" ? url : response.url;
|
|
4630
4583
|
const docUrl = new URL(documentUrl);
|
|
4631
4584
|
if (!response.ok) {
|
|
@@ -4663,7 +4616,7 @@ async function getRemoteDocument(url, response, fetch$1) {
|
|
|
4663
4616
|
alternateUrl: altUri.href,
|
|
4664
4617
|
url: documentUrl
|
|
4665
4618
|
});
|
|
4666
|
-
return await fetch
|
|
4619
|
+
return await fetch(altUri.href);
|
|
4667
4620
|
}
|
|
4668
4621
|
}
|
|
4669
4622
|
}
|
|
@@ -4689,15 +4642,14 @@ async function getRemoteDocument(url, response, fetch$1) {
|
|
|
4689
4642
|
attrPattern.lastIndex = 0;
|
|
4690
4643
|
while ((attrMatch = attrPattern.exec(tagContent)) !== null) {
|
|
4691
4644
|
const key = attrMatch[1].toLowerCase();
|
|
4692
|
-
|
|
4693
|
-
attribs[key] = value;
|
|
4645
|
+
attribs[key] = attrMatch[2] ?? attrMatch[3] ?? attrMatch[4] ?? "";
|
|
4694
4646
|
}
|
|
4695
4647
|
if (attribs.rel === "alternate" && "type" in attribs && (attribs.type === "application/activity+json" || attribs.type === "application/ld+json" || attribs.type.startsWith("application/ld+json;")) && "href" in attribs && new URL(attribs.href, docUrl).href !== docUrl.href) {
|
|
4696
4648
|
logger.debug("Found alternate document: {alternateUrl} from {url}", {
|
|
4697
4649
|
alternateUrl: attribs.href,
|
|
4698
4650
|
url: documentUrl
|
|
4699
4651
|
});
|
|
4700
|
-
return await fetch
|
|
4652
|
+
return await fetch(new URL(attribs.href, docUrl).href);
|
|
4701
4653
|
}
|
|
4702
4654
|
}
|
|
4703
4655
|
document = JSON.parse(html);
|
|
@@ -4732,16 +4684,15 @@ async function getRemoteDocument(url, response, fetch$1) {
|
|
|
4732
4684
|
* @since 1.3.0
|
|
4733
4685
|
*/
|
|
4734
4686
|
function getDocumentLoader({ allowPrivateAddress, skipPreloadedContexts, userAgent } = {}) {
|
|
4735
|
-
const
|
|
4736
|
-
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
4687
|
+
const tracer = trace.getTracerProvider().getTracer(name, version);
|
|
4737
4688
|
async function load(url, options, redirected = 0, visited = /* @__PURE__ */ new Set()) {
|
|
4738
4689
|
options?.signal?.throwIfAborted();
|
|
4739
4690
|
const currentUrl = new URL(url).href;
|
|
4740
|
-
if (!skipPreloadedContexts && currentUrl in
|
|
4691
|
+
if (!skipPreloadedContexts && currentUrl in preloadedContexts) {
|
|
4741
4692
|
logger.debug("Using preloaded context: {url}.", { url: currentUrl });
|
|
4742
4693
|
return {
|
|
4743
4694
|
contextUrl: null,
|
|
4744
|
-
document:
|
|
4695
|
+
document: preloadedContexts[currentUrl],
|
|
4745
4696
|
documentUrl: currentUrl
|
|
4746
4697
|
};
|
|
4747
4698
|
}
|
|
@@ -4804,7 +4755,6 @@ function getDocumentLoader({ allowPrivateAddress, skipPreloadedContexts, userAge
|
|
|
4804
4755
|
}
|
|
4805
4756
|
return load;
|
|
4806
4757
|
}
|
|
4807
|
-
|
|
4808
4758
|
//#endregion
|
|
4809
4759
|
//#region src/internal/multicodec.ts
|
|
4810
4760
|
const INVALID_MULTICODEC_PREFIX = "Invalid multicodec prefix.";
|
|
@@ -4844,7 +4794,6 @@ function addMulticodecPrefix(code, payload) {
|
|
|
4844
4794
|
prefixed.set(payload, prefix.length);
|
|
4845
4795
|
return prefixed;
|
|
4846
4796
|
}
|
|
4847
|
-
|
|
4848
4797
|
//#endregion
|
|
4849
4798
|
//#region src/jwk.ts
|
|
4850
4799
|
function validateCryptoKey(key, type) {
|
|
@@ -4852,11 +4801,9 @@ function validateCryptoKey(key, type) {
|
|
|
4852
4801
|
if (!key.extractable) throw new TypeError("The key is not extractable.");
|
|
4853
4802
|
if (key.algorithm.name !== "RSASSA-PKCS1-v1_5" && key.algorithm.name !== "Ed25519") throw new TypeError("Currently only RSASSA-PKCS1-v1_5 and Ed25519 keys are supported. More algorithms will be added in the future!");
|
|
4854
4803
|
if (key.algorithm.name === "RSASSA-PKCS1-v1_5") {
|
|
4855
|
-
|
|
4856
|
-
if (algorithm.hash.name !== "SHA-256") throw new TypeError("For compatibility with the existing Fediverse software (e.g., Mastodon), hash algorithm for RSASSA-PKCS1-v1_5 keys must be SHA-256.");
|
|
4804
|
+
if (key.algorithm.hash.name !== "SHA-256") throw new TypeError("For compatibility with the existing Fediverse software (e.g., Mastodon), hash algorithm for RSASSA-PKCS1-v1_5 keys must be SHA-256.");
|
|
4857
4805
|
}
|
|
4858
4806
|
}
|
|
4859
|
-
|
|
4860
4807
|
//#endregion
|
|
4861
4808
|
//#region src/multibase/util.ts
|
|
4862
4809
|
const textDecoder = new TextDecoder();
|
|
@@ -4872,7 +4819,6 @@ function concat(arrs, length) {
|
|
|
4872
4819
|
}
|
|
4873
4820
|
return output;
|
|
4874
4821
|
}
|
|
4875
|
-
|
|
4876
4822
|
//#endregion
|
|
4877
4823
|
//#region src/multibase/base.ts
|
|
4878
4824
|
/**
|
|
@@ -4881,8 +4827,8 @@ function concat(arrs, length) {
|
|
|
4881
4827
|
var Base = class {
|
|
4882
4828
|
codeBuf;
|
|
4883
4829
|
codec;
|
|
4884
|
-
constructor(name
|
|
4885
|
-
this.name = name
|
|
4830
|
+
constructor(name, code, factory, alphabet) {
|
|
4831
|
+
this.name = name;
|
|
4886
4832
|
this.code = code;
|
|
4887
4833
|
this.alphabet = alphabet;
|
|
4888
4834
|
this.codeBuf = encodeText(this.code);
|
|
@@ -4897,12 +4843,11 @@ var Base = class {
|
|
|
4897
4843
|
return this.codec.decode(string);
|
|
4898
4844
|
}
|
|
4899
4845
|
};
|
|
4900
|
-
|
|
4901
4846
|
//#endregion
|
|
4902
4847
|
//#region src/multibase/rfc4648.ts
|
|
4903
4848
|
const decode = (string, alphabet, bitsPerChar) => {
|
|
4904
|
-
const codes
|
|
4905
|
-
for (let i = 0; i < alphabet.length; ++i) codes
|
|
4849
|
+
const codes = {};
|
|
4850
|
+
for (let i = 0; i < alphabet.length; ++i) codes[alphabet[i]] = i;
|
|
4906
4851
|
let end = string.length;
|
|
4907
4852
|
while (string[end - 1] === "=") --end;
|
|
4908
4853
|
const out = new Uint8Array(end * bitsPerChar / 8 | 0);
|
|
@@ -4910,7 +4855,7 @@ const decode = (string, alphabet, bitsPerChar) => {
|
|
|
4910
4855
|
let buffer = 0;
|
|
4911
4856
|
let written = 0;
|
|
4912
4857
|
for (let i = 0; i < end; ++i) {
|
|
4913
|
-
const value = codes
|
|
4858
|
+
const value = codes[string[i]];
|
|
4914
4859
|
if (value === void 0) throw new SyntaxError("Invalid character " + string[i]);
|
|
4915
4860
|
buffer = buffer << bitsPerChar | value;
|
|
4916
4861
|
bits += bitsPerChar;
|
|
@@ -4953,7 +4898,6 @@ const rfc4648 = (bitsPerChar) => (alphabet) => {
|
|
|
4953
4898
|
}
|
|
4954
4899
|
};
|
|
4955
4900
|
};
|
|
4956
|
-
|
|
4957
4901
|
//#endregion
|
|
4958
4902
|
//#region src/multibase/constants.ts
|
|
4959
4903
|
const identity = () => {
|
|
@@ -5115,7 +5059,6 @@ const codes = constants.reduce((prev, tupple) => {
|
|
|
5115
5059
|
prev[tupple[1]] = names[tupple[0]];
|
|
5116
5060
|
return prev;
|
|
5117
5061
|
}, {});
|
|
5118
|
-
|
|
5119
5062
|
//#endregion
|
|
5120
5063
|
//#region src/multibase/mod.ts
|
|
5121
5064
|
/**
|
|
@@ -5152,8 +5095,7 @@ function decodeMultibase(data) {
|
|
|
5152
5095
|
"k",
|
|
5153
5096
|
"K"
|
|
5154
5097
|
].includes(prefix)) data = data.toLowerCase();
|
|
5155
|
-
|
|
5156
|
-
return enc.decode(data.substring(1));
|
|
5098
|
+
return encoding(data[0]).decode(data.substring(1));
|
|
5157
5099
|
}
|
|
5158
5100
|
/**
|
|
5159
5101
|
* Get the encoding by name or code
|
|
@@ -5175,7 +5117,6 @@ function encodingFromBaseData(data) {
|
|
|
5175
5117
|
if (data instanceof Uint8Array) data = decodeText(data);
|
|
5176
5118
|
return encoding(data[0]);
|
|
5177
5119
|
}
|
|
5178
|
-
|
|
5179
5120
|
//#endregion
|
|
5180
5121
|
//#region src/key.ts
|
|
5181
5122
|
const algorithms = {
|
|
@@ -5200,8 +5141,7 @@ async function importSpki(pem) {
|
|
|
5200
5141
|
} catch (_) {
|
|
5201
5142
|
throw new TypeError("Invalid PEM-SPKI format.");
|
|
5202
5143
|
}
|
|
5203
|
-
const
|
|
5204
|
-
const oid = pki.algorithm.algorithmId;
|
|
5144
|
+
const oid = PublicKeyInfo.fromBER(spki).algorithm.algorithmId;
|
|
5205
5145
|
const algorithm = algorithms[oid];
|
|
5206
5146
|
if (algorithm == null) throw new TypeError("Unsupported algorithm: " + oid);
|
|
5207
5147
|
return await crypto.subtle.importKey("spki", spki, algorithm, true, ["verify"]);
|
|
@@ -5215,8 +5155,7 @@ async function importSpki(pem) {
|
|
|
5215
5155
|
*/
|
|
5216
5156
|
async function exportSpki(key) {
|
|
5217
5157
|
validateCryptoKey(key);
|
|
5218
|
-
|
|
5219
|
-
let pem = encodeBase64(spki);
|
|
5158
|
+
let pem = encodeBase64(await crypto.subtle.exportKey("spki", key));
|
|
5220
5159
|
pem = (pem.match(/.{1,64}/g) || []).join("\n");
|
|
5221
5160
|
return `-----BEGIN PUBLIC KEY-----\n${pem}\n-----END PUBLIC KEY-----\n`;
|
|
5222
5161
|
}
|
|
@@ -5228,16 +5167,14 @@ async function exportSpki(key) {
|
|
|
5228
5167
|
* @since 1.5.0
|
|
5229
5168
|
*/
|
|
5230
5169
|
function importPkcs1(pem) {
|
|
5231
|
-
|
|
5170
|
+
return importSpki(createPublicKey({
|
|
5232
5171
|
key: pem,
|
|
5233
5172
|
format: "pem",
|
|
5234
5173
|
type: "pkcs1"
|
|
5235
|
-
})
|
|
5236
|
-
const spki = key.export({
|
|
5174
|
+
}).export({
|
|
5237
5175
|
type: "spki",
|
|
5238
5176
|
format: "pem"
|
|
5239
|
-
});
|
|
5240
|
-
return importSpki(spki);
|
|
5177
|
+
}));
|
|
5241
5178
|
}
|
|
5242
5179
|
const PKCS1_HEADER = /^\s*-----BEGIN\s+RSA\s+PUBLIC\s+KEY-----\s*\n/;
|
|
5243
5180
|
/**
|
|
@@ -5264,12 +5201,11 @@ async function importMultibaseKey(key) {
|
|
|
5264
5201
|
const { code } = getMulticodecPrefix(decoded);
|
|
5265
5202
|
const content = removeMulticodecPrefix(decoded);
|
|
5266
5203
|
if (code === 4613) {
|
|
5267
|
-
const
|
|
5204
|
+
const exported = createPublicKey({
|
|
5268
5205
|
key: content,
|
|
5269
5206
|
format: "der",
|
|
5270
5207
|
type: "pkcs1"
|
|
5271
|
-
})
|
|
5272
|
-
const exported = keyObject.export({
|
|
5208
|
+
}).export({
|
|
5273
5209
|
type: "spki",
|
|
5274
5210
|
format: "der"
|
|
5275
5211
|
});
|
|
@@ -5301,21 +5237,18 @@ async function exportMultibaseKey(key) {
|
|
|
5301
5237
|
const decodedN = decodeBase64Url(jwk.n);
|
|
5302
5238
|
const n = new Uint8Array(decodedN.length + 1);
|
|
5303
5239
|
n.set(decodedN, 1);
|
|
5304
|
-
|
|
5240
|
+
content = new Sequence({ value: [new Integer({
|
|
5305
5241
|
isHexOnly: true,
|
|
5306
5242
|
valueHex: n
|
|
5307
5243
|
}), new Integer({
|
|
5308
5244
|
isHexOnly: true,
|
|
5309
5245
|
valueHex: decodeBase64Url(jwk.e)
|
|
5310
|
-
})] });
|
|
5311
|
-
content = sequence.toBER(false);
|
|
5246
|
+
})] }).toBER(false);
|
|
5312
5247
|
code = 4613;
|
|
5313
5248
|
} else throw new TypeError("Unsupported key type: " + JSON.stringify(key.algorithm));
|
|
5314
|
-
const
|
|
5315
|
-
const encoded = encodeMultibase("base58btc", prefixed);
|
|
5249
|
+
const encoded = encodeMultibase("base58btc", addMulticodecPrefix(code, new Uint8Array(content)));
|
|
5316
5250
|
return new TextDecoder().decode(encoded);
|
|
5317
5251
|
}
|
|
5318
|
-
|
|
5319
5252
|
//#endregion
|
|
5320
5253
|
//#region src/langstr.ts
|
|
5321
5254
|
/**
|
|
@@ -5344,6 +5277,5 @@ LanguageString.prototype[Symbol.for("Deno.customInspect")] = function(inspect, o
|
|
|
5344
5277
|
LanguageString.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
|
|
5345
5278
|
return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
|
|
5346
5279
|
};
|
|
5347
|
-
|
|
5348
5280
|
//#endregion
|
|
5349
|
-
export { FetchError, LanguageString, UrlError, createActivityPubRequest, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportMultibaseKey, exportSpki, getDocumentLoader, getRemoteDocument, getUserAgent, importMultibaseKey, importPem, importPkcs1, importSpki, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest,
|
|
5281
|
+
export { FetchError, LanguageString, UrlError, createActivityPubRequest, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportMultibaseKey, exportSpki, getDocumentLoader, getRemoteDocument, getUserAgent, importMultibaseKey, importPem, importPkcs1, importSpki, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, preloadedContexts, validatePublicUrl };
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
//#region
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var
|
|
9
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
-
};
|
|
8
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
11
9
|
var __copyProps = (to, from, except, desc) => {
|
|
12
10
|
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
13
11
|
key = keys[i];
|
|
@@ -22,18 +20,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
20
|
value: mod,
|
|
23
21
|
enumerable: true
|
|
24
22
|
}) : target, mod));
|
|
25
|
-
|
|
26
23
|
//#endregion
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
Object.defineProperty(exports, "__commonJSMin", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function() {
|
|
27
|
+
return __commonJSMin;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "__toESM", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function() {
|
|
33
|
+
return __toESM;
|
|
34
|
+
}
|
|
33
35
|
});
|
|
34
|
-
Object.defineProperty(exports, '__toESM', {
|
|
35
|
-
enumerable: true,
|
|
36
|
-
get: function () {
|
|
37
|
-
return __toESM;
|
|
38
|
-
}
|
|
39
|
-
});
|