@fedify/fedify 1.3.0-dev.565 → 1.3.0-dev.568
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/CHANGES.md +10 -0
- package/esm/deno.js +1 -1
- package/esm/federation/middleware.js +7 -3
- package/esm/sig/http.js +2 -1
- package/esm/sig/key.js +9 -3
- package/esm/sig/owner.js +10 -1
- package/esm/vocab/lookup.js +1 -0
- package/esm/vocab/vocab.js +7850 -2957
- package/package.json +1 -1
- package/types/federation/context.d.ts +6 -0
- package/types/federation/context.d.ts.map +1 -1
- package/types/federation/middleware.d.ts +1 -0
- package/types/federation/middleware.d.ts.map +1 -1
- package/types/sig/key.d.ts +9 -1
- package/types/sig/key.d.ts.map +1 -1
- package/types/sig/ld.d.ts +6 -6
- package/types/sig/ld.d.ts.map +1 -1
- package/types/sig/owner.d.ts +16 -0
- package/types/sig/owner.d.ts.map +1 -1
- package/types/vocab/lookup.d.ts.map +1 -1
- package/types/vocab/vocab.d.ts +1015 -66
- package/types/vocab/vocab.d.ts.map +1 -1
package/CHANGES.md
CHANGED
@@ -61,6 +61,7 @@ To be released.
|
|
61
61
|
|
62
62
|
- Fedify now supports OpenTelemetry for tracing. [[#170]]
|
63
63
|
|
64
|
+
- Added `Context.tracerProvider` property.
|
64
65
|
- Added `CreateFederationOptions.tracerProvider` option.
|
65
66
|
- Added `LookupWebFingerOptions.tracerProvider` option.
|
66
67
|
- Added `LookupObjectOptions.tracerProvider` option.
|
@@ -71,8 +72,17 @@ To be released.
|
|
71
72
|
- Added `VerifyProofOptions.tracerProvider` option.
|
72
73
|
- Added `VerifyObjectOptions.tracerProvider` option.
|
73
74
|
- Added `SignObjectOptions.tracerProvider` option.
|
75
|
+
- Added `VerifySignatureOptions.tracerProvider` option.
|
74
76
|
- Added `VerifyJsonLdOptions.tracerProvider` option.
|
75
77
|
- Added `SignJsonLdOptions.tracerProvider` option.
|
78
|
+
- Added `DoesActorOwnKeyOptions.tracerProvider` option.
|
79
|
+
- Added `GetKeyOwnerOptions.tracerProvider` option.
|
80
|
+
|
81
|
+
- Added `tracerProvider` option to the following Activity Vocabulary APIs:
|
82
|
+
|
83
|
+
- The second parameters of constructors.
|
84
|
+
- The second parameters of `fromJsonLd()` static methods.
|
85
|
+
- The second parameters of `get*()` methods.
|
76
86
|
|
77
87
|
- Added `@fedify/fedify/x/sveltekit` module for integrating with [SvelteKit]
|
78
88
|
hook. [[#171], [#183] by Jiyu Park]
|
package/esm/deno.js
CHANGED
@@ -204,6 +204,7 @@ export class FederationImpl {
|
|
204
204
|
documentLoader: rsaKeyPair == null
|
205
205
|
? this.documentLoader
|
206
206
|
: this.authenticatedDocumentLoaderFactory(rsaKeyPair),
|
207
|
+
tracerProvider: this.tracerProvider,
|
207
208
|
});
|
208
209
|
try {
|
209
210
|
this.onOutboxError?.(error, activity);
|
@@ -1301,6 +1302,9 @@ export class ContextImpl {
|
|
1301
1302
|
get contextLoader() {
|
1302
1303
|
return this.federation.contextLoader;
|
1303
1304
|
}
|
1305
|
+
get tracerProvider() {
|
1306
|
+
return this.federation.tracerProvider;
|
1307
|
+
}
|
1304
1308
|
getNodeInfoUri() {
|
1305
1309
|
const path = this.federation.router.build("nodeInfo", {});
|
1306
1310
|
if (path == null) {
|
@@ -1638,7 +1642,7 @@ export class ContextImpl {
|
|
1638
1642
|
documentLoader: options.documentLoader ?? this.documentLoader,
|
1639
1643
|
contextLoader: options.contextLoader ?? this.contextLoader,
|
1640
1644
|
userAgent: options.userAgent ?? this.federation.userAgent,
|
1641
|
-
tracerProvider: options.tracerProvider ?? this.
|
1645
|
+
tracerProvider: options.tracerProvider ?? this.tracerProvider,
|
1642
1646
|
});
|
1643
1647
|
}
|
1644
1648
|
traverseCollection(collection, options = {}) {
|
@@ -1805,7 +1809,7 @@ class RequestContextImpl extends ContextImpl {
|
|
1805
1809
|
return this.#signedKey = await verifyRequest(this.request, {
|
1806
1810
|
...this,
|
1807
1811
|
timeWindow: this.federation.signatureTimeWindow,
|
1808
|
-
tracerProvider: this.
|
1812
|
+
tracerProvider: this.tracerProvider,
|
1809
1813
|
});
|
1810
1814
|
}
|
1811
1815
|
#signedKeyOwner = undefined;
|
@@ -1935,7 +1939,7 @@ export class InboxContextImpl extends ContextImpl {
|
|
1935
1939
|
activity: this.activity,
|
1936
1940
|
activityId: activityId,
|
1937
1941
|
inbox: new URL(inbox),
|
1938
|
-
tracerProvider: this.
|
1942
|
+
tracerProvider: this.tracerProvider,
|
1939
1943
|
}));
|
1940
1944
|
}
|
1941
1945
|
await Promise.all(promises);
|
package/esm/sig/http.js
CHANGED
@@ -135,7 +135,7 @@ export async function verifyRequest(request, options = {}) {
|
|
135
135
|
}
|
136
136
|
});
|
137
137
|
}
|
138
|
-
async function verifyRequestInternal(request, span, { documentLoader, contextLoader, timeWindow, currentTime, keyCache, } = {}) {
|
138
|
+
async function verifyRequestInternal(request, span, { documentLoader, contextLoader, timeWindow, currentTime, keyCache, tracerProvider, } = {}) {
|
139
139
|
const logger = getLogger(["fedify", "sig", "http"]);
|
140
140
|
if (request.bodyUsed) {
|
141
141
|
logger.error("Failed to verify; the request body is already consumed.", { url: request.url });
|
@@ -244,6 +244,7 @@ async function verifyRequestInternal(request, span, { documentLoader, contextLoa
|
|
244
244
|
documentLoader,
|
245
245
|
contextLoader,
|
246
246
|
keyCache,
|
247
|
+
tracerProvider,
|
247
248
|
});
|
248
249
|
if (key == null)
|
249
250
|
return null;
|
package/esm/sig/key.js
CHANGED
@@ -106,7 +106,7 @@ export async function importJwk(jwk, type) {
|
|
106
106
|
*/
|
107
107
|
export async function fetchKey(keyId,
|
108
108
|
// deno-lint-ignore no-explicit-any
|
109
|
-
cls, { documentLoader, contextLoader, keyCache } = {}) {
|
109
|
+
cls, { documentLoader, contextLoader, keyCache, tracerProvider } = {}) {
|
110
110
|
const logger = getLogger(["fedify", "sig", "key"]);
|
111
111
|
const cacheKey = typeof keyId === "string" ? new URL(keyId) : keyId;
|
112
112
|
keyId = typeof keyId === "string" ? keyId : keyId.href;
|
@@ -140,6 +140,7 @@ cls, { documentLoader, contextLoader, keyCache } = {}) {
|
|
140
140
|
object = await Object.fromJsonLd(document, {
|
141
141
|
documentLoader,
|
142
142
|
contextLoader,
|
143
|
+
tracerProvider,
|
143
144
|
});
|
144
145
|
}
|
145
146
|
catch (e) {
|
@@ -149,6 +150,7 @@ cls, { documentLoader, contextLoader, keyCache } = {}) {
|
|
149
150
|
object = await cls.fromJsonLd(document, {
|
150
151
|
documentLoader,
|
151
152
|
contextLoader,
|
153
|
+
tracerProvider,
|
152
154
|
});
|
153
155
|
}
|
154
156
|
catch (e) {
|
@@ -166,8 +168,12 @@ cls, { documentLoader, contextLoader, keyCache } = {}) {
|
|
166
168
|
else if (isActor(object)) {
|
167
169
|
// @ts-ignore: cls is either CryptographicKey or Multikey
|
168
170
|
const keys = cls === CryptographicKey
|
169
|
-
? object.getPublicKeys({ documentLoader, contextLoader })
|
170
|
-
: object.getAssertionMethods({
|
171
|
+
? object.getPublicKeys({ documentLoader, contextLoader, tracerProvider })
|
172
|
+
: object.getAssertionMethods({
|
173
|
+
documentLoader,
|
174
|
+
contextLoader,
|
175
|
+
tracerProvider,
|
176
|
+
});
|
171
177
|
for await (const k of keys) {
|
172
178
|
if (k.id?.href === keyId) {
|
173
179
|
key = k;
|
package/esm/sig/owner.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { trace } from "@opentelemetry/api";
|
1
2
|
import { getDocumentLoader, } from "../runtime/docloader.js";
|
2
3
|
import { isActor } from "../vocab/actor.js";
|
3
4
|
import { CryptographicKey, Object as ASObject, } from "../vocab/vocab.js";
|
@@ -30,8 +31,10 @@ export async function doesActorOwnKey(activity, key, options) {
|
|
30
31
|
* @param options Options for getting the key owner.
|
31
32
|
* @returns The actor that owns the key, or `null` if the key has no known
|
32
33
|
* owner.
|
34
|
+
* @since 0.7.0
|
33
35
|
*/
|
34
36
|
export async function getKeyOwner(keyId, options) {
|
37
|
+
const tracerProvider = options.tracerProvider ?? trace.getTracerProvider();
|
35
38
|
const documentLoader = options.documentLoader ?? getDocumentLoader();
|
36
39
|
const contextLoader = options.contextLoader ?? getDocumentLoader();
|
37
40
|
let object;
|
@@ -54,6 +57,7 @@ export async function getKeyOwner(keyId, options) {
|
|
54
57
|
object = await ASObject.fromJsonLd(keyDoc, {
|
55
58
|
documentLoader,
|
56
59
|
contextLoader,
|
60
|
+
tracerProvider,
|
57
61
|
});
|
58
62
|
}
|
59
63
|
catch (e) {
|
@@ -63,6 +67,7 @@ export async function getKeyOwner(keyId, options) {
|
|
63
67
|
object = await CryptographicKey.fromJsonLd(keyDoc, {
|
64
68
|
documentLoader,
|
65
69
|
contextLoader,
|
70
|
+
tracerProvider,
|
66
71
|
});
|
67
72
|
}
|
68
73
|
catch (e) {
|
@@ -76,7 +81,11 @@ export async function getKeyOwner(keyId, options) {
|
|
76
81
|
if (object instanceof CryptographicKey) {
|
77
82
|
if (object.ownerId == null)
|
78
83
|
return null;
|
79
|
-
owner = await object.getOwner({
|
84
|
+
owner = await object.getOwner({
|
85
|
+
documentLoader,
|
86
|
+
contextLoader,
|
87
|
+
tracerProvider,
|
88
|
+
});
|
80
89
|
}
|
81
90
|
else if (isActor(object)) {
|
82
91
|
owner = object;
|
package/esm/vocab/lookup.js
CHANGED