@fedify/fedify 2.4.0-dev.2127 → 2.4.0-dev.2129
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/{builder-B2bgGYbP.mjs → builder-C0bxZDL0.mjs} +3 -3
- package/dist/compat/mod.d.cts +1 -1
- package/dist/compat/mod.d.ts +1 -1
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{compound-proof-SVlHSzV7.mjs → compound-proof-D9Kljk_7.mjs} +3 -3
- package/dist/{context-Ci5vuUr_.d.ts → context-Cz1w5Krc.d.ts} +1 -1
- package/dist/{context-Bm6ldGvx.d.cts → context-Dvec_D_h.d.cts} +1 -1
- package/dist/{deno-Be9xoxps.mjs → deno-_o3lkDlG.mjs} +1 -1
- package/dist/{docloader-Dtuyb0ps.mjs → docloader-BbS0rO-Y.mjs} +2 -2
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/compound-fanout.test.mjs +3 -3
- package/dist/federation/handler-compound-proof.test.mjs +3 -3
- package/dist/federation/handler.test.mjs +5 -5
- package/dist/federation/hashlink-media.test.mjs +2 -2
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +7 -7
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.d.cts +2 -2
- package/dist/federation/mod.d.ts +2 -2
- package/dist/federation/mod.js +1 -1
- package/dist/federation/outgoing-proof.test.mjs +6 -6
- package/dist/federation/portable-actor.test.mjs +3 -3
- package/dist/federation/portable-chain.test.mjs +3 -3
- package/dist/federation/portable-gateway-keys.test.mjs +76 -5
- package/dist/federation/portable-inbox.test.mjs +9 -4
- package/dist/federation/portable.test.mjs +3 -3
- package/dist/federation/send.test.mjs +3 -3
- package/dist/federation/tasks/enqueue.test.mjs +1 -1
- package/dist/federation/tasks/tasks.test.mjs +2 -2
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{federation-B6IHuS6n.cjs → federation-DRY8KrkB.cjs} +12 -12
- package/dist/{http-o8l4QeUY.cjs → http-B1J6E-bT.cjs} +384 -33
- package/dist/{http-BFeK9sBg.mjs → http-BpOiZE09.mjs} +18 -12
- package/dist/{http-D76Py0M4.d.cts → http-C-x_OLSp.d.ts} +57 -14
- package/dist/{http-Rmbiu-5S.js → http-C2M6wcs8.js} +374 -35
- package/dist/{http-BrQgkJay.d.ts → http-CjezPjFX.d.cts} +57 -14
- package/dist/{key-Cc1b6pW9.mjs → key-DolJjJab.mjs} +103 -16
- package/dist/{kv-cache-tLKBfxHc.mjs → kv-cache-Bq2cah0c.mjs} +1 -1
- package/dist/{kv-cache-BweDce2I.js → kv-cache-D7TiyMxv.js} +1 -1
- package/dist/{kv-cache-BUkgZAcX.cjs → kv-cache-D9nRbG2Q.cjs} +1 -1
- package/dist/{ld-DQNTIrAe.mjs → ld-Dwc176V4.mjs} +3 -3
- package/dist/{metrics-DDE9S63Q.mjs → metrics-CDaHfBXY.mjs} +1 -1
- package/dist/{middleware-CsQorLC_.mjs → middleware-CmB1FD8A.mjs} +1 -1
- package/dist/{middleware-K9aLnf57.js → middleware-CylX-pvI.js} +12 -12
- package/dist/{middleware-BdhvduR9.mjs → middleware-DN3MdTDg.mjs} +24 -24
- package/dist/{mod-Co53r-VP.d.ts → mod-Bz9tFXI2.d.ts} +1 -1
- package/dist/{mod-Cwdt_CWU.d.ts → mod-CZetqT5h.d.ts} +1 -1
- package/dist/{mod-Cr79cQlc.d.cts → mod-D4g9ffEn.d.cts} +1 -1
- package/dist/{mod-AVir5nVI.d.cts → mod-DGOIxEfb.d.cts} +1 -1
- package/dist/{mod-Byt5tvAS.d.cts → mod-S--JxYjo.d.cts} +1 -1
- package/dist/{mod-eVOUPbQE.d.ts → mod-owwElvpw.d.ts} +1 -1
- package/dist/mod.cjs +4 -4
- package/dist/mod.d.cts +5 -5
- package/dist/mod.d.ts +5 -5
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/{owner-CCfdL83M.mjs → owner-BNHhwjNu.mjs} +37 -4
- package/dist/{portable-collection-WXaHkNqC.mjs → portable-collection-CRpTUHCY.mjs} +2 -2
- package/dist/{portable-collection-DdXsKBg4.js → portable-collection-CgglAI9B.js} +34 -1
- package/dist/{portable-collection-DXogVs__.cjs → portable-collection-PTGD0q70.cjs} +34 -1
- package/dist/portable-key-DqX2emHQ.mjs +395 -0
- package/dist/{portable-key-id-T7lecIbt.mjs → portable-key-id-Bg259c4Z.mjs} +69 -2
- package/dist/{proof-CW8k0R1G.mjs → proof-B4_0E-KU.mjs} +5 -5
- package/dist/{send--FORaIc4.mjs → send-Dpu5qbP5.mjs} +3 -3
- package/dist/sig/compound-proof-discovery.test.mjs +1 -1
- package/dist/sig/compound-proof-producer.test.mjs +1 -1
- package/dist/sig/compound-proof-verification.test.mjs +2 -2
- package/dist/sig/compound-proof.test.mjs +2 -2
- package/dist/sig/http.test.mjs +2 -2
- package/dist/sig/key.test.mjs +1 -1
- package/dist/sig/ld.test.mjs +2 -2
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.d.cts +2 -2
- package/dist/sig/mod.d.ts +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/portable-collection.test.mjs +1 -1
- package/dist/sig/portable-key.test.mjs +479 -5
- package/dist/sig/proof.test.mjs +3 -3
- package/dist/{temporal-CffY_XOJ.mjs → temporal-78JVR3GK.mjs} +1 -1
- package/dist/testing/kv.test.mjs +1 -1
- package/dist/utils/docloader.test.mjs +2 -2
- package/dist/utils/kv-cache.test.mjs +1 -1
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.d.cts +1 -1
- package/dist/utils/mod.d.ts +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +6 -6
- package/dist/portable-key-C-fPq_Yf.mjs +0 -214
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
import "temporal-polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { d as isSamePublicKey, i as getRawCanonicalPortableId, s as isPortableActorDocument, t as getCanonicalPortableId, u as isPortableUri } from "./portable-key-id-Bg259c4Z.mjs";
|
|
5
|
+
import { l as verifyPortableObjectProofWithRoot } from "./proof-B4_0E-KU.mjs";
|
|
6
|
+
import { getLogger } from "@logtape/logtape";
|
|
7
|
+
import { CryptographicKey, Multikey, Object as Object$1 } from "@fedify/vocab";
|
|
8
|
+
import { FetchError, formatIri, getDocumentLoader, isGatewayUrl, parseIri, toCompatibleEf61Id } from "@fedify/vocab-runtime";
|
|
9
|
+
import { getPortableGatewayCandidates } from "@fedify/vocab-runtime/internal/portable-dereference";
|
|
10
|
+
//#region src/sig/portable-key.ts
|
|
11
|
+
const logger = getLogger([
|
|
12
|
+
"fedify",
|
|
13
|
+
"sig",
|
|
14
|
+
"key"
|
|
15
|
+
]);
|
|
16
|
+
const SEC = "https://w3id.org/security#";
|
|
17
|
+
/**
|
|
18
|
+
* Verifies that the signed document of a portable actor vouches for
|
|
19
|
+
* the gateway key with the given ID.
|
|
20
|
+
*
|
|
21
|
+
* A gateway key is accepted only if:
|
|
22
|
+
*
|
|
23
|
+
* - the document is an actor whose portable ID, i.e., its `ap:` ID or
|
|
24
|
+
* the canonical portable ID of its compatible identifier, is the one
|
|
25
|
+
* the key ID is the compatible identifier of;
|
|
26
|
+
* - the document has a valid [FEP-8b32] Object Integrity Proof made by
|
|
27
|
+
* the DID of its ID, i.e., it satisfies the [FEP-ef61] proof policy;
|
|
28
|
+
* - the document embeds a `Multikey` with that ID in its `assertionMethod`,
|
|
29
|
+
* whose `controller` is the actor, as [FEP-521a] requires, and a key
|
|
30
|
+
* embedded in its `publicKey` with the same ID agrees with it; or, if
|
|
31
|
+
* no `assertionMethod` entry has that ID, the document embeds
|
|
32
|
+
* a `CryptographicKey` with that ID in its `publicKey`, whose `owner` is
|
|
33
|
+
* the actor, as some publishers, e.g., tootik, list their RSA keys only
|
|
34
|
+
* there;
|
|
35
|
+
* - no more than one entry of either property has that ID; and
|
|
36
|
+
* - the key ID's origin is one of the actor's `gateways`.
|
|
37
|
+
*
|
|
38
|
+
* An entry has the key's ID if its ID is the key ID, or any compatible
|
|
39
|
+
* identifier on the same gateway, or the `ap:` or `ap+ef61:` URI, with the
|
|
40
|
+
* same canonical portable ID. Some publishers, e.g., Mitra, list the keys
|
|
41
|
+
* of portable actors under `ap:` URIs, but sign requests with compatible key
|
|
42
|
+
* IDs on their own gateways. IDs are compared as they are written in
|
|
43
|
+
* the signed document, so an ID that URL parsing would turn into another,
|
|
44
|
+
* e.g., by resolving dot segments, has no match.
|
|
45
|
+
*
|
|
46
|
+
* [FEP-8b32]: https://w3id.org/fep/8b32
|
|
47
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
48
|
+
* [FEP-521a]: https://w3id.org/fep/521a
|
|
49
|
+
*
|
|
50
|
+
* @param document The raw JSON-LD document served at the key ID.
|
|
51
|
+
* @param actor The parsed document, which must be a portable actor.
|
|
52
|
+
* @param keyId The key ID, which must be a compatible key ID.
|
|
53
|
+
* @param options Loaders and telemetry providers.
|
|
54
|
+
* @returns The verification result, which is never `legacy`.
|
|
55
|
+
* @internal
|
|
56
|
+
*/
|
|
57
|
+
function verifyPortableGatewayKeyDocument(document, actor, keyId, options = {}) {
|
|
58
|
+
return verifyPortableKeyDocument(document, actor, keyId, true, options);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Verifies that the signed document of a portable actor vouches for the key
|
|
62
|
+
* with the given ID, either a gateway key at a compatible key ID, or a key of
|
|
63
|
+
* the actor itself at an `ap:` or `ap+ef61:` key ID. See
|
|
64
|
+
* {@link verifyPortableGatewayKeyDocument} for the rules; a key of the actor
|
|
65
|
+
* itself names no gateway, so instead of the key ID's origin being one of
|
|
66
|
+
* the actor's `gateways`, the actor only has to have a valid gateway, as
|
|
67
|
+
* FEP-ef61 requires of every portable actor.
|
|
68
|
+
*/
|
|
69
|
+
async function verifyPortableKeyDocument(document, actor, keyId, isGatewayKey, options) {
|
|
70
|
+
const reject = (reason) => {
|
|
71
|
+
logger.debug("Failed to verify key {keyId} of the portable actor {actorId}: {reason}", {
|
|
72
|
+
keyId: formatIri(keyId),
|
|
73
|
+
actorId: actor.id?.href,
|
|
74
|
+
reason
|
|
75
|
+
});
|
|
76
|
+
return {
|
|
77
|
+
type: "rejected",
|
|
78
|
+
reason
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
const keyBase = new URL(keyId.href);
|
|
82
|
+
keyBase.hash = "";
|
|
83
|
+
const claimedActorId = getCanonicalPortableId(keyBase);
|
|
84
|
+
const claimedKeyId = getCanonicalPortableId(keyId);
|
|
85
|
+
const actorId = actor.id == null ? null : getCanonicalPortableId(actor.id);
|
|
86
|
+
if (claimedActorId == null || claimedKeyId == null || actorId == null) return reject("The key ID or the actor ID is not a valid portable ID.");
|
|
87
|
+
if (claimedActorId !== actorId) return reject("The key ID is not a compatible identifier of the actor it dereferences to.");
|
|
88
|
+
let verification;
|
|
89
|
+
try {
|
|
90
|
+
verification = await verifyPortableObjectProofWithRoot(document, {
|
|
91
|
+
documentLoader: options.documentLoader,
|
|
92
|
+
contextLoader: options.contextLoader,
|
|
93
|
+
keyCache: options.keyCache,
|
|
94
|
+
tracerProvider: options.tracerProvider,
|
|
95
|
+
meterProvider: options.meterProvider
|
|
96
|
+
});
|
|
97
|
+
} catch (error) {
|
|
98
|
+
if (!(error instanceof TypeError)) throw error;
|
|
99
|
+
return reject(`The actor document is malformed: ${error.message}`);
|
|
100
|
+
}
|
|
101
|
+
const { result, root, expires } = verification;
|
|
102
|
+
if (!result.verified) return reject("The actor document does not satisfy the FEP-ef61 proof policy: " + result.reason.type);
|
|
103
|
+
if (root == null) return reject("The actor document could not be expanded.");
|
|
104
|
+
const refuse = (url) => Promise.reject(/* @__PURE__ */ new Error(`Refusing to fetch ${url}.`));
|
|
105
|
+
const parseEmbeddedPublicKey = async (node) => {
|
|
106
|
+
if (isReference(node)) return null;
|
|
107
|
+
let key;
|
|
108
|
+
try {
|
|
109
|
+
key = await CryptographicKey.fromJsonLd(node, {
|
|
110
|
+
documentLoader: refuse,
|
|
111
|
+
contextLoader: options.contextLoader,
|
|
112
|
+
tracerProvider: options.tracerProvider
|
|
113
|
+
});
|
|
114
|
+
} catch (error) {
|
|
115
|
+
if (!(error instanceof TypeError)) throw error;
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
return key.publicKey == null ? null : key;
|
|
119
|
+
};
|
|
120
|
+
let verifiedActor;
|
|
121
|
+
try {
|
|
122
|
+
verifiedActor = await Object$1.fromJsonLd(root, {
|
|
123
|
+
documentLoader: refuse,
|
|
124
|
+
contextLoader: options.contextLoader,
|
|
125
|
+
tracerProvider: options.tracerProvider
|
|
126
|
+
});
|
|
127
|
+
} catch (error) {
|
|
128
|
+
if (!(error instanceof TypeError)) throw error;
|
|
129
|
+
return reject("The verified actor document is malformed.");
|
|
130
|
+
}
|
|
131
|
+
const rootId = root["@id"];
|
|
132
|
+
if (!isPortableActorDocument(verifiedActor) || getCanonicalPortableId(verifiedActor.id) !== claimedActorId || typeof rootId !== "string" || getRawCanonicalPortableId(rootId) !== claimedActorId) return reject("The key ID is not a compatible identifier of the actor whose document is signed.");
|
|
133
|
+
actor = verifiedActor;
|
|
134
|
+
const findKeyNodes = (values) => findNodes(values, claimedKeyId, isGatewayKey ? keyId.origin : null);
|
|
135
|
+
const assertionNodes = findKeyNodes(root[`${SEC}assertionMethod`]);
|
|
136
|
+
const publicKeyNodes = findKeyNodes(root[`${SEC}publicKey`]);
|
|
137
|
+
if (assertionNodes.length > 1 || publicKeyNodes.length > 1) return reject("The actor document has more than one key with the ID.");
|
|
138
|
+
let publicKey;
|
|
139
|
+
if (assertionNodes.length > 0) {
|
|
140
|
+
if (isReference(assertionNodes[0])) return reject("The actor document does not embed the key in its assertionMethod.");
|
|
141
|
+
let multikey;
|
|
142
|
+
try {
|
|
143
|
+
multikey = await Multikey.fromJsonLd(assertionNodes[0], {
|
|
144
|
+
documentLoader: refuse,
|
|
145
|
+
contextLoader: options.contextLoader,
|
|
146
|
+
tracerProvider: options.tracerProvider
|
|
147
|
+
});
|
|
148
|
+
} catch (error) {
|
|
149
|
+
if (!(error instanceof TypeError)) throw error;
|
|
150
|
+
return reject("The key in the assertionMethod is malformed.");
|
|
151
|
+
}
|
|
152
|
+
if (multikey.publicKey == null) return reject("The key in the assertionMethod has no public key.");
|
|
153
|
+
if (multikey.controllerId == null || getCanonicalPortableId(multikey.controllerId) !== actorId) return reject("The controller of the key is not the actor.");
|
|
154
|
+
publicKey = multikey.publicKey;
|
|
155
|
+
if (publicKeyNodes.length > 0 && !isReference(publicKeyNodes[0])) {
|
|
156
|
+
const embedded = await parseEmbeddedPublicKey(publicKeyNodes[0]);
|
|
157
|
+
if (embedded == null || !await isSamePublicKey(embedded.publicKey, publicKey) || embedded.ownerId != null && getCanonicalPortableId(embedded.ownerId) !== actorId) return reject("The key in the publicKey does not agree with the one in the assertionMethod.");
|
|
158
|
+
}
|
|
159
|
+
} else {
|
|
160
|
+
if (publicKeyNodes.length < 1) return reject("The actor document embeds the key in neither its assertionMethod nor its publicKey.");
|
|
161
|
+
const embedded = await parseEmbeddedPublicKey(publicKeyNodes[0]);
|
|
162
|
+
if (embedded == null) return reject("The key in the publicKey is not embedded or malformed.");
|
|
163
|
+
if (embedded.ownerId == null || getCanonicalPortableId(embedded.ownerId) !== actorId) return reject("The owner of the key is not the actor.");
|
|
164
|
+
publicKey = embedded.publicKey;
|
|
165
|
+
}
|
|
166
|
+
if (isGatewayKey) {
|
|
167
|
+
if (!actor.gateways.some((gateway) => isGatewayUrl(gateway) && gateway.origin === keyId.origin)) return reject(`The gateway ${keyId.origin} is not listed in the actor's gateways.`);
|
|
168
|
+
} else if (!actor.gateways.some(isGatewayUrl)) return reject("The actor has no valid gateways.");
|
|
169
|
+
const key = new CryptographicKey({
|
|
170
|
+
id: keyId,
|
|
171
|
+
owner: actor.id,
|
|
172
|
+
publicKey
|
|
173
|
+
});
|
|
174
|
+
return {
|
|
175
|
+
type: "verified",
|
|
176
|
+
actor,
|
|
177
|
+
key,
|
|
178
|
+
...expires == null ? {} : { expires }
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Fetches the document at a compatible key ID, and resolves the key as
|
|
183
|
+
* a gateway key if the document is a portable actor.
|
|
184
|
+
*
|
|
185
|
+
* @param keyId The key ID, which must be a compatible key ID.
|
|
186
|
+
* @param options Loaders and telemetry providers.
|
|
187
|
+
* @returns `legacy` if the document cannot be fetched or is not a portable
|
|
188
|
+
* actor, which leaves the key to the usual resolution; otherwise,
|
|
189
|
+
* the result of {@link verifyPortableGatewayKeyDocument}.
|
|
190
|
+
* @internal
|
|
191
|
+
*/
|
|
192
|
+
async function fetchPortableGatewayKey(keyId, options = {}) {
|
|
193
|
+
const documentLoader = options.documentLoader ?? getDocumentLoader();
|
|
194
|
+
const contextLoader = options.contextLoader ?? getDocumentLoader();
|
|
195
|
+
let remoteDocument;
|
|
196
|
+
try {
|
|
197
|
+
remoteDocument = await documentLoader(keyId.href);
|
|
198
|
+
} catch (error) {
|
|
199
|
+
logger.debug("Failed to fetch key {keyId}: {error}", {
|
|
200
|
+
keyId: keyId.href,
|
|
201
|
+
error
|
|
202
|
+
});
|
|
203
|
+
return { type: "legacy" };
|
|
204
|
+
}
|
|
205
|
+
let object;
|
|
206
|
+
try {
|
|
207
|
+
object = await Object$1.fromJsonLd(remoteDocument.document, {
|
|
208
|
+
documentLoader,
|
|
209
|
+
contextLoader,
|
|
210
|
+
tracerProvider: options.tracerProvider
|
|
211
|
+
});
|
|
212
|
+
} catch (error) {
|
|
213
|
+
if (!(error instanceof TypeError)) throw error;
|
|
214
|
+
return { type: "legacy" };
|
|
215
|
+
}
|
|
216
|
+
if (!isPortableActorDocument(object)) return { type: "legacy" };
|
|
217
|
+
return await verifyPortableGatewayKeyDocument(remoteDocument.document, object, keyId, {
|
|
218
|
+
...options,
|
|
219
|
+
documentLoader,
|
|
220
|
+
contextLoader
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Resolves a key of a portable actor at an `ap:` or `ap+ef61:` key ID, e.g.,
|
|
225
|
+
* `ap://did:key:z6Mk…/actor#main-key`. Such a key ID names no gateway, so
|
|
226
|
+
* the actor's document, i.e., the key ID without its fragment, is fetched
|
|
227
|
+
* through the gateways in its `@gateway` location hints, one after another,
|
|
228
|
+
* until one of them serves a document that vouches for the key. Without
|
|
229
|
+
* location hints, the document loader is asked for the `ap:` URI itself,
|
|
230
|
+
* which only a custom document loader can resolve. The hints are chosen by
|
|
231
|
+
* whoever made the signature, but that does not matter: only a document with
|
|
232
|
+
* a valid proof by the DID of the key ID vouches for the key.
|
|
233
|
+
*
|
|
234
|
+
* The key is taken as a key of the actor itself, not of a gateway, so it is
|
|
235
|
+
* accepted by the rules of {@link verifyPortableGatewayKeyDocument}, except
|
|
236
|
+
* that it is listed under the `ap:` or `ap+ef61:` URI with the same canonical
|
|
237
|
+
* ID as the key ID, and that the actor only has to have a valid gateway.
|
|
238
|
+
* The key ID must have a fragment; a key served as a standalone document is
|
|
239
|
+
* not supported.
|
|
240
|
+
*
|
|
241
|
+
* If no gateway serves a document that vouches for the key, the result is
|
|
242
|
+
* `rejected` only if every gateway served a document that definitely does not
|
|
243
|
+
* vouch for it. If every gateway failed to serve a document at all, the
|
|
244
|
+
* result is a cacheable `unavailable`, with the error of the first gateway if
|
|
245
|
+
* every gateway responded with the same HTTP status, so that the status
|
|
246
|
+
* describes the whole lookup. Otherwise, e.g., if one gateway was
|
|
247
|
+
* unreachable and another served an invalid document, nothing tells what the
|
|
248
|
+
* unreachable gateway would have served, so the result is an `unavailable`
|
|
249
|
+
* that is not cacheable.
|
|
250
|
+
*
|
|
251
|
+
* @param keyId The key ID, which must be an `ap:` or `ap+ef61:` URI.
|
|
252
|
+
* @param options Loaders and telemetry providers.
|
|
253
|
+
* @returns The resolution, which is never `legacy`.
|
|
254
|
+
* @internal
|
|
255
|
+
*/
|
|
256
|
+
async function resolvePortableActorKey(keyId, options = {}) {
|
|
257
|
+
const documentLoader = options.documentLoader ?? getDocumentLoader();
|
|
258
|
+
const contextLoader = options.contextLoader ?? getDocumentLoader();
|
|
259
|
+
let formattedKeyId = keyId.href;
|
|
260
|
+
const reject = (reason) => {
|
|
261
|
+
logger.debug("Failed to verify key {keyId} of a portable actor: {reason}", {
|
|
262
|
+
keyId: formattedKeyId,
|
|
263
|
+
reason
|
|
264
|
+
});
|
|
265
|
+
return {
|
|
266
|
+
type: "rejected",
|
|
267
|
+
reason
|
|
268
|
+
};
|
|
269
|
+
};
|
|
270
|
+
if (!isPortableUri(keyId) || getCanonicalPortableId(keyId) == null) return reject("The key ID is not a valid ap: or ap+ef61: URI.");
|
|
271
|
+
formattedKeyId = formatIri(keyId);
|
|
272
|
+
if (keyId.hash === "" || keyId.hash === "#") return reject("The key ID has no fragment; only keys embedded in actor documents are supported.");
|
|
273
|
+
const actorUrl = new URL(keyId.href);
|
|
274
|
+
actorUrl.hash = "";
|
|
275
|
+
const requestUrls = [];
|
|
276
|
+
for (const gateway of getPortableGatewayCandidates(actorUrl)) try {
|
|
277
|
+
requestUrls.push(toCompatibleEf61Id(actorUrl, gateway).href);
|
|
278
|
+
} catch (error) {
|
|
279
|
+
if (!(error instanceof TypeError)) throw error;
|
|
280
|
+
return reject(`The key ID cannot be fetched from gateways: ${error}`);
|
|
281
|
+
}
|
|
282
|
+
if (requestUrls.length < 1) requestUrls.push(formatIri(actorUrl));
|
|
283
|
+
const attempts = [];
|
|
284
|
+
for (const url of requestUrls) {
|
|
285
|
+
let remoteDocument;
|
|
286
|
+
try {
|
|
287
|
+
remoteDocument = await documentLoader(url);
|
|
288
|
+
} catch (error) {
|
|
289
|
+
logger.debug("Failed to fetch the actor of key {keyId} from {url}: {error}", {
|
|
290
|
+
keyId: formattedKeyId,
|
|
291
|
+
url,
|
|
292
|
+
error
|
|
293
|
+
});
|
|
294
|
+
attempts.push({
|
|
295
|
+
type: "retrievalFailed",
|
|
296
|
+
error
|
|
297
|
+
});
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
let resolution;
|
|
301
|
+
try {
|
|
302
|
+
const object = await Object$1.fromJsonLd(remoteDocument.document, {
|
|
303
|
+
documentLoader,
|
|
304
|
+
contextLoader,
|
|
305
|
+
tracerProvider: options.tracerProvider
|
|
306
|
+
});
|
|
307
|
+
resolution = isPortableActorDocument(object) ? await verifyPortableKeyDocument(remoteDocument.document, object, keyId, false, {
|
|
308
|
+
...options,
|
|
309
|
+
documentLoader,
|
|
310
|
+
contextLoader
|
|
311
|
+
}) : {
|
|
312
|
+
type: "rejected",
|
|
313
|
+
reason: "The document is not a portable actor."
|
|
314
|
+
};
|
|
315
|
+
} catch (error) {
|
|
316
|
+
if (error instanceof TypeError) resolution = {
|
|
317
|
+
type: "rejected",
|
|
318
|
+
reason: `The document is malformed: ${error.message}`
|
|
319
|
+
};
|
|
320
|
+
else {
|
|
321
|
+
logger.debug("Failed to process the actor of key {keyId} served from {url}: {error}", {
|
|
322
|
+
keyId: formattedKeyId,
|
|
323
|
+
url,
|
|
324
|
+
error
|
|
325
|
+
});
|
|
326
|
+
attempts.push({
|
|
327
|
+
type: "indeterminate",
|
|
328
|
+
error
|
|
329
|
+
});
|
|
330
|
+
continue;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
if (resolution.type === "verified") return resolution;
|
|
334
|
+
const reason = resolution.type === "rejected" ? resolution.reason : "The document is not a portable actor.";
|
|
335
|
+
logger.debug("The actor document served from {url} does not vouch for key {keyId}: {reason}", {
|
|
336
|
+
keyId: formattedKeyId,
|
|
337
|
+
url,
|
|
338
|
+
reason
|
|
339
|
+
});
|
|
340
|
+
attempts.push({
|
|
341
|
+
type: "rejected",
|
|
342
|
+
reason
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
const rejections = attempts.flatMap((a) => a.type === "rejected" ? [a.reason] : []);
|
|
346
|
+
if (rejections.length === attempts.length) return reject(rejections.join(" "));
|
|
347
|
+
const errors = attempts.flatMap((a) => a.type === "rejected" ? [] : [a.error]);
|
|
348
|
+
const aggregate = errors.length === 1 ? errors[0] : new AggregateError(errors, `Failed to fetch the actor of key ${formattedKeyId} from any of its gateways: ${requestUrls.join(", ")}`);
|
|
349
|
+
if (attempts.every((a) => a.type === "retrievalFailed")) {
|
|
350
|
+
const statuses = errors.map((error) => error instanceof FetchError ? error.response?.status : void 0);
|
|
351
|
+
return {
|
|
352
|
+
type: "unavailable",
|
|
353
|
+
error: statuses[0] != null && statuses.every((status) => status === statuses[0]) ? errors[0] : aggregate,
|
|
354
|
+
cacheable: true
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
return {
|
|
358
|
+
type: "unavailable",
|
|
359
|
+
error: new Error(`Could not determine whether the actor of key ${formattedKeyId} vouches for it.`, { cause: aggregate }),
|
|
360
|
+
cacheable: false
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Finds the nodes that stand for the key with the given canonical portable
|
|
365
|
+
* ID. A node whose ID is an `ap:` or `ap+ef61:` URI stands for the key
|
|
366
|
+
* itself, e.g., Mitra lists the keys of portable actors that way while
|
|
367
|
+
* signing requests with compatible key IDs. A node whose ID is a compatible
|
|
368
|
+
* identifier stands for a gateway's key, so it matches only a compatible key
|
|
369
|
+
* ID on the same gateway; a key ID that names no gateway never selects
|
|
370
|
+
* a gateway's key, even with the same fragment.
|
|
371
|
+
* @param values The expanded values of a key property.
|
|
372
|
+
* @param canonicalKeyId The canonical portable ID of the key ID.
|
|
373
|
+
* @param gateway The origin of the gateway whose key the key ID names, or
|
|
374
|
+
* `null` if the key ID names no gateway.
|
|
375
|
+
*/
|
|
376
|
+
function findNodes(values, canonicalKeyId, gateway) {
|
|
377
|
+
if (!Array.isArray(values)) return [];
|
|
378
|
+
const nodes = [];
|
|
379
|
+
for (const value of values) {
|
|
380
|
+
if (value == null || typeof value !== "object" || Array.isArray(value)) continue;
|
|
381
|
+
const node = value;
|
|
382
|
+
const nodeId = node["@id"];
|
|
383
|
+
if (typeof nodeId !== "string") continue;
|
|
384
|
+
if (getRawCanonicalPortableId(nodeId) !== canonicalKeyId) continue;
|
|
385
|
+
const parsed = parseIri(nodeId);
|
|
386
|
+
if (isPortableUri(parsed) || parsed.origin === gateway) nodes.push(node);
|
|
387
|
+
}
|
|
388
|
+
return nodes;
|
|
389
|
+
}
|
|
390
|
+
/** A node with nothing but an `@id` is a reference, not an embedded key. */
|
|
391
|
+
function isReference(node) {
|
|
392
|
+
return Object.keys(node).every((key) => key === "@id");
|
|
393
|
+
}
|
|
394
|
+
//#endregion
|
|
395
|
+
export { resolvePortableActorKey as n, verifyPortableGatewayKeyDocument as r, fetchPortableGatewayKey as t };
|
|
@@ -2,10 +2,12 @@ import "temporal-polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { isActor } from "@fedify/vocab";
|
|
5
|
-
import { canonicalizePortableUri, formatIri, fromCompatibleEf61Id, getFe34Origin, toCompatibleEf61Id } from "@fedify/vocab-runtime";
|
|
5
|
+
import { canonicalizePortableUri, formatIri, fromCompatibleEf61Id, getFe34Origin, parseIri, toCompatibleEf61Id } from "@fedify/vocab-runtime";
|
|
6
6
|
import { isCompatibleEf61Iri } from "@fedify/vocab-runtime/internal/portable-dereference";
|
|
7
7
|
//#region src/sig/portable-key-id.ts
|
|
8
8
|
const COMPATIBLE_KEY_ID_PATH_PATTERN = /^\/\.well-known\/apgateway\/did(?::|%3A)/i;
|
|
9
|
+
const RAW_PORTABLE_URI_PATTERN = /^ap(?:\+ef61)?:\/\//i;
|
|
10
|
+
const RAW_COMPATIBLE_ID_PREFIX_PATTERN = /^https?:\/\/[^/?#]*\/\.well-known\/apgateway\/(?=did(?::|%3A))/i;
|
|
9
11
|
/**
|
|
10
12
|
* Checks whether the URL is an `ap:` or `ap+ef61:` URI.
|
|
11
13
|
* @internal
|
|
@@ -69,6 +71,20 @@ function isCompatibleKeyId(keyId) {
|
|
|
69
71
|
return (keyId.protocol === "http:" || keyId.protocol === "https:") && COMPATIBLE_KEY_ID_PATH_PATTERN.test(keyId.pathname);
|
|
70
72
|
}
|
|
71
73
|
/**
|
|
74
|
+
* Checks whether a key ID may name a key that is valid only for HTTP
|
|
75
|
+
* Signatures: a gateway key at an [FEP-ef61] compatible identifier, or a key
|
|
76
|
+
* of a portable actor at an `ap:` or `ap+ef61:` URI. Neither ever makes or
|
|
77
|
+
* verifies an Object Integrity Proof or a Linked Data Signature: a portable
|
|
78
|
+
* object's proof is made by its DID, and a proof made with a gateway key
|
|
79
|
+
* would claim that the gateway authored the object.
|
|
80
|
+
*
|
|
81
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
84
|
+
function isPortableKeyId(keyId) {
|
|
85
|
+
return isPortableUri(keyId) || isCompatibleKeyId(keyId);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
72
88
|
* Gets the canonical portable ID of an actor ID that is either an `ap:` or
|
|
73
89
|
* `ap+ef61:` URI or a compatible identifier.
|
|
74
90
|
* @returns The canonical portable ID, or `null` if the ID is neither, or is
|
|
@@ -87,6 +103,57 @@ function getCanonicalPortableId(id) {
|
|
|
87
103
|
}
|
|
88
104
|
}
|
|
89
105
|
/**
|
|
106
|
+
* Gets the canonical portable ID of an `ap:` or `ap+ef61:` URI or
|
|
107
|
+
* a compatible identifier as it is written, before any URL parsing.
|
|
108
|
+
* Parsing an ID into a `URL` resolves dot segments in its path, which would
|
|
109
|
+
* make it identify another portable object, e.g.,
|
|
110
|
+
* `ap://did:key:z6Mk…/x/../actor` would become `ap://did:key:z6Mk…/actor`.
|
|
111
|
+
* Such an ID has no canonical portable ID here.
|
|
112
|
+
* @param raw The ID as it is written.
|
|
113
|
+
* @returns The canonical portable ID, fragment included, or `null` if the ID
|
|
114
|
+
* is neither an `ap:` or `ap+ef61:` URI nor a compatible identifier,
|
|
115
|
+
* is malformed, or would identify another object once parsed.
|
|
116
|
+
* @internal
|
|
117
|
+
*/
|
|
118
|
+
function getRawCanonicalPortableId(raw) {
|
|
119
|
+
let canonical;
|
|
120
|
+
let parsed;
|
|
121
|
+
try {
|
|
122
|
+
if (RAW_PORTABLE_URI_PATTERN.test(raw)) {
|
|
123
|
+
canonical = canonicalizePortableUri(raw);
|
|
124
|
+
parsed = canonicalizePortableUri(formatIri(parseIri(raw)));
|
|
125
|
+
} else {
|
|
126
|
+
const prefix = raw.match(RAW_COMPATIBLE_ID_PREFIX_PATTERN);
|
|
127
|
+
if (prefix == null || !URL.canParse(raw)) return null;
|
|
128
|
+
canonical = canonicalizePortableUri("ap://" + raw.slice(prefix[0].length));
|
|
129
|
+
parsed = getCanonicalPortableId(new URL(raw));
|
|
130
|
+
}
|
|
131
|
+
} catch (error) {
|
|
132
|
+
if (error instanceof TypeError) return null;
|
|
133
|
+
throw error;
|
|
134
|
+
}
|
|
135
|
+
return canonical === parsed ? canonical : null;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Parses a key ID, e.g., the `keyId` of an HTTP Signature, into a `URL`.
|
|
139
|
+
* An `ap:` or `ap+ef61:` key ID is parsed into the internal `URL` form of
|
|
140
|
+
* portable URIs. A portable or compatible key ID that is malformed, or
|
|
141
|
+
* whose identity URL parsing would change, e.g., by resolving dot segments in
|
|
142
|
+
* its path, is refused, so that it can never be taken for, or looked up in
|
|
143
|
+
* the key cache as, the key of another object.
|
|
144
|
+
* @param raw The key ID as it is written.
|
|
145
|
+
* @returns The parsed key ID, or `null` if it is invalid.
|
|
146
|
+
* @internal
|
|
147
|
+
*/
|
|
148
|
+
function parseKeyIdString(raw) {
|
|
149
|
+
if (RAW_PORTABLE_URI_PATTERN.test(raw)) return getRawCanonicalPortableId(raw) == null ? null : parseIri(raw);
|
|
150
|
+
if (!URL.canParse(raw)) return null;
|
|
151
|
+
const url = new URL(raw);
|
|
152
|
+
if (isPortableUri(url)) return null;
|
|
153
|
+
if (!RAW_COMPATIBLE_ID_PREFIX_PATTERN.test(raw)) return isCompatibleKeyId(url) ? null : url;
|
|
154
|
+
return getRawCanonicalPortableId(raw) == null ? null : url;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
90
157
|
* Builds the base of the key IDs of a gateway's keys for a portable actor:
|
|
91
158
|
* the actor's compatible identifier on the gateway.
|
|
92
159
|
* @param actorId The portable actor's ID, either an `ap:` or `ap+ef61:` URI
|
|
@@ -134,4 +201,4 @@ async function isSamePublicKey(a, b) {
|
|
|
134
201
|
return x.kty === y.kty && x.crv === y.crv && x.n === y.n && x.e === y.e && x.x === y.x && x.y === y.y;
|
|
135
202
|
}
|
|
136
203
|
//#endregion
|
|
137
|
-
export {
|
|
204
|
+
export { hasPortableActor as a, isPortableId as c, isSamePublicKey as d, parseKeyIdString as f, getRawCanonicalPortableId as i, isPortableKeyId as l, getGatewayKeyBase as n, isCompatibleKeyId as o, getPortableDid as r, isPortableActorDocument as s, getCanonicalPortableId as t, isPortableUri as u };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
-
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-
|
|
6
|
-
import {
|
|
7
|
-
import { c as validateCryptoKey, i as fetchKey, t as bypassKeyCacheReads } from "./key-
|
|
4
|
+
import { n as version, t as name } from "./deno-_o3lkDlG.mjs";
|
|
5
|
+
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-CDaHfBXY.mjs";
|
|
6
|
+
import { c as isPortableId, r as getPortableDid } from "./portable-key-id-Bg259c4Z.mjs";
|
|
7
|
+
import { c as validateCryptoKey, i as fetchKey, t as bypassKeyCacheReads } from "./key-DolJjJab.mjs";
|
|
8
8
|
import { n as preloadedOnlyDocumentLoader } from "./public-audience--klBIOk1.mjs";
|
|
9
9
|
import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-4IJqPYos.mjs";
|
|
10
|
-
import { c as getNormalizationContextLoader } from "./ld-
|
|
10
|
+
import { c as getNormalizationContextLoader } from "./ld-Dwc176V4.mjs";
|
|
11
11
|
import { getLogger } from "@logtape/logtape";
|
|
12
12
|
import { Activity, DataIntegrityProof, Multikey, getTypeId } from "@fedify/vocab";
|
|
13
13
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
-
import { n as getDurationMs, r as getFederationMetrics } from "./metrics-
|
|
6
|
-
import { n as doubleKnock } from "./http-
|
|
4
|
+
import { n as version, t as name } from "./deno-_o3lkDlG.mjs";
|
|
5
|
+
import { n as getDurationMs, r as getFederationMetrics } from "./metrics-CDaHfBXY.mjs";
|
|
6
|
+
import { n as doubleKnock } from "./http-BpOiZE09.mjs";
|
|
7
7
|
import { getLogger } from "@logtape/logtape";
|
|
8
8
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
9
9
|
import { FetchError, UrlError, validatePublicUrl } from "@fedify/vocab-runtime";
|
|
@@ -3,7 +3,7 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
5
5
|
import "../std__assert-DvMDRPes.mjs";
|
|
6
|
-
import { i as inspectCompoundPortableObjectApplicability, n as discoverCompoundProofDocuments } from "../compound-proof-
|
|
6
|
+
import { i as inspectCompoundPortableObjectApplicability, n as discoverCompoundProofDocuments } from "../compound-proof-D9Kljk_7.mjs";
|
|
7
7
|
import { t as map_local_create_note_default } from "../map-local-create-note-B0SeXJms.mjs";
|
|
8
8
|
import { test } from "@fedify/fixture";
|
|
9
9
|
//#region src/sig/compound-proof-discovery.test.ts
|
|
@@ -3,7 +3,7 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
5
5
|
import "../std__assert-DvMDRPes.mjs";
|
|
6
|
-
import { i as inspectCompoundPortableObjectApplicability, r as findUnsupportedCompoundProofShape, t as containsCompoundPortableObject } from "../compound-proof-
|
|
6
|
+
import { i as inspectCompoundPortableObjectApplicability, r as findUnsupportedCompoundProofShape, t as containsCompoundPortableObject } from "../compound-proof-D9Kljk_7.mjs";
|
|
7
7
|
import { test } from "@fedify/fixture";
|
|
8
8
|
//#region src/sig/compound-proof-producer.test.ts
|
|
9
9
|
const portableId = "ap+ef61://did:key:z6MkAlice/objects/1";
|
|
@@ -4,9 +4,9 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
5
5
|
import "../std__assert-DvMDRPes.mjs";
|
|
6
6
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
7
|
-
import { a as verifyMapLocalProof, c as verifyPortableObjectProofPolicy } from "../proof-
|
|
7
|
+
import { a as verifyMapLocalProof, c as verifyPortableObjectProofPolicy } from "../proof-B4_0E-KU.mjs";
|
|
8
8
|
import { n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
|
|
9
|
-
import { a as verifyCompoundPortableObjectProofs, i as inspectCompoundPortableObjectApplicability, o as verifyCompoundProofDocuments, t as containsCompoundPortableObject } from "../compound-proof-
|
|
9
|
+
import { a as verifyCompoundPortableObjectProofs, i as inspectCompoundPortableObjectApplicability, o as verifyCompoundProofDocuments, t as containsCompoundPortableObject } from "../compound-proof-D9Kljk_7.mjs";
|
|
10
10
|
import { t as map_local_create_note_default } from "../map-local-create-note-B0SeXJms.mjs";
|
|
11
11
|
import { t as map_local_context_conflict_default } from "../map-local-context-conflict-DOYEEJ3u.mjs";
|
|
12
12
|
import { CryptographicKey, Multikey, Person } from "@fedify/vocab";
|
|
@@ -6,9 +6,9 @@ import "../std__assert-DvMDRPes.mjs";
|
|
|
6
6
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
7
7
|
import { n as preloadedOnlyDocumentLoader } from "../public-audience--klBIOk1.mjs";
|
|
8
8
|
import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-4IJqPYos.mjs";
|
|
9
|
-
import { i as signObject, u as verifyProof } from "../proof-
|
|
9
|
+
import { i as signObject, u as verifyProof } from "../proof-B4_0E-KU.mjs";
|
|
10
10
|
import { n as ed25519PrivateKey, r as ed25519PublicKey } from "../keys-DIJNHW-Y.mjs";
|
|
11
|
-
import { o as verifyCompoundProofDocuments } from "../compound-proof-
|
|
11
|
+
import { o as verifyCompoundProofDocuments } from "../compound-proof-D9Kljk_7.mjs";
|
|
12
12
|
import { t as map_local_create_note_default } from "../map-local-create-note-B0SeXJms.mjs";
|
|
13
13
|
import { t as map_local_context_conflict_default } from "../map-local-context-conflict-DOYEEJ3u.mjs";
|
|
14
14
|
import { Create, DataIntegrityProof, Note, Question } from "@fedify/vocab";
|
package/dist/sig/http.test.mjs
CHANGED
|
@@ -11,8 +11,8 @@ import { t as assertThrows } from "../assert_throws-BYITOvPO.mjs";
|
|
|
11
11
|
import "../std__assert-DvMDRPes.mjs";
|
|
12
12
|
import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
|
|
13
13
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
14
|
-
import { n as exportJwk } from "../key-
|
|
15
|
-
import { a as listRequestSignatures, c as selectRequestSignature, d as verifyRequest, f as verifyRequestDetailed, i as formatRfc9421SignatureParameters, l as signRequest, n as doubleKnock, o as parseRfc9421Signature, r as formatRfc9421Signature, s as parseRfc9421SignatureInput, t as createRfc9421SignatureBase, u as timingSafeEqual } from "../http-
|
|
14
|
+
import { n as exportJwk } from "../key-DolJjJab.mjs";
|
|
15
|
+
import { a as listRequestSignatures, c as selectRequestSignature, d as verifyRequest, f as verifyRequestDetailed, i as formatRfc9421SignatureParameters, l as signRequest, n as doubleKnock, o as parseRfc9421Signature, r as formatRfc9421Signature, s as parseRfc9421SignatureInput, t as createRfc9421SignatureBase, u as timingSafeEqual } from "../http-BpOiZE09.mjs";
|
|
16
16
|
import { i as rsaPrivateKey2, l as rsaPublicKey5, o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
|
|
17
17
|
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
18
18
|
import { FetchError, exportSpki } from "@fedify/vocab-runtime";
|
package/dist/sig/key.test.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { t as assertThrows } from "../assert_throws-BYITOvPO.mjs";
|
|
|
6
6
|
import "../std__assert-DvMDRPes.mjs";
|
|
7
7
|
import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
|
|
8
8
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
9
|
-
import { a as fetchKeyDetailed, c as validateCryptoKey, i as fetchKey, n as exportJwk, o as generateCryptoKeyPair, s as importJwk } from "../key-
|
|
9
|
+
import { a as fetchKeyDetailed, c as validateCryptoKey, i as fetchKey, n as exportJwk, o as generateCryptoKeyPair, s as importJwk } from "../key-DolJjJab.mjs";
|
|
10
10
|
import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DIJNHW-Y.mjs";
|
|
11
11
|
import { CryptographicKey, Multikey } from "@fedify/vocab";
|
|
12
12
|
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
package/dist/sig/ld.test.mjs
CHANGED
|
@@ -8,8 +8,8 @@ import { t as assertInstanceOf } from "../assert_instance_of-mrXWWNY-.mjs";
|
|
|
8
8
|
import { t as assertThrows } from "../assert_throws-BYITOvPO.mjs";
|
|
9
9
|
import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
|
|
10
10
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
11
|
-
import { o as generateCryptoKeyPair } from "../key-
|
|
12
|
-
import { a as compactJsonLd, f as isInvalidUrlTypeError, g as verifySignature, h as verifyJsonLd, i as attachSignature, n as UnsafeJsonLdError, o as createSignature, p as signJsonLd, s as detachSignature, u as hasSignatureLike } from "../ld-
|
|
11
|
+
import { o as generateCryptoKeyPair } from "../key-DolJjJab.mjs";
|
|
12
|
+
import { a as compactJsonLd, f as isInvalidUrlTypeError, g as verifySignature, h as verifyJsonLd, i as attachSignature, n as UnsafeJsonLdError, o as createSignature, p as signJsonLd, s as detachSignature, u as hasSignatureLike } from "../ld-Dwc176V4.mjs";
|
|
13
13
|
import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DIJNHW-Y.mjs";
|
|
14
14
|
import { CryptographicKey } from "@fedify/vocab";
|
|
15
15
|
import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
package/dist/sig/mod.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const require_http = require("../http-
|
|
4
|
-
const require_portable_collection = require("../portable-collection-
|
|
3
|
+
const require_http = require("../http-B1J6E-bT.cjs");
|
|
4
|
+
const require_portable_collection = require("../portable-collection-PTGD0q70.cjs");
|
|
5
5
|
exports.attachSignature = require_http.attachSignature;
|
|
6
6
|
exports.createProof = require_http.createProof;
|
|
7
7
|
exports.createSignature = require_http.createSignature;
|
package/dist/sig/mod.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "../http-
|
|
2
|
+
import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "../http-CjezPjFX.cjs";
|
|
3
3
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "../owner-BF0L9cMt.cjs";
|
|
4
|
-
import { C as createSignature, D as verifyJsonLd, E as signJsonLd, O as verifySignature, S as attachSignature, T as hasSignatureLike, _ as verifyProof, a as CreateProofOptions, b as VerifyJsonLdOptions, c as VerifyPortableObjectProofFailureReason, d as VerifyProofOptions, f as createProof, g as verifyPortableObjectProof, h as verifyObject, i as verifyPortableObject, l as VerifyPortableObjectProofOptions, m as signObject, n as VerifyPortableObjectOptions, o as SignObjectOptions, p as hasProofLike, r as VerifyPortableObjectResult, s as VerifyObjectOptions, t as VerifyPortableObjectFailureReason, u as VerifyPortableObjectProofResult, v as CreateSignatureOptions, w as detachSignature, x as VerifySignatureOptions, y as SignJsonLdOptions } from "../mod-
|
|
4
|
+
import { C as createSignature, D as verifyJsonLd, E as signJsonLd, O as verifySignature, S as attachSignature, T as hasSignatureLike, _ as verifyProof, a as CreateProofOptions, b as VerifyJsonLdOptions, c as VerifyPortableObjectProofFailureReason, d as VerifyProofOptions, f as createProof, g as verifyPortableObjectProof, h as verifyObject, i as verifyPortableObject, l as VerifyPortableObjectProofOptions, m as signObject, n as VerifyPortableObjectOptions, o as SignObjectOptions, p as hasProofLike, r as VerifyPortableObjectResult, s as VerifyObjectOptions, t as VerifyPortableObjectFailureReason, u as VerifyPortableObjectProofResult, v as CreateSignatureOptions, w as detachSignature, x as VerifySignatureOptions, y as SignJsonLdOptions } from "../mod-S--JxYjo.cjs";
|
|
5
5
|
export { AcceptSignatureMember, AcceptSignatureParameters, CreateProofOptions, CreateSignatureOptions, DoesActorOwnKeyOptions, FetchKeyDetailedResult, FetchKeyErrorResult, FetchKeyOptions, FetchKeyResult, FulfillAcceptSignatureResult, GetKeyOwnerOptions, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, Rfc9421SignRequestOptions, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, VerifyJsonLdOptions, VerifyObjectOptions, VerifyPortableObjectFailureReason, VerifyPortableObjectOptions, VerifyPortableObjectProofFailureReason, VerifyPortableObjectProofOptions, VerifyPortableObjectProofResult, VerifyPortableObjectResult, VerifyProofOptions, VerifyRequestDetailedResult, VerifyRequestFailureReason, VerifyRequestOptions, VerifySignatureOptions, attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getKeyOwner, hasProofLike, hasSignatureLike, importJwk, parseAcceptSignature, signJsonLd, signObject, signRequest, validateAcceptSignature, verifyJsonLd, verifyObject, verifyPortableObject, verifyPortableObjectProof, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
|