@fedify/vocab-runtime 2.4.0-dev.2099 → 2.4.0-dev.2108
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/mod.cjs +10 -2
- package/dist/mod.d.cts +8 -1
- package/dist/mod.d.ts +8 -1
- package/dist/mod.js +10 -2
- package/dist/tests/{body-Gx_X7aNb.mjs → body-CH722AY8.mjs} +1 -1
- package/dist/tests/{body-Do3rWF8i.cjs → body-CuyK5rDL.cjs} +1 -1
- package/dist/tests/body.test.cjs +1 -1
- package/dist/tests/body.test.mjs +1 -1
- package/dist/tests/decimal.test.cjs +2 -2
- package/dist/tests/decimal.test.mjs +2 -2
- package/dist/tests/{docloader-DE_TBoig.cjs → docloader-CZFlVjd9.cjs} +2 -2
- package/dist/tests/{docloader-B5942Sox.mjs → docloader-Ctika9xH.mjs} +2 -2
- package/dist/tests/docloader.test.cjs +2 -2
- package/dist/tests/docloader.test.mjs +2 -2
- package/dist/tests/{key-8Qg2SbZi.cjs → key-C-AYkdJJ.cjs} +9 -1
- package/dist/tests/{key-C7MNhlkO.mjs → key-C2Db_TAJ.mjs} +9 -1
- package/dist/tests/key.test.cjs +3 -1
- package/dist/tests/key.test.mjs +3 -1
- package/dist/tests/{request-rjxC_zmv.mjs → request-DGLIPC6T.mjs} +1 -1
- package/dist/tests/{request-gfSmsjjR.cjs → request-jkmaVIP3.cjs} +1 -1
- package/dist/tests/request.test.cjs +1 -1
- package/dist/tests/request.test.mjs +1 -1
- package/package.json +1 -1
- package/src/key.test.ts +9 -0
- package/src/key.ts +11 -1
package/deno.json
CHANGED
package/dist/mod.cjs
CHANGED
|
@@ -16,7 +16,7 @@ let _multiformats_base_x = require("@multiformats/base-x");
|
|
|
16
16
|
_multiformats_base_x = require_rolldown_runtime.__toESM(_multiformats_base_x, 1);
|
|
17
17
|
//#region deno.json
|
|
18
18
|
var name = "@fedify/vocab-runtime";
|
|
19
|
-
var version = "2.4.0-dev.
|
|
19
|
+
var version = "2.4.0-dev.2108+159ea471";
|
|
20
20
|
//#endregion
|
|
21
21
|
//#region src/request.ts
|
|
22
22
|
/**
|
|
@@ -1032,12 +1032,20 @@ async function importDidKey(did) {
|
|
|
1032
1032
|
/**
|
|
1033
1033
|
* Exports an Ed25519 public key as a `did:key` DID.
|
|
1034
1034
|
*
|
|
1035
|
+
* The DID is encoded in base58-btc with the Ed25519 multicodec prefix, e.g.,
|
|
1036
|
+
* `did:key:z6Mk...`, as [FEP-ef61] requires for the DIDs of portable
|
|
1037
|
+
* objects.
|
|
1038
|
+
*
|
|
1039
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
1040
|
+
*
|
|
1035
1041
|
* @param key The Ed25519 public key.
|
|
1036
1042
|
* @returns The `did:key` DID.
|
|
1037
|
-
* @throws {TypeError} If the key is invalid or unsupported
|
|
1043
|
+
* @throws {TypeError} If the key is invalid or unsupported, or it is not
|
|
1044
|
+
* a public key.
|
|
1038
1045
|
* @since 2.4.0
|
|
1039
1046
|
*/
|
|
1040
1047
|
async function exportDidKey(key) {
|
|
1048
|
+
if (key.type !== "public") throw new TypeError("The key must be a public key.");
|
|
1041
1049
|
if (key.algorithm.name !== "Ed25519") throw new TypeError("Unsupported key type: " + JSON.stringify(key.algorithm));
|
|
1042
1050
|
return DID_KEY_PREFIX + await exportMultibaseKey(key);
|
|
1043
1051
|
}
|
package/dist/mod.d.cts
CHANGED
|
@@ -74,9 +74,16 @@ declare function importDidKey(did: string | URL): Promise<CryptoKey>;
|
|
|
74
74
|
/**
|
|
75
75
|
* Exports an Ed25519 public key as a `did:key` DID.
|
|
76
76
|
*
|
|
77
|
+
* The DID is encoded in base58-btc with the Ed25519 multicodec prefix, e.g.,
|
|
78
|
+
* `did:key:z6Mk...`, as [FEP-ef61] requires for the DIDs of portable
|
|
79
|
+
* objects.
|
|
80
|
+
*
|
|
81
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
82
|
+
*
|
|
77
83
|
* @param key The Ed25519 public key.
|
|
78
84
|
* @returns The `did:key` DID.
|
|
79
|
-
* @throws {TypeError} If the key is invalid or unsupported
|
|
85
|
+
* @throws {TypeError} If the key is invalid or unsupported, or it is not
|
|
86
|
+
* a public key.
|
|
80
87
|
* @since 2.4.0
|
|
81
88
|
*/
|
|
82
89
|
declare function exportDidKey(key: CryptoKey): Promise<string>;
|
package/dist/mod.d.ts
CHANGED
|
@@ -73,9 +73,16 @@ declare function importDidKey(did: string | URL): Promise<CryptoKey>;
|
|
|
73
73
|
/**
|
|
74
74
|
* Exports an Ed25519 public key as a `did:key` DID.
|
|
75
75
|
*
|
|
76
|
+
* The DID is encoded in base58-btc with the Ed25519 multicodec prefix, e.g.,
|
|
77
|
+
* `did:key:z6Mk...`, as [FEP-ef61] requires for the DIDs of portable
|
|
78
|
+
* objects.
|
|
79
|
+
*
|
|
80
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
81
|
+
*
|
|
76
82
|
* @param key The Ed25519 public key.
|
|
77
83
|
* @returns The `did:key` DID.
|
|
78
|
-
* @throws {TypeError} If the key is invalid or unsupported
|
|
84
|
+
* @throws {TypeError} If the key is invalid or unsupported, or it is not
|
|
85
|
+
* a public key.
|
|
79
86
|
* @since 2.4.0
|
|
80
87
|
*/
|
|
81
88
|
declare function exportDidKey(key: CryptoKey): Promise<string>;
|
package/dist/mod.js
CHANGED
|
@@ -12,7 +12,7 @@ import { PublicKeyInfo } from "pkijs";
|
|
|
12
12
|
import baseX from "@multiformats/base-x";
|
|
13
13
|
//#region deno.json
|
|
14
14
|
var name = "@fedify/vocab-runtime";
|
|
15
|
-
var version = "2.4.0-dev.
|
|
15
|
+
var version = "2.4.0-dev.2108+159ea471";
|
|
16
16
|
//#endregion
|
|
17
17
|
//#region src/request.ts
|
|
18
18
|
/**
|
|
@@ -1028,12 +1028,20 @@ async function importDidKey(did) {
|
|
|
1028
1028
|
/**
|
|
1029
1029
|
* Exports an Ed25519 public key as a `did:key` DID.
|
|
1030
1030
|
*
|
|
1031
|
+
* The DID is encoded in base58-btc with the Ed25519 multicodec prefix, e.g.,
|
|
1032
|
+
* `did:key:z6Mk...`, as [FEP-ef61] requires for the DIDs of portable
|
|
1033
|
+
* objects.
|
|
1034
|
+
*
|
|
1035
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
1036
|
+
*
|
|
1031
1037
|
* @param key The Ed25519 public key.
|
|
1032
1038
|
* @returns The `did:key` DID.
|
|
1033
|
-
* @throws {TypeError} If the key is invalid or unsupported
|
|
1039
|
+
* @throws {TypeError} If the key is invalid or unsupported, or it is not
|
|
1040
|
+
* a public key.
|
|
1034
1041
|
* @since 2.4.0
|
|
1035
1042
|
*/
|
|
1036
1043
|
async function exportDidKey(key) {
|
|
1044
|
+
if (key.type !== "public") throw new TypeError("The key must be a public key.");
|
|
1037
1045
|
if (key.algorithm.name !== "Ed25519") throw new TypeError("Unsupported key type: " + JSON.stringify(key.algorithm));
|
|
1038
1046
|
return DID_KEY_PREFIX + await exportMultibaseKey(key);
|
|
1039
1047
|
}
|
package/dist/tests/body.test.cjs
CHANGED
package/dist/tests/body.test.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as readBoundedText, t as BodyTooLargeError } from "./body-
|
|
1
|
+
import { r as readBoundedText, t as BodyTooLargeError } from "./body-CH722AY8.mjs";
|
|
2
2
|
import { deepStrictEqual, ok, rejects } from "node:assert/strict";
|
|
3
3
|
import { test } from "node:test";
|
|
4
4
|
import { gunzipSync, gzipSync } from "node:zlib";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require("./url-BqlldzT8.cjs");
|
|
2
|
-
require("./docloader-
|
|
3
|
-
require("./key-
|
|
2
|
+
require("./docloader-CZFlVjd9.cjs");
|
|
3
|
+
require("./key-C-AYkdJJ.cjs");
|
|
4
4
|
require("./multibase-B5Mea7Ip.cjs");
|
|
5
5
|
require("./digest-3FeH2Y-Q.cjs");
|
|
6
6
|
require("./langstr-C4Fl80ae.cjs");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./url-DgJM9WJn.mjs";
|
|
2
|
-
import "./docloader-
|
|
3
|
-
import "./key-
|
|
2
|
+
import "./docloader-Ctika9xH.mjs";
|
|
3
|
+
import "./key-C2Db_TAJ.mjs";
|
|
4
4
|
import "./multibase-BPnF_L4e.mjs";
|
|
5
5
|
import "./digest-COC7xDiQ.mjs";
|
|
6
6
|
import "./langstr-CQ26J_L7.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_request = require("./request-
|
|
2
|
-
const require_body = require("./body-
|
|
1
|
+
const require_request = require("./request-jkmaVIP3.cjs");
|
|
2
|
+
const require_body = require("./body-CuyK5rDL.cjs");
|
|
3
3
|
const require_contexts = require("./contexts-Ch3v2Cgu.cjs");
|
|
4
4
|
const require_link = require("./link-DlKm8bEr.cjs");
|
|
5
5
|
const require_url = require("./url-BqlldzT8.cjs");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as name, i as logRequest, n as createActivityPubRequest, o as version, t as FetchError } from "./request-
|
|
2
|
-
import { n as MAX_BODY_SIZE, r as readBoundedText, t as BodyTooLargeError } from "./body-
|
|
1
|
+
import { a as name, i as logRequest, n as createActivityPubRequest, o as version, t as FetchError } from "./request-DGLIPC6T.mjs";
|
|
2
|
+
import { n as MAX_BODY_SIZE, r as readBoundedText, t as BodyTooLargeError } from "./body-CH722AY8.mjs";
|
|
3
3
|
import { t as preloadedContexts } from "./contexts-BBX_qhBL.mjs";
|
|
4
4
|
import { t as HttpHeaderLink } from "./link-Cevmc87v.mjs";
|
|
5
5
|
import { t as UrlError, v as validatePublicUrl } from "./url-DgJM9WJn.mjs";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.cjs");
|
|
2
|
-
const require_request = require("./request-
|
|
2
|
+
const require_request = require("./request-jkmaVIP3.cjs");
|
|
3
3
|
const require_contexts = require("./contexts-Ch3v2Cgu.cjs");
|
|
4
4
|
const require_url = require("./url-BqlldzT8.cjs");
|
|
5
|
-
const require_docloader = require("./docloader-
|
|
5
|
+
const require_docloader = require("./docloader-CZFlVjd9.cjs");
|
|
6
6
|
let node_test = require("node:test");
|
|
7
7
|
let node_zlib = require("node:zlib");
|
|
8
8
|
let node_assert = require("node:assert");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as FetchError } from "./request-
|
|
1
|
+
import { t as FetchError } from "./request-DGLIPC6T.mjs";
|
|
2
2
|
import { n as cid_v1_default, t as preloadedContexts } from "./contexts-BBX_qhBL.mjs";
|
|
3
3
|
import { t as UrlError } from "./url-DgJM9WJn.mjs";
|
|
4
|
-
import { n as getRemoteDocument, t as getDocumentLoader } from "./docloader-
|
|
4
|
+
import { n as getRemoteDocument, t as getDocumentLoader } from "./docloader-Ctika9xH.mjs";
|
|
5
5
|
import { test } from "node:test";
|
|
6
6
|
import { gzipSync } from "node:zlib";
|
|
7
7
|
import { deepStrictEqual, ok, rejects } from "node:assert";
|
|
@@ -142,12 +142,20 @@ async function importDidKey(did) {
|
|
|
142
142
|
/**
|
|
143
143
|
* Exports an Ed25519 public key as a `did:key` DID.
|
|
144
144
|
*
|
|
145
|
+
* The DID is encoded in base58-btc with the Ed25519 multicodec prefix, e.g.,
|
|
146
|
+
* `did:key:z6Mk...`, as [FEP-ef61] requires for the DIDs of portable
|
|
147
|
+
* objects.
|
|
148
|
+
*
|
|
149
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
150
|
+
*
|
|
145
151
|
* @param key The Ed25519 public key.
|
|
146
152
|
* @returns The `did:key` DID.
|
|
147
|
-
* @throws {TypeError} If the key is invalid or unsupported
|
|
153
|
+
* @throws {TypeError} If the key is invalid or unsupported, or it is not
|
|
154
|
+
* a public key.
|
|
148
155
|
* @since 2.4.0
|
|
149
156
|
*/
|
|
150
157
|
async function exportDidKey(key) {
|
|
158
|
+
if (key.type !== "public") throw new TypeError("The key must be a public key.");
|
|
151
159
|
if (key.algorithm.name !== "Ed25519") throw new TypeError("Unsupported key type: " + JSON.stringify(key.algorithm));
|
|
152
160
|
return DID_KEY_PREFIX + await exportMultibaseKey(key);
|
|
153
161
|
}
|
|
@@ -142,12 +142,20 @@ async function importDidKey(did) {
|
|
|
142
142
|
/**
|
|
143
143
|
* Exports an Ed25519 public key as a `did:key` DID.
|
|
144
144
|
*
|
|
145
|
+
* The DID is encoded in base58-btc with the Ed25519 multicodec prefix, e.g.,
|
|
146
|
+
* `did:key:z6Mk...`, as [FEP-ef61] requires for the DIDs of portable
|
|
147
|
+
* objects.
|
|
148
|
+
*
|
|
149
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
150
|
+
*
|
|
145
151
|
* @param key The Ed25519 public key.
|
|
146
152
|
* @returns The `did:key` DID.
|
|
147
|
-
* @throws {TypeError} If the key is invalid or unsupported
|
|
153
|
+
* @throws {TypeError} If the key is invalid or unsupported, or it is not
|
|
154
|
+
* a public key.
|
|
148
155
|
* @since 2.4.0
|
|
149
156
|
*/
|
|
150
157
|
async function exportDidKey(key) {
|
|
158
|
+
if (key.type !== "public") throw new TypeError("The key must be a public key.");
|
|
151
159
|
if (key.algorithm.name !== "Ed25519") throw new TypeError("Unsupported key type: " + JSON.stringify(key.algorithm));
|
|
152
160
|
return DID_KEY_PREFIX + await exportMultibaseKey(key);
|
|
153
161
|
}
|
package/dist/tests/key.test.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_multicodec = require("./multicodec-CLRPeW4N.cjs");
|
|
2
|
-
const require_key = require("./key-
|
|
2
|
+
const require_key = require("./key-C-AYkdJJ.cjs");
|
|
3
3
|
const require_multibase = require("./multibase-B5Mea7Ip.cjs");
|
|
4
4
|
let node_test = require("node:test");
|
|
5
5
|
let node_assert = require("node:assert");
|
|
@@ -78,6 +78,8 @@ const ed25519Multibase = "z6MksHj1MJnidCtDiyYW9ugNFftoX9fLK4bornTxmMZ6X7vq";
|
|
|
78
78
|
(0, node_assert.deepStrictEqual)(await require_key.exportJwk(await require_key.importDidKey(new URL(did))), ed25519Jwk);
|
|
79
79
|
const rsaKey = await require_key.importJwk(rsaJwk, "public");
|
|
80
80
|
await (0, node_assert.rejects)(() => require_key.exportDidKey(rsaKey), TypeError);
|
|
81
|
+
const { privateKey } = await crypto.subtle.generateKey("Ed25519", true, ["sign", "verify"]);
|
|
82
|
+
await (0, node_assert.rejects)(() => require_key.exportDidKey(privateKey), /* @__PURE__ */ new TypeError("The key must be a public key."));
|
|
81
83
|
await (0, node_assert.rejects)(() => require_key.importDidKey(`did:key:${rsaMultibase}`), /* @__PURE__ */ new TypeError("Unsupported did:key type: 0x1205"));
|
|
82
84
|
});
|
|
83
85
|
(0, node_test.test)("parseDidKeyVerificationMethod()", async () => {
|
package/dist/tests/key.test.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as addMulticodecPrefix } from "./multicodec-CRIj_05H.mjs";
|
|
2
|
-
import { a as importMultibaseKey, c as importSpki, d as importJwk, i as importDidKey, l as parseDidKeyVerificationMethod, n as exportMultibaseKey, o as importPem, r as exportSpki, s as importPkcs1, t as exportDidKey, u as exportJwk } from "./key-
|
|
2
|
+
import { a as importMultibaseKey, c as importSpki, d as importJwk, i as importDidKey, l as parseDidKeyVerificationMethod, n as exportMultibaseKey, o as importPem, r as exportSpki, s as importPkcs1, t as exportDidKey, u as exportJwk } from "./key-C2Db_TAJ.mjs";
|
|
3
3
|
import { n as encodeMultibase } from "./multibase-BPnF_L4e.mjs";
|
|
4
4
|
import { test } from "node:test";
|
|
5
5
|
import { deepStrictEqual, rejects } from "node:assert";
|
|
@@ -78,6 +78,8 @@ test("exportDidKey() and importDidKey()", async () => {
|
|
|
78
78
|
deepStrictEqual(await exportJwk(await importDidKey(new URL(did))), ed25519Jwk);
|
|
79
79
|
const rsaKey = await importJwk(rsaJwk, "public");
|
|
80
80
|
await rejects(() => exportDidKey(rsaKey), TypeError);
|
|
81
|
+
const { privateKey } = await crypto.subtle.generateKey("Ed25519", true, ["sign", "verify"]);
|
|
82
|
+
await rejects(() => exportDidKey(privateKey), /* @__PURE__ */ new TypeError("The key must be a public key."));
|
|
81
83
|
await rejects(() => importDidKey(`did:key:${rsaMultibase}`), /* @__PURE__ */ new TypeError("Unsupported did:key type: 0x1205"));
|
|
82
84
|
});
|
|
83
85
|
test("parseDidKeyVerificationMethod()", async () => {
|
|
@@ -3,7 +3,7 @@ let node_process = require("node:process");
|
|
|
3
3
|
node_process = require_rolldown_runtime.__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.2108+159ea471";
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/request.ts
|
|
9
9
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.cjs");
|
|
2
|
-
const require_request = require("./request-
|
|
2
|
+
const require_request = require("./request-jkmaVIP3.cjs");
|
|
3
3
|
let node_test = require("node:test");
|
|
4
4
|
let node_process = require("node:process");
|
|
5
5
|
node_process = require_rolldown_runtime.__toESM(node_process, 1);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createActivityPubRequest, o as version, r as getUserAgent } from "./request-
|
|
1
|
+
import { n as createActivityPubRequest, o as version, r as getUserAgent } from "./request-DGLIPC6T.mjs";
|
|
2
2
|
import { test } from "node:test";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { deepStrictEqual } from "node:assert";
|
package/package.json
CHANGED
package/src/key.test.ts
CHANGED
|
@@ -218,6 +218,15 @@ test("exportDidKey() and importDidKey()", async () => {
|
|
|
218
218
|
() => exportDidKey(rsaKey),
|
|
219
219
|
TypeError,
|
|
220
220
|
);
|
|
221
|
+
const { privateKey } = await crypto.subtle.generateKey(
|
|
222
|
+
"Ed25519",
|
|
223
|
+
true,
|
|
224
|
+
["sign", "verify"],
|
|
225
|
+
) as CryptoKeyPair;
|
|
226
|
+
await rejects(
|
|
227
|
+
() => exportDidKey(privateKey),
|
|
228
|
+
new TypeError("The key must be a public key."),
|
|
229
|
+
);
|
|
221
230
|
await rejects(
|
|
222
231
|
() => importDidKey(`did:key:${rsaMultibase}`),
|
|
223
232
|
new TypeError("Unsupported did:key type: 0x1205"),
|
package/src/key.ts
CHANGED
|
@@ -174,12 +174,22 @@ export async function importDidKey(did: string | URL): Promise<CryptoKey> {
|
|
|
174
174
|
/**
|
|
175
175
|
* Exports an Ed25519 public key as a `did:key` DID.
|
|
176
176
|
*
|
|
177
|
+
* The DID is encoded in base58-btc with the Ed25519 multicodec prefix, e.g.,
|
|
178
|
+
* `did:key:z6Mk...`, as [FEP-ef61] requires for the DIDs of portable
|
|
179
|
+
* objects.
|
|
180
|
+
*
|
|
181
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
182
|
+
*
|
|
177
183
|
* @param key The Ed25519 public key.
|
|
178
184
|
* @returns The `did:key` DID.
|
|
179
|
-
* @throws {TypeError} If the key is invalid or unsupported
|
|
185
|
+
* @throws {TypeError} If the key is invalid or unsupported, or it is not
|
|
186
|
+
* a public key.
|
|
180
187
|
* @since 2.4.0
|
|
181
188
|
*/
|
|
182
189
|
export async function exportDidKey(key: CryptoKey): Promise<string> {
|
|
190
|
+
if (key.type !== "public") {
|
|
191
|
+
throw new TypeError("The key must be a public key.");
|
|
192
|
+
}
|
|
183
193
|
if (key.algorithm.name !== "Ed25519") {
|
|
184
194
|
throw new TypeError(
|
|
185
195
|
"Unsupported key type: " + JSON.stringify(key.algorithm),
|