@crvouga/mockingbird-service-livekit 3.10.5 → 3.10.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog — @crvouga/mockingbird-service-livekit
2
2
 
3
+ ## 3.10.7 (2026-11-02)
4
+
5
+ ### Fixes and improvements
6
+
7
+ - save and replay a 500 the endpoint produced under an Idempotency-Key ([789bbcc](https://github.com/crvouga/mockingbird/commit/789bbcccb792cddaf27f4f6db6d2fcf2da1d07fe))
8
+
9
+ ## 3.10.6 (2026-11-02)
10
+
11
+ ### Fixes and improvements
12
+
13
+ - compare the admin key in constant time ([2a43141](https://github.com/crvouga/mockingbird/commit/2a43141f50dab41e698c3bbce0c69bf65b40e24e))
14
+
3
15
  ## 3.10.5 (2026-11-02)
4
16
 
5
17
  ### Fixes and improvements
@@ -9,7 +9,7 @@ import {
9
9
  parseFaultHeader,
10
10
  resolveAdminPrefix,
11
11
  restoreClock
12
- } from "./chunk-DFKBZOIJ.js";
12
+ } from "./chunk-URBGVMAI.js";
13
13
 
14
14
  // ../../adapters/node/dist/cli.js
15
15
  import { readFile as readFile5 } from "node:fs/promises";
@@ -3057,7 +3057,7 @@ async function preflightFleet(config, options) {
3057
3057
  break;
3058
3058
  }
3059
3059
  }
3060
- targets.set(name, { ...target, packageVersion: packageVersion ?? "3.10.5" });
3060
+ targets.set(name, { ...target, packageVersion: packageVersion ?? "3.10.7" });
3061
3061
  } catch (error) {
3062
3062
  throw new Error(`service ${name}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
3063
3063
  }
@@ -5012,4 +5012,4 @@ export {
5012
5012
  createServer2 as createServer,
5013
5013
  serveTarget
5014
5014
  };
5015
- //# sourceMappingURL=chunk-OBX5S4A2.js.map
5015
+ //# sourceMappingURL=chunk-5463D65S.js.map
@@ -2507,6 +2507,46 @@ var createNamespaceControls = (options) => {
2507
2507
  };
2508
2508
  };
2509
2509
 
2510
+ // ../core/dist/signing.js
2511
+ var encoder = new TextEncoder();
2512
+ var toBase64 = (bytes) => {
2513
+ let binary = "";
2514
+ for (const byte of bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)) {
2515
+ binary += String.fromCharCode(byte);
2516
+ }
2517
+ return btoa(binary);
2518
+ };
2519
+ var fromBase64 = (value) => Uint8Array.from(atob(value), (char) => char.charCodeAt(0));
2520
+ var toHex = (bytes) => [...bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
2521
+ var keyBytes = (key) => typeof key === "string" ? encoder.encode(key) : key;
2522
+ var hmac = async (algorithm, key, message, encoding = "hex") => {
2523
+ const imported = await crypto.subtle.importKey("raw", keyBytes(key), { name: "HMAC", hash: algorithm }, false, ["sign"]);
2524
+ const signed = await crypto.subtle.sign("HMAC", imported, typeof message === "string" ? encoder.encode(message) : message);
2525
+ return encoding === "hex" ? toHex(signed) : toBase64(signed);
2526
+ };
2527
+ var svixSecretBytes = (secret) => {
2528
+ const raw = secret.replace(/^f?whsec_/, "");
2529
+ try {
2530
+ return fromBase64(raw);
2531
+ } catch {
2532
+ throw new TypeError("webhook secret must be whsec_<base64> (as Svix issues it)");
2533
+ }
2534
+ };
2535
+ var signSvix = async (secret, messageId, timestampSeconds, body) => `v1,${await hmac("SHA-256", svixSecretBytes(secret), `${messageId}.${timestampSeconds}.${body}`, "base64")}`;
2536
+ var signTimestamped = async (secret, timestampSeconds, body) => `t=${timestampSeconds},v1=${await hmac("SHA-256", secret, `${timestampSeconds}.${body}`, "hex")}`;
2537
+ var signTwilio = async (authToken, url, params) => {
2538
+ const payload = url + Object.keys(params).sort().map((key) => `${key}${params[key]}`).join("");
2539
+ return hmac("SHA-1", authToken, payload, "base64");
2540
+ };
2541
+ var timingSafeEqual = (a, b) => {
2542
+ if (a.length !== b.length)
2543
+ return false;
2544
+ let diff = 0;
2545
+ for (let i = 0; i < a.length; i++)
2546
+ diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
2547
+ return diff === 0;
2548
+ };
2549
+
2510
2550
  // ../core/dist/surface.js
2511
2551
  var defineMock = (runtime) => runtime;
2512
2552
  var ADMIN_ROUTE_REFERENCE = {
@@ -2625,6 +2665,10 @@ var assertAdminPrefixAvailable = (prefix, paths) => {
2625
2665
  }
2626
2666
  };
2627
2667
  var ADMIN_KEY_HEADER = CONTROL_HEADERS.adminKey;
2668
+ var hasAdminKey = (headers, adminKey) => {
2669
+ const sent = headers.get(ADMIN_KEY_HEADER);
2670
+ return sent !== null && timingSafeEqual(sent, adminKey);
2671
+ };
2628
2672
  var NAMESPACE_HEADER = CONTROL_HEADERS.namespace;
2629
2673
  var ADMIN_DOCS_URL = "https://mockingbird.chrisvouga.dev/docs/admin-controls";
2630
2674
  var ADMIN_CONTROL_PAGES = [
@@ -3098,7 +3142,7 @@ var createControlPlane = (context) => {
3098
3142
  }
3099
3143
  const path = url.pathname.slice(adminPrefix.length) || "/";
3100
3144
  const shell = request.method === "GET" && (path === "/ui" || path === "/ui/");
3101
- if (!shell && context.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== context.adminKey) {
3145
+ if (!shell && context.adminKey !== void 0 && !hasAdminKey(request.headers, context.adminKey)) {
3102
3146
  return adminError(401, `missing or wrong ${ADMIN_KEY_HEADER}`);
3103
3147
  }
3104
3148
  for (const route of routes) {
@@ -3853,39 +3897,7 @@ var stateAdminRoutes = (routes) => {
3853
3897
  };
3854
3898
 
3855
3899
  // ../core/dist/version.js
3856
- var PACKAGE_VERSION = true ? "3.10.5" : UNRELEASED_VERSION;
3857
-
3858
- // ../core/dist/signing.js
3859
- var encoder = new TextEncoder();
3860
- var toBase64 = (bytes) => {
3861
- let binary = "";
3862
- for (const byte of bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)) {
3863
- binary += String.fromCharCode(byte);
3864
- }
3865
- return btoa(binary);
3866
- };
3867
- var fromBase64 = (value) => Uint8Array.from(atob(value), (char) => char.charCodeAt(0));
3868
- var toHex = (bytes) => [...bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
3869
- var keyBytes = (key) => typeof key === "string" ? encoder.encode(key) : key;
3870
- var hmac = async (algorithm, key, message, encoding = "hex") => {
3871
- const imported = await crypto.subtle.importKey("raw", keyBytes(key), { name: "HMAC", hash: algorithm }, false, ["sign"]);
3872
- const signed = await crypto.subtle.sign("HMAC", imported, typeof message === "string" ? encoder.encode(message) : message);
3873
- return encoding === "hex" ? toHex(signed) : toBase64(signed);
3874
- };
3875
- var svixSecretBytes = (secret) => {
3876
- const raw = secret.replace(/^f?whsec_/, "");
3877
- try {
3878
- return fromBase64(raw);
3879
- } catch {
3880
- throw new TypeError("webhook secret must be whsec_<base64> (as Svix issues it)");
3881
- }
3882
- };
3883
- var signSvix = async (secret, messageId, timestampSeconds, body) => `v1,${await hmac("SHA-256", svixSecretBytes(secret), `${messageId}.${timestampSeconds}.${body}`, "base64")}`;
3884
- var signTimestamped = async (secret, timestampSeconds, body) => `t=${timestampSeconds},v1=${await hmac("SHA-256", secret, `${timestampSeconds}.${body}`, "hex")}`;
3885
- var signTwilio = async (authToken, url, params) => {
3886
- const payload = url + Object.keys(params).sort().map((key) => `${key}${params[key]}`).join("");
3887
- return hmac("SHA-1", authToken, payload, "base64");
3888
- };
3900
+ var PACKAGE_VERSION = true ? "3.10.7" : UNRELEASED_VERSION;
3889
3901
 
3890
3902
  // ../core/dist/webhooks.js
3891
3903
  var signers = {
@@ -5280,7 +5292,7 @@ var createRuntime = (options) => {
5280
5292
  throw error2;
5281
5293
  }
5282
5294
  const rewinds = at !== void 0 && selectedBranch === "main" && MUTATING_METHODS.has(request.method);
5283
- if ((requested || rewinds) && options.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== options.adminKey)
5295
+ if ((requested || rewinds) && options.adminKey !== void 0 && !hasAdminKey(request.headers, options.adminKey))
5284
5296
  return refuse(401, `control headers need ${ADMIN_KEY_HEADER}`);
5285
5297
  controls.ensure(namespace);
5286
5298
  if (requested?.restore !== void 0 && !snapshotStore.get(namespace, requested.restore))
@@ -6259,4 +6271,4 @@ export {
6259
6271
  LIVEKIT_NAMESPACE,
6260
6272
  LiveKitAPI
6261
6273
  };
6262
- //# sourceMappingURL=chunk-DFKBZOIJ.js.map
6274
+ //# sourceMappingURL=chunk-URBGVMAI.js.map