@crvouga/mockingbird-service-elevenlabs 0.9.5 → 0.9.6

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,11 @@
1
1
  # Changelog — @crvouga/mockingbird-service-elevenlabs
2
2
 
3
+ ## 0.9.6 (2026-11-02)
4
+
5
+ ### Fixes and improvements
6
+
7
+ - compare the admin key in constant time ([2a43141](https://github.com/crvouga/mockingbird/commit/2a43141f50dab41e698c3bbce0c69bf65b40e24e))
8
+
3
9
  ## 0.9.5 (2026-11-02)
4
10
 
5
11
  ### Fixes and improvements
@@ -2401,6 +2401,26 @@ var createNamespaceControls = (options) => {
2401
2401
  };
2402
2402
  };
2403
2403
 
2404
+ // ../core/dist/signing.js
2405
+ var encoder = new TextEncoder();
2406
+ var toBase64 = (bytes) => {
2407
+ let binary = "";
2408
+ for (const byte of bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)) {
2409
+ binary += String.fromCharCode(byte);
2410
+ }
2411
+ return btoa(binary);
2412
+ };
2413
+ var fromBase64 = (value) => Uint8Array.from(atob(value), (char) => char.charCodeAt(0));
2414
+ var toHex = (bytes) => [...bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
2415
+ var timingSafeEqual = (a, b) => {
2416
+ if (a.length !== b.length)
2417
+ return false;
2418
+ let diff = 0;
2419
+ for (let i = 0; i < a.length; i++)
2420
+ diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
2421
+ return diff === 0;
2422
+ };
2423
+
2404
2424
  // ../core/dist/surface.js
2405
2425
  var defineMock = (runtime) => runtime;
2406
2426
  var ADMIN_ROUTE_REFERENCE = {
@@ -2519,6 +2539,10 @@ var assertAdminPrefixAvailable = (prefix, paths) => {
2519
2539
  }
2520
2540
  };
2521
2541
  var ADMIN_KEY_HEADER = CONTROL_HEADERS.adminKey;
2542
+ var hasAdminKey = (headers, adminKey) => {
2543
+ const sent = headers.get(ADMIN_KEY_HEADER);
2544
+ return sent !== null && timingSafeEqual(sent, adminKey);
2545
+ };
2522
2546
  var NAMESPACE_HEADER = CONTROL_HEADERS.namespace;
2523
2547
  var ADMIN_DOCS_URL = "https://mockingbird.chrisvouga.dev/docs/admin-controls";
2524
2548
  var ADMIN_CONTROL_PAGES = [
@@ -2992,7 +3016,7 @@ var createControlPlane = (context) => {
2992
3016
  }
2993
3017
  const path = url.pathname.slice(adminPrefix.length) || "/";
2994
3018
  const shell = request.method === "GET" && (path === "/ui" || path === "/ui/");
2995
- if (!shell && context.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== context.adminKey) {
3019
+ if (!shell && context.adminKey !== void 0 && !hasAdminKey(request.headers, context.adminKey)) {
2996
3020
  return adminError(401, `missing or wrong ${ADMIN_KEY_HEADER}`);
2997
3021
  }
2998
3022
  for (const route of routes) {
@@ -3754,19 +3778,7 @@ var stateAdminRoutes = (routes) => {
3754
3778
  };
3755
3779
 
3756
3780
  // ../core/dist/version.js
3757
- var PACKAGE_VERSION = true ? "0.9.5" : UNRELEASED_VERSION;
3758
-
3759
- // ../core/dist/signing.js
3760
- var encoder = new TextEncoder();
3761
- var toBase64 = (bytes) => {
3762
- let binary = "";
3763
- for (const byte of bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)) {
3764
- binary += String.fromCharCode(byte);
3765
- }
3766
- return btoa(binary);
3767
- };
3768
- var fromBase64 = (value) => Uint8Array.from(atob(value), (char) => char.charCodeAt(0));
3769
- var toHex = (bytes) => [...bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
3781
+ var PACKAGE_VERSION = true ? "0.9.6" : UNRELEASED_VERSION;
3770
3782
 
3771
3783
  // ../core/dist/webhooks.js
3772
3784
  var json4 = (status, body) => new Response(JSON.stringify(body), {
@@ -4745,7 +4757,7 @@ var createRuntime = (options) => {
4745
4757
  throw error;
4746
4758
  }
4747
4759
  const rewinds = at !== void 0 && selectedBranch === "main" && MUTATING_METHODS.has(request.method);
4748
- if ((requested || rewinds) && options.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== options.adminKey)
4760
+ if ((requested || rewinds) && options.adminKey !== void 0 && !hasAdminKey(request.headers, options.adminKey))
4749
4761
  return refuse(401, `control headers need ${ADMIN_KEY_HEADER}`);
4750
4762
  controls.ensure(namespace);
4751
4763
  if (requested?.restore !== void 0 && !snapshotStore.get(namespace, requested.restore))
@@ -5994,4 +6006,4 @@ export {
5994
6006
  API_KEY_HEADER,
5995
6007
  ElevenLabsAPI
5996
6008
  };
5997
- //# sourceMappingURL=chunk-CYGK4DXU.js.map
6009
+ //# sourceMappingURL=chunk-5DQV5XSV.js.map