@fedify/fedify 1.9.0-pr.428.1587 → 1.9.0-pr.431.1597
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/dist/actor-CHOM_AN3.d.cts +128 -0
- package/dist/actor-CfaqWvJb.cjs +37783 -0
- package/dist/{actor-CRWrH2fJ.js → actor-Detmisdi.js} +190 -190
- package/dist/{actor-BAyhNMtT.js → actor-Dw7av4Zk.js} +1 -1
- package/dist/{authdocloader-DuPcJhwz.js → authdocloader-5UJ5Gme-.js} +6 -6
- package/dist/authdocloader-BVYv0Ct8.cjs +58 -0
- package/dist/{authdocloader-C1iaSe2N.js → authdocloader-ZlLoXSxM.js} +3 -3
- package/dist/{builder-DLD2OVGE.js → builder-BbKfqPmR.js} +4 -4
- package/dist/chunk-DqRYRqnO.cjs +34 -0
- package/dist/{client-PZOCn5-Y.js → client-DgRjF0ha.js} +1 -1
- package/dist/client-DjT_tegg.d.cts +294 -0
- package/dist/compat/mod.cjs +10 -0
- package/dist/compat/mod.d.cts +13 -0
- package/dist/compat/mod.js +5 -5
- package/dist/compat/transformers.test.js +16 -16
- package/dist/compat-DmDDELst.cjs +4 -0
- package/dist/compat-nxUqe4Z-.js +4 -0
- package/dist/context-KXVF2AhH.d.cts +2261 -0
- package/dist/{docloader-6Si9l3iy.js → docloader-BKf9RWX4.js} +4 -4
- package/dist/docloader-D-MrRyHl.d.cts +219 -0
- package/dist/docloader-eqgyMp7h.cjs +4682 -0
- package/dist/{esm-WCi84Tv_.js → esm-B_ZjJ1sB.js} +1 -1
- package/dist/federation/builder.test.js +5 -5
- package/dist/federation/collection.test.js +3 -3
- package/dist/federation/handler.test.js +17 -17
- package/dist/federation/inbox.test.js +4 -4
- package/dist/federation/keycache.test.js +4 -4
- package/dist/federation/kv.test.js +3 -3
- package/dist/federation/middleware.test.js +18 -18
- package/dist/federation/mod.cjs +29 -0
- package/dist/federation/mod.d.cts +13 -0
- package/dist/federation/mod.js +15 -15
- package/dist/federation/mq.test.js +3 -3
- package/dist/federation/retry.test.js +3 -3
- package/dist/federation/router.test.js +3 -3
- package/dist/federation/send.test.js +10 -10
- package/dist/{federation-CMX7WzeL.js → federation-D1U8YY9t.js} +3 -3
- package/dist/federation-H2_En3j5.cjs +244 -0
- package/dist/http-B_zBcsai.d.cts +253 -0
- package/dist/{http-CFiUVZfi.js → http-C5XLveZw.js} +2 -2
- package/dist/{http-DEm-ammv.js → http-CwlUFNG4.js} +6 -6
- package/dist/http-_vjuGcXn.cjs +826 -0
- package/dist/{inbox-VMSM478g.js → inbox-sVXiVBbT.js} +1 -1
- package/dist/key-19P2dWvf.cjs +290 -0
- package/dist/{key-CdGoFWIl.js → key-BCWvPOkD.js} +5 -5
- package/dist/key-CsQ7J8-m.js +10 -0
- package/dist/key-Dt7qJaQT.cjs +10 -0
- package/dist/{key-LefgNv9I.js → key-Jrnr66vx.js} +2 -2
- package/dist/{key-D3__azaY.js → key-lpATOAE4.js} +3 -3
- package/dist/{keycache-9EJyq0-_.js → keycache-ogQInQck.js} +1 -1
- package/dist/{keys-Dn0SWAWf.js → keys-DcGsKtHW.js} +1 -1
- package/dist/kv-63Cil1MD.d.cts +81 -0
- package/dist/{ld-Dgthw_5_.js → ld-BSE4jnyK.js} +2 -2
- package/dist/lookup-D96ipStp.cjs +137 -0
- package/dist/{lookup-D0EUk78B.js → lookup-D_-F1hLw.js} +4 -4
- package/dist/{lookup-Bj_u3eYM.js → lookup-DdxOle8f.js} +1 -1
- package/dist/middleware-B0f850Ei.cjs +17 -0
- package/dist/middleware-B2DFqtJ-.cjs +4240 -0
- package/dist/middleware-COHAbwGs.js +17 -0
- package/dist/{middleware-dku9cdga.js → middleware-CuTcPjfP.js} +13 -13
- package/dist/middleware-Dt7C7qpw.js +26 -0
- package/dist/{middleware-CqVZVdeM.js → middleware-T_y4Bnvw.js} +14 -14
- package/dist/mod-C2tOeRkN.d.cts +1 -0
- package/dist/mod-C3CGxYoF.d.cts +102 -0
- package/dist/mod-COw_caPC.d.cts +266 -0
- package/dist/mod-FZd39qVq.d.cts +1 -0
- package/dist/mod-NKH_G-IY.d.cts +289 -0
- package/dist/mod-YfAcrVbP.d.cts +80 -0
- package/dist/mod-jQ4OODsl.d.cts +113 -0
- package/dist/mod.cjs +152 -0
- package/dist/mod.d.cts +17 -0
- package/dist/mod.js +20 -20
- package/dist/mq-B7R1Q-M5.d.cts +140 -0
- package/dist/nodeinfo/client.test.js +5 -5
- package/dist/nodeinfo/handler.test.js +16 -16
- package/dist/nodeinfo/mod.cjs +13 -0
- package/dist/nodeinfo/mod.d.cts +5 -0
- package/dist/nodeinfo/mod.js +6 -6
- package/dist/nodeinfo/semver.test.js +3 -3
- package/dist/nodeinfo/types.test.js +3 -3
- package/dist/nodeinfo-Co9lJrWl.cjs +4 -0
- package/dist/nodeinfo-DfycQ8Wf.js +4 -0
- package/dist/owner-C9Ry0TOI.d.cts +67 -0
- package/dist/{owner-QgsLL0FU.js → owner-DJtc8evi.js} +2 -2
- package/dist/{proof-B4xoN40A.js → proof-9OMp0o4n.js} +2 -2
- package/dist/{proof-E_33BNCY.js → proof-BuPk23Er.js} +6 -6
- package/dist/proof-CRHppbRk.cjs +673 -0
- package/dist/runtime/authdocloader.test.js +9 -9
- package/dist/runtime/docloader.test.js +4 -4
- package/dist/runtime/key.test.js +5 -5
- package/dist/runtime/langstr.test.js +3 -3
- package/dist/runtime/mod.cjs +25 -0
- package/dist/runtime/mod.d.cts +6 -0
- package/dist/runtime/mod.js +10 -10
- package/dist/runtime/multibase/multibase.test.js +3 -3
- package/dist/runtime/url.test.js +3 -3
- package/dist/runtime-C58AJWSv.cjs +4 -0
- package/dist/runtime-DPYEDf-o.js +4 -0
- package/dist/{send-ByaKiMsV.js → send-cXerEJm9.js} +2 -2
- package/dist/sig/http.test.js +8 -8
- package/dist/sig/key.test.js +6 -6
- package/dist/sig/ld.test.js +7 -7
- package/dist/sig/mod.cjs +30 -0
- package/dist/sig/mod.d.cts +8 -0
- package/dist/sig/mod.js +10 -10
- package/dist/sig/owner.test.js +7 -7
- package/dist/sig/proof.test.js +7 -7
- package/dist/sig-ByHXzqUi.cjs +4 -0
- package/dist/sig-Cj3tk-ig.js +4 -0
- package/dist/testing/docloader.test.js +3 -3
- package/dist/testing/mod.js +3 -3
- package/dist/{testing-DK6Jj8Bp.js → testing-BX6IA3LR.js} +2 -2
- package/dist/{transformers-Dna8Fg7k.js → transformers-BFT6d7J5.js} +3 -3
- package/dist/transformers-CoBS-oFG.cjs +116 -0
- package/dist/{type-CKxYS9Sh.js → type-DF9yoIpt.js} +186 -186
- package/dist/types-DcKQIzdO.cjs +488 -0
- package/dist/{types-DNXXKtNN.js → types-Q17QxOOC.js} +4 -4
- package/dist/vocab/actor.test.js +5 -5
- package/dist/vocab/lookup.test.js +4 -4
- package/dist/vocab/mod.cjs +87 -0
- package/dist/vocab/mod.d.cts +6 -0
- package/dist/vocab/mod.js +7 -7
- package/dist/vocab/type.test.js +3 -3
- package/dist/vocab/vocab.test.js +4 -4
- package/dist/{vocab-BXEmH50Y.js → vocab-BUc_4ZsW.js} +6 -6
- package/dist/vocab-BzGg7ltX.d.cts +14629 -0
- package/dist/vocab-Du8FV6H1.cjs +282 -0
- package/dist/webfinger/handler.test.js +16 -16
- package/dist/webfinger/lookup.test.js +4 -4
- package/dist/webfinger/mod.cjs +9 -0
- package/dist/webfinger/mod.d.cts +4 -0
- package/dist/webfinger/mod.js +6 -6
- package/dist/webfinger-BjOEdFPs.cjs +4 -0
- package/dist/webfinger-De_bU0iE.js +4 -0
- package/dist/x/cfworkers.cjs +100 -0
- package/dist/x/cfworkers.d.cts +59 -0
- package/dist/x/cfworkers.js +3 -3
- package/dist/x/cfworkers.test.js +3 -3
- package/dist/x/hono.cjs +61 -0
- package/dist/x/hono.d.cts +54 -0
- package/dist/x/hono.js +3 -3
- package/dist/x/sveltekit.cjs +69 -0
- package/dist/x/sveltekit.d.cts +46 -0
- package/dist/x/sveltekit.js +3 -3
- package/package.json +68 -12
- package/dist/compat-Bb5myD13.js +0 -4
- package/dist/key-CiJCx5-9.js +0 -10
- package/dist/middleware-1wWyj5B6.js +0 -26
- package/dist/middleware-BxSWANLr.js +0 -17
- package/dist/nodeinfo-CyEbLjHs.js +0 -4
- package/dist/runtime-BSkOVUWM.js +0 -4
- package/dist/sig-BXJO--F9.js +0 -4
- package/dist/webfinger-C3GIyXIg.js +0 -4
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
4
|
+
|
5
|
+
import "./transformers-BFT6d7J5.js";
|
6
|
+
import "./docloader-BKf9RWX4.js";
|
7
|
+
import "./actor-Detmisdi.js";
|
8
|
+
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-T_y4Bnvw.js";
|
9
|
+
import "./lookup-D_-F1hLw.js";
|
10
|
+
import "./key-BCWvPOkD.js";
|
11
|
+
import "./http-CwlUFNG4.js";
|
12
|
+
import "./proof-BuPk23Er.js";
|
13
|
+
import "./types-Q17QxOOC.js";
|
14
|
+
import "./authdocloader-5UJ5Gme-.js";
|
15
|
+
import "./vocab-BUc_4ZsW.js";
|
16
|
+
|
17
|
+
export { FederationImpl };
|
@@ -3,22 +3,22 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, deno_default, getDocumentLoader, getTypeId, kvCache, lookupWebFinger } from "./type-
|
7
|
-
import { getNodeInfo } from "./client-
|
8
|
-
import { RouterError, lookupObject, traverseCollection } from "./lookup-
|
6
|
+
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, deno_default, getDocumentLoader, getTypeId, kvCache, lookupWebFinger } from "./type-DF9yoIpt.js";
|
7
|
+
import { getNodeInfo } from "./client-DgRjF0ha.js";
|
8
|
+
import { RouterError, lookupObject, traverseCollection } from "./lookup-DdxOle8f.js";
|
9
9
|
import { nodeInfoToJson } from "./types-BIgY6c-l.js";
|
10
|
-
import { exportJwk, importJwk, validateCryptoKey } from "./key-
|
11
|
-
import { verifyRequest } from "./http-
|
12
|
-
import { getAuthenticatedDocumentLoader } from "./authdocloader-
|
13
|
-
import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-
|
14
|
-
import { doesActorOwnKey, getKeyOwner } from "./owner-
|
15
|
-
import { signObject, verifyObject } from "./proof-
|
16
|
-
import { routeActivity } from "./inbox-
|
17
|
-
import { FederationBuilderImpl } from "./builder-
|
10
|
+
import { exportJwk, importJwk, validateCryptoKey } from "./key-Jrnr66vx.js";
|
11
|
+
import { verifyRequest } from "./http-C5XLveZw.js";
|
12
|
+
import { getAuthenticatedDocumentLoader } from "./authdocloader-ZlLoXSxM.js";
|
13
|
+
import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-BSE4jnyK.js";
|
14
|
+
import { doesActorOwnKey, getKeyOwner } from "./owner-DJtc8evi.js";
|
15
|
+
import { signObject, verifyObject } from "./proof-9OMp0o4n.js";
|
16
|
+
import { routeActivity } from "./inbox-sVXiVBbT.js";
|
17
|
+
import { FederationBuilderImpl } from "./builder-BbKfqPmR.js";
|
18
18
|
import { buildCollectionSynchronizationHeader } from "./collection-CSzG2j1P.js";
|
19
|
-
import { KvKeyCache } from "./keycache-
|
19
|
+
import { KvKeyCache } from "./keycache-ogQInQck.js";
|
20
20
|
import { createExponentialBackoffPolicy } from "./retry-D4GJ670a.js";
|
21
|
-
import { extractInboxes, sendActivity } from "./send-
|
21
|
+
import { extractInboxes, sendActivity } from "./send-cXerEJm9.js";
|
22
22
|
import { getLogger, withContext } from "@logtape/logtape";
|
23
23
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
24
24
|
import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_RESPONSE_HEADER, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
4
|
+
globalThis.addEventListener = () => {};
|
5
|
+
|
6
|
+
import "./type-DF9yoIpt.js";
|
7
|
+
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-CuTcPjfP.js";
|
8
|
+
import "./semver-dArNLkR9.js";
|
9
|
+
import "./client-DgRjF0ha.js";
|
10
|
+
import "./lookup-DdxOle8f.js";
|
11
|
+
import "./types-BIgY6c-l.js";
|
12
|
+
import "./actor-Dw7av4Zk.js";
|
13
|
+
import "./key-Jrnr66vx.js";
|
14
|
+
import "./http-C5XLveZw.js";
|
15
|
+
import "./authdocloader-ZlLoXSxM.js";
|
16
|
+
import "./ld-BSE4jnyK.js";
|
17
|
+
import "./owner-DJtc8evi.js";
|
18
|
+
import "./proof-9OMp0o4n.js";
|
19
|
+
import "./inbox-sVXiVBbT.js";
|
20
|
+
import "./builder-BbKfqPmR.js";
|
21
|
+
import "./collection-CSzG2j1P.js";
|
22
|
+
import "./keycache-ogQInQck.js";
|
23
|
+
import "./retry-D4GJ670a.js";
|
24
|
+
import "./send-cXerEJm9.js";
|
25
|
+
|
26
|
+
export { FederationImpl };
|
@@ -1,17 +1,17 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
import { getDefaultActivityTransformers } from "./transformers-
|
6
|
-
import { deno_default, getDocumentLoader, kvCache } from "./docloader-
|
7
|
-
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId } from "./actor-
|
8
|
-
import { lookupWebFinger } from "./lookup-
|
9
|
-
import { exportJwk, importJwk, validateCryptoKey } from "./key-
|
10
|
-
import { doubleKnock, verifyRequest } from "./http-
|
11
|
-
import { detachSignature, doesActorOwnKey, getKeyOwner, hasSignature, signJsonLd, signObject, verifyJsonLd, verifyObject } from "./proof-
|
12
|
-
import { getNodeInfo, nodeInfoToJson } from "./types-
|
13
|
-
import { getAuthenticatedDocumentLoader } from "./authdocloader-
|
14
|
-
import { lookupObject, traverseCollection } from "./vocab-
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
4
|
+
|
5
|
+
import { getDefaultActivityTransformers } from "./transformers-BFT6d7J5.js";
|
6
|
+
import { deno_default, getDocumentLoader, kvCache } from "./docloader-BKf9RWX4.js";
|
7
|
+
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId } from "./actor-Detmisdi.js";
|
8
|
+
import { lookupWebFinger } from "./lookup-D_-F1hLw.js";
|
9
|
+
import { exportJwk, importJwk, validateCryptoKey } from "./key-BCWvPOkD.js";
|
10
|
+
import { doubleKnock, verifyRequest } from "./http-CwlUFNG4.js";
|
11
|
+
import { detachSignature, doesActorOwnKey, getKeyOwner, hasSignature, signJsonLd, signObject, verifyJsonLd, verifyObject } from "./proof-BuPk23Er.js";
|
12
|
+
import { getNodeInfo, nodeInfoToJson } from "./types-Q17QxOOC.js";
|
13
|
+
import { getAuthenticatedDocumentLoader } from "./authdocloader-5UJ5Gme-.js";
|
14
|
+
import { lookupObject, traverseCollection } from "./vocab-BUc_4ZsW.js";
|
15
15
|
import { getLogger, withContext } from "@logtape/logtape";
|
16
16
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
17
17
|
import { encodeHex } from "byte-encodings/hex";
|
@@ -321,7 +321,7 @@ var FederationBuilderImpl = class {
|
|
321
321
|
this.collectionTypeIds = {};
|
322
322
|
}
|
323
323
|
async build(options) {
|
324
|
-
const { FederationImpl: FederationImpl$1 } = await import("./middleware-
|
324
|
+
const { FederationImpl: FederationImpl$1 } = await import("./middleware-COHAbwGs.js");
|
325
325
|
const f = new FederationImpl$1(options);
|
326
326
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
327
327
|
f.router = this.router.clone();
|
@@ -0,0 +1 @@
|
|
1
|
+
export { };
|
@@ -0,0 +1,102 @@
|
|
1
|
+
import { DocumentLoader, DocumentLoaderFactoryOptions } from "./docloader-D-MrRyHl.cjs";
|
2
|
+
import { HttpMessageSignaturesSpecDeterminer } from "./http-B_zBcsai.cjs";
|
3
|
+
import { TracerProvider } from "@opentelemetry/api";
|
4
|
+
|
5
|
+
//#region src/runtime/authdocloader.d.ts
|
6
|
+
/**
|
7
|
+
* Options for {@link getAuthenticatedDocumentLoader}.
|
8
|
+
* @see {@link getAuthenticatedDocumentLoader}
|
9
|
+
* @since 1.3.0
|
10
|
+
*/
|
11
|
+
interface GetAuthenticatedDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
|
12
|
+
/**
|
13
|
+
* An optional spec determiner for HTTP Message Signatures.
|
14
|
+
* It determines the spec to use for signing requests.
|
15
|
+
* It is used for double-knocking
|
16
|
+
* (see <https://swicg.github.io/activitypub-http-signature/#how-to-upgrade-supported-versions>).
|
17
|
+
* @since 1.6.0
|
18
|
+
*/
|
19
|
+
specDeterminer?: HttpMessageSignaturesSpecDeterminer;
|
20
|
+
/**
|
21
|
+
* The OpenTelemetry tracer provider. If omitted, the global tracer provider
|
22
|
+
* is used.
|
23
|
+
* @since 1.6.0
|
24
|
+
*/
|
25
|
+
tracerProvider?: TracerProvider;
|
26
|
+
}
|
27
|
+
/**
|
28
|
+
* Gets an authenticated {@link DocumentLoader} for the given identity.
|
29
|
+
* Note that an authenticated document loader intentionally does not cache
|
30
|
+
* the fetched documents.
|
31
|
+
* @param identity The identity to get the document loader for.
|
32
|
+
* The actor's key pair.
|
33
|
+
* @param options The options for the document loader.
|
34
|
+
* @returns The authenticated document loader.
|
35
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
36
|
+
* @since 0.4.0
|
37
|
+
*/
|
38
|
+
declare function getAuthenticatedDocumentLoader(identity: {
|
39
|
+
keyId: URL;
|
40
|
+
privateKey: CryptoKey;
|
41
|
+
}, {
|
42
|
+
allowPrivateAddress,
|
43
|
+
userAgent,
|
44
|
+
specDeterminer,
|
45
|
+
tracerProvider
|
46
|
+
}?: GetAuthenticatedDocumentLoaderOptions): DocumentLoader;
|
47
|
+
//#endregion
|
48
|
+
//#region src/runtime/key.d.ts
|
49
|
+
/**
|
50
|
+
* Imports a PEM-SPKI formatted public key.
|
51
|
+
* @param pem The PEM-SPKI formatted public key.
|
52
|
+
* @returns The imported public key.
|
53
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
54
|
+
* @since 0.5.0
|
55
|
+
*/
|
56
|
+
declare function importSpki(pem: string): Promise<CryptoKey>;
|
57
|
+
/**
|
58
|
+
* Exports a public key in PEM-SPKI format.
|
59
|
+
* @param key The public key to export.
|
60
|
+
* @returns The exported public key in PEM-SPKI format.
|
61
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
62
|
+
* @since 0.5.0
|
63
|
+
*/
|
64
|
+
declare function exportSpki(key: CryptoKey): Promise<string>;
|
65
|
+
/**
|
66
|
+
* Imports a PEM-PKCS#1 formatted public key.
|
67
|
+
* @param pem The PEM-PKCS#1 formatted public key.
|
68
|
+
* @returns The imported public key.
|
69
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
70
|
+
* @since 1.5.0
|
71
|
+
*/
|
72
|
+
declare function importPkcs1(pem: string): Promise<CryptoKey>;
|
73
|
+
/**
|
74
|
+
* Imports a PEM formatted public key (SPKI or PKCS#1).
|
75
|
+
* @param pem The PEM formatted public key to import (SPKI or PKCS#1).
|
76
|
+
* @returns The imported public key.
|
77
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
78
|
+
* @since 1.5.0
|
79
|
+
*/
|
80
|
+
declare function importPem(pem: string): Promise<CryptoKey>;
|
81
|
+
/**
|
82
|
+
* Imports a [Multibase]-encoded public key.
|
83
|
+
*
|
84
|
+
* [Multibase]: https://www.w3.org/TR/vc-data-integrity/#multibase-0
|
85
|
+
* @param key The Multibase-encoded public key.
|
86
|
+
* @returns The imported public key.
|
87
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
88
|
+
* @since 0.10.0
|
89
|
+
*/
|
90
|
+
declare function importMultibaseKey(key: string): Promise<CryptoKey>;
|
91
|
+
/**
|
92
|
+
* Exports a public key in [Multibase] format.
|
93
|
+
*
|
94
|
+
* [Multibase]: https://www.w3.org/TR/vc-data-integrity/#multibase-0
|
95
|
+
* @param key The public key to export.
|
96
|
+
* @returns The exported public key in Multibase format.
|
97
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
98
|
+
* @since 0.10.0
|
99
|
+
*/
|
100
|
+
declare function exportMultibaseKey(key: CryptoKey): Promise<string>;
|
101
|
+
//#endregion
|
102
|
+
export { GetAuthenticatedDocumentLoaderOptions, exportMultibaseKey, exportSpki, getAuthenticatedDocumentLoader, importMultibaseKey, importPem, importPkcs1, importSpki };
|
@@ -0,0 +1,266 @@
|
|
1
|
+
import { DocumentLoader } from "./docloader-D-MrRyHl.cjs";
|
2
|
+
import { CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1 } from "./vocab-BzGg7ltX.cjs";
|
3
|
+
import { KeyCache } from "./http-B_zBcsai.cjs";
|
4
|
+
import { TracerProvider } from "@opentelemetry/api";
|
5
|
+
|
6
|
+
//#region src/sig/ld.d.ts
|
7
|
+
/**
|
8
|
+
* A signature of a JSON-LD document.
|
9
|
+
* @since 1.0.0
|
10
|
+
*/
|
11
|
+
interface Signature {
|
12
|
+
"@context"?: "https://w3id.org/identity/v1";
|
13
|
+
type: "RsaSignature2017";
|
14
|
+
id?: string;
|
15
|
+
creator: string;
|
16
|
+
created: string;
|
17
|
+
signatureValue: string;
|
18
|
+
}
|
19
|
+
/**
|
20
|
+
* Attaches a LD signature to the given JSON-LD document.
|
21
|
+
* @param jsonLd The JSON-LD document to attach the signature to. It is not
|
22
|
+
* modified.
|
23
|
+
* @param signature The signature to attach.
|
24
|
+
* @returns The JSON-LD document with the attached signature.
|
25
|
+
* @throws {TypeError} If the input document is not a valid JSON-LD document.
|
26
|
+
* @since 1.0.0
|
27
|
+
*/
|
28
|
+
declare function attachSignature(jsonLd: unknown, signature: Signature): {
|
29
|
+
signature: Signature;
|
30
|
+
};
|
31
|
+
/**
|
32
|
+
* Options for creating Linked Data Signatures.
|
33
|
+
* @since 1.0.0
|
34
|
+
*/
|
35
|
+
interface CreateSignatureOptions {
|
36
|
+
/**
|
37
|
+
* The context loader for loading remote JSON-LD contexts.
|
38
|
+
*/
|
39
|
+
contextLoader?: DocumentLoader;
|
40
|
+
/**
|
41
|
+
* The time when the signature was created. If not specified, the current
|
42
|
+
* time will be used.
|
43
|
+
*/
|
44
|
+
created?: Temporal.Instant;
|
45
|
+
}
|
46
|
+
/**
|
47
|
+
* Creates a LD signature for the given JSON-LD document.
|
48
|
+
* @param jsonLd The JSON-LD document to sign.
|
49
|
+
* @param privateKey The private key to sign the document.
|
50
|
+
* @param keyId The ID of the public key that corresponds to the private key.
|
51
|
+
* @param options Additional options for creating the signature.
|
52
|
+
* See also {@link CreateSignatureOptions}.
|
53
|
+
* @return The created signature.
|
54
|
+
* @throws {TypeError} If the private key is invalid or unsupported.
|
55
|
+
* @since 1.0.0
|
56
|
+
*/
|
57
|
+
declare function createSignature(jsonLd: unknown, privateKey: CryptoKey, keyId: URL, {
|
58
|
+
contextLoader,
|
59
|
+
created
|
60
|
+
}?: CreateSignatureOptions): Promise<Signature>;
|
61
|
+
/**
|
62
|
+
* Options for signing JSON-LD documents.
|
63
|
+
* @since 1.0.0
|
64
|
+
*/
|
65
|
+
interface SignJsonLdOptions extends CreateSignatureOptions {
|
66
|
+
/**
|
67
|
+
* The OpenTelemetry tracer provider for tracing the signing process.
|
68
|
+
* If omitted, the global tracer provider is used.
|
69
|
+
* @since 1.3.0
|
70
|
+
*/
|
71
|
+
tracerProvider?: TracerProvider;
|
72
|
+
}
|
73
|
+
/**
|
74
|
+
* Signs the given JSON-LD document with the private key and returns the signed
|
75
|
+
* JSON-LD document.
|
76
|
+
* @param jsonLd The JSON-LD document to sign.
|
77
|
+
* @param privateKey The private key to sign the document.
|
78
|
+
* @param keyId The key ID to use in the signature. It will be used by the
|
79
|
+
* verifier to fetch the corresponding public key.
|
80
|
+
* @param options Additional options for signing the document.
|
81
|
+
* See also {@link SignJsonLdOptions}.
|
82
|
+
* @returns The signed JSON-LD document.
|
83
|
+
* @throws {TypeError} If the private key is invalid or unsupported.
|
84
|
+
* @since 1.0.0
|
85
|
+
*/
|
86
|
+
declare function signJsonLd(jsonLd: unknown, privateKey: CryptoKey, keyId: URL, options: SignJsonLdOptions): Promise<{
|
87
|
+
signature: Signature;
|
88
|
+
}>;
|
89
|
+
/**
|
90
|
+
* Detaches Linked Data Signatures from the given JSON-LD document.
|
91
|
+
* @param jsonLd The JSON-LD document to modify.
|
92
|
+
* @returns The modified JSON-LD document. If the input document does not
|
93
|
+
* contain a signature, the original document is returned.
|
94
|
+
* @since 1.0.0
|
95
|
+
*/
|
96
|
+
declare function detachSignature(jsonLd: unknown): unknown;
|
97
|
+
/**
|
98
|
+
* Options for verifying Linked Data Signatures.
|
99
|
+
* @since 1.0.0
|
100
|
+
*/
|
101
|
+
interface VerifySignatureOptions {
|
102
|
+
/**
|
103
|
+
* The document loader to use for fetching the public key.
|
104
|
+
*/
|
105
|
+
documentLoader?: DocumentLoader;
|
106
|
+
/**
|
107
|
+
* The context loader to use for JSON-LD context retrieval.
|
108
|
+
*/
|
109
|
+
contextLoader?: DocumentLoader;
|
110
|
+
/**
|
111
|
+
* The key cache to use for caching public keys.
|
112
|
+
*/
|
113
|
+
keyCache?: KeyCache;
|
114
|
+
/**
|
115
|
+
* The OpenTelemetry tracer provider for tracing the verification process.
|
116
|
+
* If omitted, the global tracer provider is used.
|
117
|
+
* @since 1.3.0
|
118
|
+
*/
|
119
|
+
tracerProvider?: TracerProvider;
|
120
|
+
}
|
121
|
+
/**
|
122
|
+
* Verifies Linked Data Signatures of the given JSON-LD document.
|
123
|
+
* @param jsonLd The JSON-LD document to verify.
|
124
|
+
* @param options Options for verifying the signature.
|
125
|
+
* @returns The public key that signed the document or `null` if the signature
|
126
|
+
* is invalid or the key is not found.
|
127
|
+
* @since 1.0.0
|
128
|
+
*/
|
129
|
+
declare function verifySignature(jsonLd: unknown, options?: VerifySignatureOptions): Promise<CryptographicKey | null>;
|
130
|
+
/**
|
131
|
+
* Options for verifying JSON-LD documents.
|
132
|
+
*/
|
133
|
+
interface VerifyJsonLdOptions extends VerifySignatureOptions {}
|
134
|
+
/**
|
135
|
+
* Verify the authenticity of the given JSON-LD document using Linked Data
|
136
|
+
* Signatures. If the document is signed, this function verifies the signature
|
137
|
+
* and checks if the document is attributed to the owner of the public key.
|
138
|
+
* If the document is not signed, this function returns `false`.
|
139
|
+
* @param jsonLd The JSON-LD document to verify.
|
140
|
+
* @param options Options for verifying the document.
|
141
|
+
* @returns `true` if the document is authentic; `false` otherwise.
|
142
|
+
*/
|
143
|
+
declare function verifyJsonLd(jsonLd: unknown, options?: VerifyJsonLdOptions): Promise<boolean>;
|
144
|
+
//#endregion
|
145
|
+
//#region src/sig/proof.d.ts
|
146
|
+
/**
|
147
|
+
* Options for {@link createProof}.
|
148
|
+
* @since 0.10.0
|
149
|
+
*/
|
150
|
+
interface CreateProofOptions {
|
151
|
+
/**
|
152
|
+
* The context loader for loading remote JSON-LD contexts.
|
153
|
+
*/
|
154
|
+
contextLoader?: DocumentLoader;
|
155
|
+
/**
|
156
|
+
* The JSON-LD context to use for serializing the object to sign.
|
157
|
+
*/
|
158
|
+
context?: string | Record<string, string> | (string | Record<string, string>)[];
|
159
|
+
/**
|
160
|
+
* The time when the proof was created. If not specified, the current time
|
161
|
+
* will be used.
|
162
|
+
*/
|
163
|
+
created?: Temporal.Instant;
|
164
|
+
}
|
165
|
+
/**
|
166
|
+
* Creates a proof for the given object.
|
167
|
+
* @param object The object to create a proof for.
|
168
|
+
* @param privateKey The private key to sign the proof with.
|
169
|
+
* @param keyId The key ID to use in the proof. It will be used by the verifier.
|
170
|
+
* @param options Additional options. See also {@link CreateProofOptions}.
|
171
|
+
* @returns The created proof.
|
172
|
+
* @throws {TypeError} If the private key is invalid or unsupported.
|
173
|
+
* @since 0.10.0
|
174
|
+
*/
|
175
|
+
declare function createProof(object: Object$1, privateKey: CryptoKey, keyId: URL, {
|
176
|
+
contextLoader,
|
177
|
+
context,
|
178
|
+
created
|
179
|
+
}?: CreateProofOptions): Promise<DataIntegrityProof>;
|
180
|
+
/**
|
181
|
+
* Options for {@link signObject}.
|
182
|
+
* @since 0.10.0
|
183
|
+
*/
|
184
|
+
interface SignObjectOptions extends CreateProofOptions {
|
185
|
+
/**
|
186
|
+
* The document loader for loading remote JSON-LD documents.
|
187
|
+
*/
|
188
|
+
documentLoader?: DocumentLoader;
|
189
|
+
/**
|
190
|
+
* The OpenTelemetry tracer provider. If omitted, the global tracer provider
|
191
|
+
* is used.
|
192
|
+
* @since 1.3.0
|
193
|
+
*/
|
194
|
+
tracerProvider?: TracerProvider;
|
195
|
+
}
|
196
|
+
/**
|
197
|
+
* Signs the given object with the private key and returns the signed object.
|
198
|
+
* @param object The object to create a proof for.
|
199
|
+
* @param privateKey The private key to sign the proof with.
|
200
|
+
* @param keyId The key ID to use in the proof. It will be used by the verifier.
|
201
|
+
* @param options Additional options. See also {@link SignObjectOptions}.
|
202
|
+
* @returns The signed object.
|
203
|
+
* @throws {TypeError} If the private key is invalid or unsupported.
|
204
|
+
* @since 0.10.0
|
205
|
+
*/
|
206
|
+
declare function signObject<T extends Object$1>(object: T, privateKey: CryptoKey, keyId: URL, options?: SignObjectOptions): Promise<T>;
|
207
|
+
/**
|
208
|
+
* Options for {@link verifyProof}.
|
209
|
+
* @since 0.10.0
|
210
|
+
*/
|
211
|
+
interface VerifyProofOptions {
|
212
|
+
/**
|
213
|
+
* The context loader for loading remote JSON-LD contexts.
|
214
|
+
*/
|
215
|
+
contextLoader?: DocumentLoader;
|
216
|
+
/**
|
217
|
+
* The document loader for loading remote JSON-LD documents.
|
218
|
+
*/
|
219
|
+
documentLoader?: DocumentLoader;
|
220
|
+
/**
|
221
|
+
* The key cache to use for caching public keys.
|
222
|
+
* @since 0.12.0
|
223
|
+
*/
|
224
|
+
keyCache?: KeyCache;
|
225
|
+
/**
|
226
|
+
* The OpenTelemetry tracer provider. If omitted, the global tracer provider
|
227
|
+
* is used.
|
228
|
+
* @since 1.3.0
|
229
|
+
*/
|
230
|
+
tracerProvider?: TracerProvider;
|
231
|
+
}
|
232
|
+
/**
|
233
|
+
* Verifies the given proof for the object.
|
234
|
+
* @param jsonLd The JSON-LD object to verify the proof for. If it contains
|
235
|
+
* any proofs, they will be ignored.
|
236
|
+
* @param proof The proof to verify.
|
237
|
+
* @param options Additional options. See also {@link VerifyProofOptions}.
|
238
|
+
* @returns The public key that was used to sign the proof, or `null` if the
|
239
|
+
* proof is invalid.
|
240
|
+
* @since 0.10.0
|
241
|
+
*/
|
242
|
+
declare function verifyProof(jsonLd: unknown, proof: DataIntegrityProof, options?: VerifyProofOptions): Promise<Multikey | null>;
|
243
|
+
/**
|
244
|
+
* Options for {@link verifyObject}.
|
245
|
+
* @since 0.10.0
|
246
|
+
*/
|
247
|
+
interface VerifyObjectOptions extends VerifyProofOptions {}
|
248
|
+
/**
|
249
|
+
* Verifies the given object. It will verify all the proofs in the object,
|
250
|
+
* and succeed only if all the proofs are valid and all attributions and
|
251
|
+
* actors are authenticated by the proofs.
|
252
|
+
* @template T The type of the object to verify.
|
253
|
+
* @param cls The class of the object to verify. It must be a subclass of
|
254
|
+
* the {@link Object}.
|
255
|
+
* @param jsonLd The JSON-LD object to verify. It's assumed that the object
|
256
|
+
* is a compacted JSON-LD representation of a `T` with `@context`.
|
257
|
+
* @param options Additional options. See also {@link VerifyObjectOptions}.
|
258
|
+
* @returns The object if it's verified, or `null` if it's not.
|
259
|
+
* @throws {TypeError} If the object is invalid or unsupported.
|
260
|
+
* @since 0.10.0
|
261
|
+
*/
|
262
|
+
declare function verifyObject<T extends Object$1>(cls: (new (...args: any[]) => T) & {
|
263
|
+
fromJsonLd(jsonLd: unknown, options: VerifyObjectOptions): Promise<T>;
|
264
|
+
}, jsonLd: unknown, options?: VerifyObjectOptions): Promise<T | null>;
|
265
|
+
//#endregion
|
266
|
+
export { CreateProofOptions, CreateSignatureOptions, SignJsonLdOptions, SignObjectOptions, VerifyJsonLdOptions, VerifyObjectOptions, VerifyProofOptions, VerifySignatureOptions, attachSignature, createProof, createSignature, detachSignature, signJsonLd, signObject, verifyJsonLd, verifyObject, verifyProof, verifySignature };
|
@@ -0,0 +1 @@
|
|
1
|
+
export { };
|