@warmdrift/kgauto-compiler 2.0.0-alpha.18 → 2.0.0-alpha.19

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.
@@ -25,8 +25,6 @@ __export(glassbox_routes_exports, {
25
25
  module.exports = __toCommonJS(glassbox_routes_exports);
26
26
 
27
27
  // src/glassbox-routes/auth.ts
28
- var import_node_buffer = require("buffer");
29
- var import_node_crypto = require("crypto");
30
28
  var JSON_HEADERS = { "Content-Type": "application/json" };
31
29
  function jsonError(status, code) {
32
30
  return new Response(JSON.stringify({ error: code }), {
@@ -36,10 +34,11 @@ function jsonError(status, code) {
36
34
  }
37
35
  function tokensEqual(a, b) {
38
36
  if (a.length !== b.length) return false;
39
- const ab = import_node_buffer.Buffer.from(a, "utf8");
40
- const bb = import_node_buffer.Buffer.from(b, "utf8");
41
- if (ab.length !== bb.length) return false;
42
- return (0, import_node_crypto.timingSafeEqual)(ab, bb);
37
+ let mismatch = 0;
38
+ for (let i = 0; i < a.length; i++) {
39
+ mismatch |= a.charCodeAt(i) ^ b.charCodeAt(i);
40
+ }
41
+ return mismatch === 0;
43
42
  }
44
43
  function checkAuth(req, config) {
45
44
  const authHeader = req.headers.get("Authorization") ?? "";
@@ -4,8 +4,6 @@ import {
4
4
  import "../chunk-NUTC7NUC.mjs";
5
5
 
6
6
  // src/glassbox-routes/auth.ts
7
- import { Buffer } from "buffer";
8
- import { timingSafeEqual } from "crypto";
9
7
  var JSON_HEADERS = { "Content-Type": "application/json" };
10
8
  function jsonError(status, code) {
11
9
  return new Response(JSON.stringify({ error: code }), {
@@ -15,10 +13,11 @@ function jsonError(status, code) {
15
13
  }
16
14
  function tokensEqual(a, b) {
17
15
  if (a.length !== b.length) return false;
18
- const ab = Buffer.from(a, "utf8");
19
- const bb = Buffer.from(b, "utf8");
20
- if (ab.length !== bb.length) return false;
21
- return timingSafeEqual(ab, bb);
16
+ let mismatch = 0;
17
+ for (let i = 0; i < a.length; i++) {
18
+ mismatch |= a.charCodeAt(i) ^ b.charCodeAt(i);
19
+ }
20
+ return mismatch === 0;
22
21
  }
23
22
  function checkAuth(req, config) {
24
23
  const authHeader = req.headers.get("Authorization") ?? "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warmdrift/kgauto-compiler",
3
- "version": "2.0.0-alpha.18",
3
+ "version": "2.0.0-alpha.19",
4
4
  "description": "Prompt compiler + central learning brain for multi-model AI apps. Swap models without rewriting prompts.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",