@fedify/fedify 1.6.0-dev.810 → 1.6.0-dev.811
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/esm/deno.js +1 -4
- package/esm/runtime/docloader.js +14 -7
- package/esm/runtime/key.js +3 -2
- package/esm/sig/http.js +35 -1
- package/esm/vocab/vocab.js +176 -176
- package/package.json +1 -1
- package/types/deno.d.ts +0 -3
- package/types/runtime/docloader.d.ts.map +1 -1
- package/types/runtime/key.d.ts.map +1 -1
- package/types/sig/http.d.ts +15 -0
- package/types/sig/http.d.ts.map +1 -1
- package/esm/deps/jsr.io/@david/which-runtime/0.2.1/mod.js +0 -10
- package/esm/deps/jsr.io/@std/bytes/1.0.6/_types.js +0 -2
- package/esm/deps/jsr.io/@std/bytes/1.0.6/concat.js +0 -32
- package/esm/deps/jsr.io/@std/crypto/1.0.5/timing_safe_equal.js +0 -55
- package/types/deps/jsr.io/@david/which-runtime/0.2.1/mod.d.ts +0 -3
- package/types/deps/jsr.io/@david/which-runtime/0.2.1/mod.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/bytes/1.0.6/_types.d.ts +0 -9
- package/types/deps/jsr.io/@std/bytes/1.0.6/_types.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/bytes/1.0.6/concat.d.ts +0 -21
- package/types/deps/jsr.io/@std/bytes/1.0.6/concat.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/crypto/1.0.5/timing_safe_equal.d.ts +0 -34
- package/types/deps/jsr.io/@std/crypto/1.0.5/timing_safe_equal.d.ts.map +0 -1
package/esm/deno.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
export default {
|
2
2
|
"name": "@fedify/fedify",
|
3
|
-
"version": "1.6.0-dev.
|
3
|
+
"version": "1.6.0-dev.811+a0a19612",
|
4
4
|
"license": "MIT",
|
5
5
|
"exports": {
|
6
6
|
".": "./mod.ts",
|
@@ -18,7 +18,6 @@ export default {
|
|
18
18
|
},
|
19
19
|
"imports": {
|
20
20
|
"@cfworker/json-schema": "npm:@cfworker/json-schema@^2.0.1",
|
21
|
-
"@david/which-runtime": "jsr:@david/which-runtime@^0.2.1",
|
22
21
|
"@deno/dnt": "jsr:@deno/dnt@0.41.3",
|
23
22
|
"@es-toolkit/es-toolkit": "jsr:@es-toolkit/es-toolkit@^1.38.0",
|
24
23
|
"@hugoalh/http-header-link": "jsr:@hugoalh/http-header-link@^1.0.2",
|
@@ -26,8 +25,6 @@ export default {
|
|
26
25
|
"@opentelemetry/semantic-conventions": "npm:@opentelemetry/semantic-conventions@^1.27.0",
|
27
26
|
"@phensley/language-tag": "npm:@phensley/language-tag@^1.9.0",
|
28
27
|
"@std/assert": "jsr:@std/assert@^0.226.0",
|
29
|
-
"@std/bytes": "jsr:@std/bytes@^1.0.2",
|
30
|
-
"@std/crypto": "jsr:@std/crypto@^1.0.4",
|
31
28
|
"@std/encoding": "jsr:@std/encoding@1.0.7",
|
32
29
|
"@std/http": "jsr:@std/http@^1.0.6",
|
33
30
|
"@std/testing": "jsr:@std/testing@^0.224.0",
|
package/esm/runtime/docloader.js
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
import * as dntShim from "../_dnt.shims.js";
|
2
|
-
import { isDeno, isNode } from "../deps/jsr.io/@david/which-runtime/0.2.1/mod.js";
|
3
2
|
import { HTTPHeaderLink } from "@hugoalh/http-header-link";
|
4
3
|
import { getLogger } from "@logtape/logtape";
|
5
4
|
import process from "node:process";
|
@@ -328,12 +327,20 @@ export function kvCache({ loader, kv, prefix, rules }) {
|
|
328
327
|
*/
|
329
328
|
export function getUserAgent({ software, url } = {}) {
|
330
329
|
const fedify = `Fedify/${metadata.version}`;
|
331
|
-
const runtime =
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
330
|
+
const runtime = // dnt-shim-ignore
|
331
|
+
|
332
|
+
// deno-lint-ignore no-explicit-any
|
333
|
+
globalThis.Deno?.version?.deno != null
|
334
|
+
? `Deno/${dntShim.Deno.version.deno}`
|
335
|
+
// dnt-shim-ignore
|
336
|
+
// deno-lint-ignore no-explicit-any
|
337
|
+
: globalThis.process?.versions?.bun != null
|
338
|
+
? `Bun/${process.versions.bun}`
|
339
|
+
// dnt-shim-ignore
|
340
|
+
// deno-lint-ignore no-explicit-any
|
341
|
+
: globalThis.process?.versions?.node != null
|
342
|
+
? `Node.js/${process.versions.node}`
|
343
|
+
: null;
|
337
344
|
const userAgent = software == null ? [fedify] : [software, fedify];
|
338
345
|
if (runtime != null)
|
339
346
|
userAgent.push(runtime);
|
package/esm/runtime/key.js
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
import * as dntShim from "../_dnt.shims.js";
|
2
|
-
import { concat } from "../deps/jsr.io/@std/bytes/1.0.6/concat.js";
|
3
2
|
import { decodeBase64, encodeBase64 } from "../deps/jsr.io/@std/encoding/1.0.7/base64.js";
|
4
3
|
import { decodeBase64Url } from "../deps/jsr.io/@std/encoding/1.0.7/base64url.js";
|
5
4
|
import { decodeHex } from "../deps/jsr.io/@std/encoding/1.0.7/hex.js";
|
@@ -124,7 +123,9 @@ export async function exportMultibaseKey(key) {
|
|
124
123
|
key.algorithm.hash.name ===
|
125
124
|
"SHA-256") {
|
126
125
|
const jwk = await dntShim.crypto.subtle.exportKey("jwk", key);
|
127
|
-
const
|
126
|
+
const decodedN = decodeBase64Url(jwk.n);
|
127
|
+
const n = new Uint8Array(decodedN.length + 1);
|
128
|
+
n.set(decodedN, 1);
|
128
129
|
const sequence = new Sequence({
|
129
130
|
value: [
|
130
131
|
new Integer({
|
package/esm/sig/http.js
CHANGED
@@ -2,7 +2,6 @@ import * as dntShim from "../_dnt.shims.js";
|
|
2
2
|
import { getLogger } from "@logtape/logtape";
|
3
3
|
import { SpanStatusCode, trace, } from "@opentelemetry/api";
|
4
4
|
import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL, } from "@opentelemetry/semantic-conventions";
|
5
|
-
import { timingSafeEqual } from "../deps/jsr.io/@std/crypto/1.0.5/timing_safe_equal.js";
|
6
5
|
import { decodeBase64, encodeBase64 } from "../deps/jsr.io/@std/encoding/1.0.7/base64.js";
|
7
6
|
import { encodeHex } from "../deps/jsr.io/@std/encoding/1.0.7/hex.js";
|
8
7
|
import { decodeDict, encodeItem, Item, } from "structured-field-values";
|
@@ -808,4 +807,39 @@ export async function doubleKnock(request, identity, options = {}) {
|
|
808
807
|
}
|
809
808
|
return response;
|
810
809
|
}
|
810
|
+
/**
|
811
|
+
* Performs a timing-safe equality comparison between two `Uint8Array` values.
|
812
|
+
*
|
813
|
+
* This function is designed to take a constant amount of time to execute,
|
814
|
+
* dependent only on the length of the longer of the two arrays,
|
815
|
+
* regardless of where the first difference in bytes occurs. This helps
|
816
|
+
* prevent timing attacks.
|
817
|
+
*
|
818
|
+
* @param a The first bytes.
|
819
|
+
* @param b The second bytes.
|
820
|
+
* @returns `true` if the arrays are of the same length and contain the same
|
821
|
+
* bytes, `false` otherwise.
|
822
|
+
* @since 1.6.0
|
823
|
+
*/
|
824
|
+
export function timingSafeEqual(a, b) {
|
825
|
+
const lenA = a.length;
|
826
|
+
const lenB = b.length;
|
827
|
+
const commonLength = Math.max(lenA, lenB);
|
828
|
+
let result = 0;
|
829
|
+
// Perform byte-wise XOR comparison for the length of the longer array.
|
830
|
+
// If one array is shorter, its out-of-bounds "bytes" are treated as 0 for the comparison.
|
831
|
+
// All byte differences are accumulated into the `result` using bitwise OR.
|
832
|
+
for (let i = 0; i < commonLength; i++) {
|
833
|
+
const byteA = i < lenA ? a[i] : 0;
|
834
|
+
const byteB = i < lenB ? b[i] : 0;
|
835
|
+
result |= byteA ^ byteB;
|
836
|
+
}
|
837
|
+
// Incorporate the length difference into the result.
|
838
|
+
// If lengths are different, (lenA ^ lenB) will be non-zero, making `result` non-zero.
|
839
|
+
// This ensures that arrays are only considered equal if both their contents
|
840
|
+
// (up to their respective lengths) and their lengths are identical.
|
841
|
+
result |= lenA ^ lenB;
|
842
|
+
// `result` will be 0 if and only if all XORed byte pairs were 0 AND lengths were equal.
|
843
|
+
return result === 0;
|
844
|
+
}
|
811
845
|
// cSpell: ignore keyid
|