@fedify/fedify 2.4.0-dev.1964 → 2.4.0-dev.1995
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-B4zpKIFU.mjs → builder-D0DxgOV5.mjs} +2 -2
- package/dist/{client-CtxvmazV.mjs → client-DpnpgjyX.mjs} +78 -4
- 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-CJnWc6c-.mjs +495 -0
- package/dist/{context-COLwHogJ.d.cts → context-BeDnDuF3.d.cts} +4 -3
- package/dist/{context-DiiCt4S7.d.ts → context-uyRUWoZQ.d.ts} +4 -3
- package/dist/{deno-CtG93ohj.mjs → deno-CABhzCb_.mjs} +1 -1
- package/dist/{docloader-dk_k3S8d.mjs → docloader-BbGSL0Xq.mjs} +2 -2
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/handler-compound-proof.test.d.mts +2 -0
- package/dist/federation/handler-compound-proof.test.mjs +152 -0
- package/dist/federation/handler.test.mjs +122 -4
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/keycache.test.mjs +52 -9
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +111 -15
- 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/send.test.mjs +139 -4
- 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-Drjlrrax.cjs → federation-DCEHQk4G.cjs} +632 -57
- package/dist/{http-6TI0tI03.d.cts → http-65PYi9jY.d.ts} +34 -2
- package/dist/{http-Dj4s1UQ0.js → http-9WyuldYh.js} +170 -8
- package/dist/{http-CdrSn2ip.d.ts → http-CP-7OdSq.d.cts} +34 -2
- package/dist/{http-B3skRvGo.cjs → http-CRFns-UE.cjs} +181 -7
- package/dist/{http-D7LX-BL9.mjs → http-D9urSO2D.mjs} +3 -3
- package/dist/{key-BVjgbs_9.mjs → key-Ccs8cnd7.mjs} +169 -7
- package/dist/{keycache-ZLqIfrkL.mjs → keycache-BUDHB5rY.mjs} +12 -4
- package/dist/{kv-cache-DtsjH_bY.cjs → kv-cache-DXT9vmIg.cjs} +2 -2
- package/dist/{kv-cache-tGNbvDCF.js → kv-cache-DtmXhPXG.js} +2 -2
- package/dist/{kv-cache-xRcC_xxP.mjs → kv-cache-lKyFn_Dn.mjs} +1 -1
- package/dist/{ld-OuCeQFny.mjs → ld-qup__MAW.mjs} +3 -3
- package/dist/map-local-context-conflict-DOYEEJ3u.mjs +204 -0
- package/dist/map-local-create-note-B0SeXJms.mjs +214 -0
- package/dist/{metrics-B9N27cCB.mjs → metrics-CISXCvB1.mjs} +1 -1
- package/dist/{middleware-TeLjzoxn.mjs → middleware-CzvJvPHK.mjs} +58 -15
- package/dist/{middleware-Cd_vPqDH.mjs → middleware-DkrU2WhY.mjs} +1 -1
- package/dist/{middleware-CPTDFMmJ.js → middleware-DsfWajaD.js} +593 -18
- package/dist/{mod-DypxPS9H.d.ts → mod-C0BYc0OU.d.ts} +1 -1
- package/dist/{mod-CnGLNoVw.d.cts → mod-CbKDOnCt.d.cts} +1 -1
- package/dist/{mod-CLHkCwLm.d.cts → mod-CyiSjRkk.d.cts} +1 -1
- package/dist/{mod-CSH1Ee-I.d.ts → mod-D882_Xsg.d.ts} +1 -1
- package/dist/{mod-DzRXACM5.d.ts → mod-UDwMjuHM.d.ts} +1 -1
- package/dist/{mod-BZldCEU0.d.cts → mod-x9W0d0Pk.d.cts} +1 -1
- package/dist/mod.cjs +20 -20
- package/dist/mod.d.cts +6 -6
- package/dist/mod.d.ts +6 -6
- package/dist/mod.js +5 -5
- package/dist/nodeinfo/client.test.mjs +28 -1
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/nodeinfo/mod.cjs +1 -1
- package/dist/nodeinfo/mod.js +1 -1
- package/dist/{owner-DGSfntI-.d.ts → owner-BF0L9cMt.d.cts} +12 -1
- package/dist/{proof-BO_esQii.js → owner-BIPEZGiU.js} +1255 -1098
- package/dist/{owner-r_waTiQj.d.cts → owner-BSzr5-I8.d.ts} +12 -1
- package/dist/owner-CRoq8Spb.mjs +175 -0
- package/dist/{proof-Dua0d906.cjs → owner-CVA7L9MA.cjs} +1266 -1097
- package/dist/{proof-D5Ajk4DJ.mjs → proof-BDxNVZ3E.mjs} +186 -83
- package/dist/{send-DVXyUqhO.mjs → send-BzM5GLyn.mjs} +68 -11
- package/dist/sig/compound-proof-discovery.test.d.mts +2 -0
- package/dist/sig/compound-proof-discovery.test.mjs +331 -0
- package/dist/sig/compound-proof-verification.test.d.mts +2 -0
- package/dist/sig/compound-proof-verification.test.mjs +465 -0
- package/dist/sig/compound-proof.test.d.mts +2 -0
- package/dist/sig/compound-proof.test.mjs +324 -0
- package/dist/sig/http.test.mjs +2 -2
- package/dist/sig/key.test.mjs +169 -2
- package/dist/sig/ld.test.mjs +55 -2
- package/dist/sig/mod.cjs +17 -17
- package/dist/sig/mod.d.cts +3 -3
- package/dist/sig/mod.d.ts +3 -3
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +103 -4
- package/dist/sig/proof.test.mjs +120 -1
- package/dist/{temporal-BoDw51A-.mjs → temporal-Dv6Qv-8k.mjs} +1 -1
- package/dist/testing/kv.test.mjs +1 -1
- package/dist/testing/mod.d.mts +2 -1
- package/dist/{types-RXm5YxpC.cjs → types-Be2zbyeG.cjs} +94 -2
- package/dist/{types-Dtyf8lVj.js → types-C_cNlNVK.js} +78 -4
- package/dist/utils/docloader.test.mjs +27 -3
- 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/owner-DTEqTzSr.mjs +0 -120
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/fedify",
|
|
3
|
-
"version": "2.4.0-dev.
|
|
3
|
+
"version": "2.4.0-dev.1995+618fd4e7",
|
|
4
4
|
"description": "An ActivityPub server framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ActivityPub",
|
|
@@ -151,10 +151,10 @@
|
|
|
151
151
|
"structured-field-values": "^2.0.4",
|
|
152
152
|
"temporal-polyfill": "^1.0.1",
|
|
153
153
|
"urlpattern-polyfill": "^10.1.0",
|
|
154
|
-
"@fedify/vocab": "2.4.0-dev.
|
|
155
|
-
"@fedify/webfinger": "2.4.0-dev.
|
|
156
|
-
"@fedify/uri-template": "2.4.0-dev.
|
|
157
|
-
"@fedify/vocab-runtime": "2.4.0-dev.
|
|
154
|
+
"@fedify/vocab": "2.4.0-dev.1995+618fd4e7",
|
|
155
|
+
"@fedify/webfinger": "2.4.0-dev.1995+618fd4e7",
|
|
156
|
+
"@fedify/uri-template": "2.4.0-dev.1995+618fd4e7",
|
|
157
|
+
"@fedify/vocab-runtime": "2.4.0-dev.1995+618fd4e7"
|
|
158
158
|
},
|
|
159
159
|
"devDependencies": {
|
|
160
160
|
"@std/assert": "npm:@jsr/std__assert@^0.226.0",
|
|
@@ -167,7 +167,7 @@
|
|
|
167
167
|
"typescript": "^6.0.0",
|
|
168
168
|
"wrangler": "^4.17.0",
|
|
169
169
|
"@fedify/fixture": "2.0.0",
|
|
170
|
-
"@fedify/vocab-tools": "^2.4.0-dev.
|
|
170
|
+
"@fedify/vocab-tools": "^2.4.0-dev.1995+618fd4e7"
|
|
171
171
|
},
|
|
172
172
|
"scripts": {
|
|
173
173
|
"build:self": "tsdown",
|
package/dist/owner-DTEqTzSr.mjs
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import "temporal-polyfill";
|
|
2
|
-
import "urlpattern-polyfill";
|
|
3
|
-
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-CtG93ohj.mjs";
|
|
5
|
-
import "./key-BVjgbs_9.mjs";
|
|
6
|
-
import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
|
|
7
|
-
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
8
|
-
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
|
9
|
-
//#region src/sig/owner.ts
|
|
10
|
-
/**
|
|
11
|
-
* Checks if the actor of the given activity owns the specified key.
|
|
12
|
-
* @param activity The activity to check.
|
|
13
|
-
* @param key The public key to check.
|
|
14
|
-
* @param options Options for checking the key ownership.
|
|
15
|
-
* @returns Whether the actor is the owner of the key.
|
|
16
|
-
*/
|
|
17
|
-
async function doesActorOwnKey(activity, key, options) {
|
|
18
|
-
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("activitypub.verify_key_ownership", {
|
|
19
|
-
kind: SpanKind.INTERNAL,
|
|
20
|
-
attributes: {
|
|
21
|
-
"activitypub.actor.id": activity.actorId?.href ?? "",
|
|
22
|
-
"activitypub.key.id": key.id?.href ?? ""
|
|
23
|
-
}
|
|
24
|
-
}, async (span) => {
|
|
25
|
-
try {
|
|
26
|
-
if (key.ownerId != null) {
|
|
27
|
-
const owns = key.ownerId.href === activity.actorId?.href;
|
|
28
|
-
span.setAttribute("activitypub.key_ownership.verified", owns);
|
|
29
|
-
span.setAttribute("activitypub.key_ownership.method", "owner_id");
|
|
30
|
-
return owns;
|
|
31
|
-
}
|
|
32
|
-
const actor = await activity.getActor(options);
|
|
33
|
-
if (actor == null || !isActor(actor)) {
|
|
34
|
-
span.setAttribute("activitypub.key_ownership.verified", false);
|
|
35
|
-
span.setAttribute("activitypub.key_ownership.method", "actor_fetch");
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
for (const publicKeyId of actor.publicKeyIds) if (key.id != null && publicKeyId.href === key.id.href) {
|
|
39
|
-
span.setAttribute("activitypub.key_ownership.verified", true);
|
|
40
|
-
span.setAttribute("activitypub.key_ownership.method", "actor_fetch");
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
span.setAttribute("activitypub.key_ownership.verified", false);
|
|
44
|
-
span.setAttribute("activitypub.key_ownership.method", "actor_fetch");
|
|
45
|
-
return false;
|
|
46
|
-
} catch (error) {
|
|
47
|
-
span.recordException(error);
|
|
48
|
-
span.setStatus({
|
|
49
|
-
code: SpanStatusCode.ERROR,
|
|
50
|
-
message: String(error)
|
|
51
|
-
});
|
|
52
|
-
throw error;
|
|
53
|
-
} finally {
|
|
54
|
-
span.end();
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Gets the actor that owns the specified key. Returns `null` if the key has no
|
|
60
|
-
* known owner.
|
|
61
|
-
*
|
|
62
|
-
* @param keyId The ID of the key to check, or the key itself.
|
|
63
|
-
* @param options Options for getting the key owner.
|
|
64
|
-
* @returns The actor that owns the key, or `null` if the key has no known
|
|
65
|
-
* owner.
|
|
66
|
-
* @since 0.7.0
|
|
67
|
-
*/
|
|
68
|
-
async function getKeyOwner(keyId, options) {
|
|
69
|
-
const tracerProvider = options.tracerProvider ?? trace.getTracerProvider();
|
|
70
|
-
const documentLoader = options.documentLoader ?? getDocumentLoader();
|
|
71
|
-
const contextLoader = options.contextLoader ?? getDocumentLoader();
|
|
72
|
-
let object;
|
|
73
|
-
if (keyId instanceof CryptographicKey) {
|
|
74
|
-
object = keyId;
|
|
75
|
-
if (object.id == null) return null;
|
|
76
|
-
keyId = object.id;
|
|
77
|
-
} else {
|
|
78
|
-
let keyDoc;
|
|
79
|
-
try {
|
|
80
|
-
const { document } = await documentLoader(keyId.href);
|
|
81
|
-
keyDoc = document;
|
|
82
|
-
} catch (_) {
|
|
83
|
-
return null;
|
|
84
|
-
}
|
|
85
|
-
try {
|
|
86
|
-
object = await Object$1.fromJsonLd(keyDoc, {
|
|
87
|
-
documentLoader,
|
|
88
|
-
contextLoader,
|
|
89
|
-
tracerProvider
|
|
90
|
-
});
|
|
91
|
-
} catch (e) {
|
|
92
|
-
if (!(e instanceof TypeError)) throw e;
|
|
93
|
-
try {
|
|
94
|
-
object = await CryptographicKey.fromJsonLd(keyDoc, {
|
|
95
|
-
documentLoader,
|
|
96
|
-
contextLoader,
|
|
97
|
-
tracerProvider
|
|
98
|
-
});
|
|
99
|
-
} catch (e) {
|
|
100
|
-
if (e instanceof TypeError) return null;
|
|
101
|
-
throw e;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
let owner = null;
|
|
106
|
-
if (object instanceof CryptographicKey) {
|
|
107
|
-
if (object.ownerId == null) return null;
|
|
108
|
-
owner = await object.getOwner({
|
|
109
|
-
documentLoader,
|
|
110
|
-
contextLoader,
|
|
111
|
-
tracerProvider
|
|
112
|
-
});
|
|
113
|
-
} else if (isActor(object)) owner = object;
|
|
114
|
-
else return null;
|
|
115
|
-
if (owner == null) return null;
|
|
116
|
-
for (const kid of owner.publicKeyIds) if (kid.href === keyId.href) return owner;
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
|
-
//#endregion
|
|
120
|
-
export { getKeyOwner as n, doesActorOwnKey as t };
|