@fedify/fedify 2.0.0-pr.433.1603 → 2.0.0-pr.434.1659
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-BODH8--e.cjs +37786 -0
- package/dist/{actor-CY-MF2fp.js → actor-DJS2ne1f.js} +200 -200
- package/dist/actor-DMgu-ZjT.d.cts +128 -0
- package/dist/{actor-DFlEHCQA.js → actor-WgMDAZc5.js} +1 -1
- package/dist/{assert_rejects-7UF4R_Qs.js → assert_rejects-DiIiJbZn.js} +1 -1
- package/dist/{assert_throws-53_pKeP3.js → assert_throws-BOO88avQ.js} +1 -1
- package/dist/authdocloader-C8Eqv2Kg.cjs +58 -0
- package/dist/{authdocloader-CQBXQkJb.js → authdocloader-FA-VNPvw.js} +3 -3
- package/dist/{authdocloader-Dh8orZQs.js → authdocloader-SW1oQJ7q.js} +6 -6
- package/dist/{builder-Cmx9eExq.js → builder-Cp2PpvmH.js} +4 -4
- package/dist/chunk-DqRYRqnO.cjs +34 -0
- package/dist/client-CegPX0Rn.d.cts +222 -0
- package/dist/{client-DXKgLzk4.js → client-D_BQdihX.js} +1 -1
- package/dist/compat/mod.cjs +10 -0
- package/dist/compat/mod.d.cts +13 -0
- package/dist/compat/mod.d.ts +2 -2
- package/dist/compat/mod.js +5 -5
- package/dist/compat/transformers.test.js +18 -17
- package/dist/compat-DmDDELst.cjs +4 -0
- package/dist/compat-nxUqe4Z-.js +4 -0
- package/dist/{context-CDSZdQHD.d.ts → context-CQsAT7xk.d.ts} +0 -1
- package/dist/context-tVOQ76fi.d.cts +2254 -0
- package/dist/docloader-D-MrRyHl.d.cts +219 -0
- package/dist/{docloader-D4sbvvPM.js → docloader-DrPHprgh.js} +188 -8
- package/dist/docloader-dZO9fPIT.cjs +4861 -0
- package/dist/{esm-D6i4YQ2_.js → esm-CjcCcZ6s.js} +1 -1
- package/dist/federation/builder.test.js +10 -10
- package/dist/federation/collection.test.js +8 -8
- package/dist/federation/handler.test.js +26 -145
- package/dist/federation/inbox.test.js +6 -6
- package/dist/federation/keycache.test.js +4 -4
- package/dist/federation/kv.test.js +9 -8
- package/dist/federation/middleware.test.js +255 -38
- package/dist/federation/mod.cjs +29 -0
- package/dist/federation/mod.d.cts +13 -0
- package/dist/federation/mod.d.ts +1 -1
- package/dist/federation/mod.js +15 -15
- package/dist/federation/mq.test.js +10 -10
- package/dist/federation/negotiation.test.d.ts +3 -0
- package/dist/federation/negotiation.test.js +28 -0
- package/dist/federation/retry.test.js +5 -5
- package/dist/federation/router.test.js +8 -8
- package/dist/federation/send.test.js +15 -15
- package/dist/{federation-CMX7WzeL.js → federation-D1U8YY9t.js} +3 -3
- package/dist/federation-H2_En3j5.cjs +244 -0
- package/dist/{http-mimmGwH8.js → http-BPkuNd26.js} +2 -2
- package/dist/http-BS6766zs.d.cts +253 -0
- package/dist/{http-az-I4DFF.js → http-BgQ07Ja_.js} +6 -6
- package/dist/http-CZJRJ0Pv.cjs +826 -0
- package/dist/{inbox--bLOiwUO.js → inbox-CCB1CbWJ.js} +1 -1
- package/dist/{key-DaaSDiCV.js → key-B_P3wH2F.js} +5 -5
- package/dist/{key-Gjnnnh5S.js → key-BstbqwrH.js} +3 -3
- package/dist/{key-C6ojpFqZ.js → key-C0k2A_bI.js} +2 -2
- package/dist/key-C8TOf6mh.cjs +290 -0
- package/dist/key-CtA7xiw_.js +10 -0
- package/dist/key-hknDPZ-z.cjs +10 -0
- package/dist/{keycache-DZnNO-JV.js → keycache-DvDW8JPA.js} +1 -1
- package/dist/{keys-BU2fip9w.js → keys-DzXrG_sX.js} +1 -1
- package/dist/kv-63Cil1MD.d.cts +81 -0
- package/dist/{ld-tLocOQ6q.js → ld-BcKcM_o9.js} +2 -2
- package/dist/{lookup-DG0T7i6q.js → lookup-C3BC8XO-.js} +4 -4
- package/dist/lookup-C3BGNQTz.cjs +137 -0
- package/dist/{lookup-1CBMmJ3_.js → lookup-DbTBDJcT.js} +1 -1
- package/dist/{middleware-BJn2g4ay.js → middleware-B3crRaK-.js} +50 -81
- package/dist/middleware-BWXHJSkY.cjs +17 -0
- package/dist/middleware-C4A4GTtX.cjs +4204 -0
- package/dist/middleware-CGlIdSyy.js +17 -0
- package/dist/middleware-CUWXMbGt.js +26 -0
- package/dist/{middleware-CU2GpLYi.js → middleware-CXRqw8n4.js} +49 -144
- package/dist/{mod-RI3-KvUI.d.ts → mod-B26zRlH1.d.ts} +1 -1
- package/dist/mod-BClfg3ej.d.cts +266 -0
- package/dist/mod-C2tOeRkN.d.cts +1 -0
- package/dist/mod-DBQAI4v9.d.cts +80 -0
- package/dist/mod-Dc_-mf8s.d.cts +102 -0
- package/dist/mod-FZd39qVq.d.cts +1 -0
- package/dist/mod-evzlRVZq.d.cts +289 -0
- package/dist/mod-jQ4OODsl.d.cts +113 -0
- package/dist/mod.cjs +150 -0
- package/dist/mod.d.cts +17 -0
- package/dist/mod.d.ts +2 -2
- package/dist/mod.js +20 -20
- package/dist/mq-B7R1Q-M5.d.cts +140 -0
- package/dist/negotiation-5NPJL6zp.js +71 -0
- package/dist/nodeinfo/client.test.js +10 -10
- package/dist/nodeinfo/handler.test.js +23 -22
- package/dist/nodeinfo/mod.cjs +11 -0
- package/dist/nodeinfo/mod.d.cts +5 -0
- package/dist/nodeinfo/mod.js +6 -6
- package/dist/nodeinfo/types.test.js +8 -8
- package/dist/nodeinfo-Co9lJrWl.cjs +4 -0
- package/dist/nodeinfo-DfycQ8Wf.js +4 -0
- package/dist/owner-B-7Ptt_m.d.cts +67 -0
- package/dist/{owner-qDh_g_5C.js → owner-BcEciLTD.js} +2 -2
- package/dist/{proof-aGjI96QA.js → proof-DAEfR6xA.js} +6 -6
- package/dist/proof-ZBmKo2zb.cjs +673 -0
- package/dist/{proof-DimUFDOB.js → proof-vGquXXR6.js} +2 -2
- package/dist/runtime/authdocloader.test.js +14 -14
- package/dist/runtime/docloader.test.js +9 -9
- package/dist/runtime/key.test.js +10 -10
- package/dist/runtime/langstr.test.js +8 -8
- package/dist/runtime/link.test.d.ts +3 -0
- package/dist/runtime/link.test.js +61 -0
- 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 +8 -8
- package/dist/runtime/url.test.js +5 -5
- package/dist/runtime-C58AJWSv.cjs +4 -0
- package/dist/runtime-DPYEDf-o.js +4 -0
- package/dist/{send-BDoLPO28.js → send-svmMjAUr.js} +2 -2
- package/dist/sig/http.test.js +13 -13
- package/dist/sig/key.test.js +11 -11
- package/dist/sig/ld.test.js +10 -10
- 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 +12 -12
- package/dist/sig/proof.test.js +12 -12
- package/dist/sig-ByHXzqUi.cjs +4 -0
- package/dist/sig-Cj3tk-ig.js +4 -0
- package/dist/testing/docloader.test.js +8 -8
- package/dist/testing/mod.js +3 -3
- package/dist/{testing-BtAnu4dJ.js → testing-y9ueu9Aj.js} +2 -2
- package/dist/{transformers-Dna8Fg7k.js → transformers-BFT6d7J5.js} +3 -3
- package/dist/transformers-CoBS-oFG.cjs +116 -0
- package/dist/{type-CGIBxLsG.js → type-9o78PXlX.js} +381 -201
- package/dist/{types-DiMJWG0f.js → types-DTCqX5HE.js} +4 -4
- package/dist/types-K5btoOl6.cjs +315 -0
- package/dist/vocab/actor.test.js +10 -10
- package/dist/vocab/lookup.test.js +9 -9
- 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 +45 -10
- package/dist/vocab-CJ0jQMQV.cjs +282 -0
- package/dist/{vocab-Br3OfNTW.js → vocab-C_Pm3NG3.js} +6 -6
- package/dist/vocab-DJTYMqyU.d.cts +14632 -0
- package/dist/webfinger/handler.test.js +23 -22
- package/dist/webfinger/lookup.test.js +9 -9
- 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 +8 -8
- package/dist/x/hono.cjs +61 -0
- package/dist/x/hono.d.cts +54 -0
- package/dist/x/hono.d.ts +1 -1
- 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.d.ts +1 -1
- package/dist/x/sveltekit.js +3 -3
- package/package.json +68 -13
- package/dist/compat-Bb5myD13.js +0 -4
- package/dist/key-BFfeDCSU.js +0 -10
- package/dist/middleware-aYHOiG0n.js +0 -17
- package/dist/middleware-u5BtkYWm.js +0 -25
- 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
- /package/dist/{assert_is_error-B035L3om.js → assert_is_error-BPGph1Jx.js} +0 -0
- /package/dist/{assert_not_equals-C80BG-_5.js → assert_not_equals-f3m3epl3.js} +0 -0
- /package/dist/{denokv-jZ0Z2h0M.js → denokv-Bv33Xxea.js} +0 -0
- /package/dist/{retry-CfF8Gn4d.js → retry-D4GJ670a.js} +0 -0
- /package/dist/{std__assert-DWivtrGR.js → std__assert-X-_kMxKM.js} +0 -0
@@ -0,0 +1,266 @@
|
|
1
|
+
import { DocumentLoader } from "./docloader-D-MrRyHl.cjs";
|
2
|
+
import { CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1 } from "./vocab-DJTYMqyU.cjs";
|
3
|
+
import { KeyCache } from "./http-BS6766zs.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 { };
|
@@ -0,0 +1,80 @@
|
|
1
|
+
import { Activity } from "./vocab-DJTYMqyU.cjs";
|
2
|
+
import { ActivityTransformer, Context } from "./context-tVOQ76fi.cjs";
|
3
|
+
|
4
|
+
//#region src/compat/transformers.d.ts
|
5
|
+
|
6
|
+
/**
|
7
|
+
* An activity transformer that assigns a new random ID to an activity if it
|
8
|
+
* does not already have one. This is useful for ensuring that activities
|
9
|
+
* have an ID before they are sent to other servers.
|
10
|
+
*
|
11
|
+
* The generated ID is an origin URI with a fragment which contains an activity
|
12
|
+
* type name with a random UUID:
|
13
|
+
*
|
14
|
+
* ```
|
15
|
+
* https://example.com/#Follow/12345678-1234-5678-1234-567812345678
|
16
|
+
* ```
|
17
|
+
*
|
18
|
+
* @template TContextData The type of the context data.
|
19
|
+
* @param activity The activity to assign an ID to.
|
20
|
+
* @param context The context of the activity.
|
21
|
+
* @return The activity with an ID assigned.
|
22
|
+
* @since 1.4.0
|
23
|
+
*/
|
24
|
+
declare function autoIdAssigner<TContextData>(activity: Activity, context: Context<TContextData>): Activity;
|
25
|
+
/**
|
26
|
+
* An activity transformer that dehydrates the actor property of an activity
|
27
|
+
* so that it only contains the actor's URI. For example, suppose we have an
|
28
|
+
* activity like this:
|
29
|
+
*
|
30
|
+
* ```typescript
|
31
|
+
* import { Follow, Person } from "@fedify/fedify/vocab";
|
32
|
+
* const input = new Follow({
|
33
|
+
* id: new URL("http://example.com/activities/1"),
|
34
|
+
* actor: new Person({
|
35
|
+
* id: new URL("http://example.com/actors/1"),
|
36
|
+
* name: "Alice",
|
37
|
+
* preferredUsername: "alice",
|
38
|
+
* }),
|
39
|
+
* object: new Person({
|
40
|
+
* id: new URL("http://example.com/actors/2"),
|
41
|
+
* name: "Bob",
|
42
|
+
* preferredUsername: "bob",
|
43
|
+
* }),
|
44
|
+
* });
|
45
|
+
* ```
|
46
|
+
*
|
47
|
+
* The result of applying this transformer would be:
|
48
|
+
*
|
49
|
+
* ```typescript
|
50
|
+
* import { Follow, Person } from "@fedify/fedify/vocab";
|
51
|
+
* const output = new Follow({
|
52
|
+
* id: new URL("http://example.com/activities/1"),
|
53
|
+
* actor: new URL("http://example.com/actors/1"),
|
54
|
+
* object: new Person({
|
55
|
+
* id: new URL("http://example.com/actors/2"),
|
56
|
+
* name: "Bob",
|
57
|
+
* preferredUsername: "bob",
|
58
|
+
* }),
|
59
|
+
* });
|
60
|
+
* ```
|
61
|
+
*
|
62
|
+
* As some ActivityPub implementations like Threads fail to deal with inlined
|
63
|
+
* actor objects, this transformer can be used to work around this issue.
|
64
|
+
* @template TContextData The type of the context data.
|
65
|
+
* @param activity The activity to dehydrate the actor property of.
|
66
|
+
* @param context The context of the activity.
|
67
|
+
* @returns The dehydrated activity.
|
68
|
+
* @since 1.4.0
|
69
|
+
*/
|
70
|
+
declare function actorDehydrator<TContextData>(activity: Activity, _context: Context<TContextData>): Activity;
|
71
|
+
/**
|
72
|
+
* Gets the default activity transformers that are applied to all outgoing
|
73
|
+
* activities.
|
74
|
+
* @template TContextData The type of the context data.
|
75
|
+
* @returns The default activity transformers.
|
76
|
+
* @since 1.4.0
|
77
|
+
*/
|
78
|
+
declare function getDefaultActivityTransformers<TContextData>(): readonly ActivityTransformer<TContextData>[];
|
79
|
+
//#endregion
|
80
|
+
export { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers };
|
@@ -0,0 +1,102 @@
|
|
1
|
+
import { DocumentLoader, DocumentLoaderFactoryOptions } from "./docloader-D-MrRyHl.cjs";
|
2
|
+
import { HttpMessageSignaturesSpecDeterminer } from "./http-BS6766zs.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 @@
|
|
1
|
+
export { };
|